Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting noob returns. HALP
Bennick Offline
Member

Posts: 77
Threads: 27
Joined: Apr 2011
Reputation: 0
#1
Scripting noob returns. HALP

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.

Fratricide (title not finalized): 2/7 maps. :D
04-09-2011, 06:50 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Scripting noob returns. HALP

SetNPCAwake is not a function that used.
Use SetEntityActive instead.

04-09-2011, 08:59 PM
Website Find
Youcef Offline
Junior Member

Posts: 48
Threads: 5
Joined: Sep 2010
Reputation: 0
#3
RE: Scripting noob returns. HALP

void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "monster",true);
}


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

04-09-2011, 09:11 PM
Website Find
Bennick Offline
Member

Posts: 77
Threads: 27
Joined: Apr 2011
Reputation: 0
#4
RE: Scripting noob returns. HALP

(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.

Fratricide (title not finalized): 2/7 maps. :D
(This post was last modified: 04-10-2011, 06:38 AM by Bennick.)
04-10-2011, 06:18 AM
Find
Youcef Offline
Junior Member

Posts: 48
Threads: 5
Joined: Sep 2010
Reputation: 0
#5
RE: Scripting noob returns. HALP

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, 09:33 AM
Website Find
Solarn Offline
Junior Member

Posts: 36
Threads: 3
Joined: Mar 2011
Reputation: 0
#6
RE: Scripting noob returns. HALP

(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.
04-10-2011, 10:44 AM
Find




Users browsing this thread: 1 Guest(s)