Frictional Games Forum (read-only)

Full Version: Scripting noob returns. HALP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, so I'm trying to get it such that when the player picks up the lantern, the monster activates. What did I do wrong?

void OnStart()
{
FadeOut (0);
FadeIn(15);
}

void HasItem("lantern_1", "true");
{
SetNPCAwake("servant_grunt_1", "true", "true");
}

Note: Yes I know the fade on start stuff is for the fade in view. I'm mostly concerned about the second half, obviously, but was wondering if the first contributed to the problem.
SetNPCAwake is not a function that used.
Use SetEntityActive instead.
void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "monster",true);
}


void monster(string& asName)
{
SetEntityActive("servant_grunt_1", true);
}
(04-09-2011, 09:11 PM)Youcef Wrote: [ -> ]void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "monster",true);
}


void monster(string& asName)
{
SetEntityActive("servant_grunt_1", true);
}

That makes it look like the second half of this is redundant. With that first set of instructions (don't know the actual term, lol) I can see you're activating the monster by interacting with the lantern... Does the second set of instructions just specify which monster?
Also I typed that and it gave me a fatal scripting error.
Nevermind, I fixed the error. But it still doesn't work. I enter the level and the monster spawns before I even touch the lantern. Or does SetEntityActive just tell it to start walking along the nodes? What I'm trying to do is get it to spawn on the picking up of the lantern, as in everything is totally silent, then, upon lanternage, suddenly "RAWR" and presto, a walking gatherer.
There is no error in the script suggested above.

SetEntityPlayerInteractCallback ("lantern_1", "monster", true);
This means that when the player interacts with the lantern, the function "monster" is called.
The rest of the instructions is used to define that function.

If the monster spawns before you touch the lantern then make sure you unchecked the active box of the monster in the editor.

Check this map I made, I hope you'll find the answers to your problem.
http://www.mediafire.com/?v0wh5cpi45l3dgh
(04-10-2011, 06:18 AM)Bennick Wrote: [ -> ]
(04-09-2011, 09:11 PM)Youcef Wrote: [ -> ]void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "monster",true);
}


void monster(string& asName)
{
SetEntityActive("servant_grunt_1", true);
}

That makes it look like the second half of this is redundant. With that first set of instructions (don't know the actual term, lol) I can see you're activating the monster by interacting with the lantern... Does the second set of instructions just specify which monster?
Also I typed that and it gave me a fatal scripting error.
Nevermind, I fixed the error. But it still doesn't work. I enter the level and the monster spawns before I even touch the lantern. Or does SetEntityActive just tell it to start walking along the nodes? What I'm trying to do is get it to spawn on the picking up of the lantern, as in everything is totally silent, then, upon lanternage, suddenly "RAWR" and presto, a walking gatherer.
Nope. The first instruction (SetEntityPlayerInteractCallback) just tells the game to run the function called "monster" when interacting with the entity "lantern_1" (picking it up, in this case). The game engine doesn't know what the word "monster" means any more than it knows what the word "strawberry" would mean. Then the second set of instructions defines the function called "monster", telling the game that when it is told to run it, it must set the entity called "servant_grunt_1" to active. Of course, for this to have any effect, "servant_grunt_1" must be inactive. In the level editor, when selecting any entity (in this case, the grunt), there is a checkbox named "Active". Uncheck that to make the grunt inactive on level start.