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 help needed
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: Scripting help needed

Of course. That means you change AddEntityCollideCallback("Player", "AreaActivateGrunt", "Func01", false, 1); to true. False says that the function will be repeatedly called when the player enters the area. Changing it to true means the callback will happen only once.

Once you do that, you change your if statement to:

void Func01(string &in asParent, string &in asChild, int alState)
{
if(!HasItem("lantern_1")) { AddEntityCollideCallback("Player", "AreaActivateGrunt", "Func01", true, 1); return; }
if(HasItem("lantern_1") SetEntityActive("grunt_1", true);
}

The first if statement says that when the player does not have a lantern, the callback will be re-added. If the player does have the lantern, the first if statement will be ignored and the monster will be activated, without re-adding the callback. It does exactly what your script does, but without removing callbacks via script.

(This post was last modified: 05-29-2011, 10:33 AM by palistov.)
05-29-2011, 10:29 AM
Find


Messages In This Thread
Scripting help needed - by willochill - 05-28-2011, 04:47 AM
RE: Scripting help needed - by palistov - 05-28-2011, 07:18 AM
RE: Scripting help needed - by willochill - 05-28-2011, 03:55 PM
RE: Scripting help needed - by palistov - 05-29-2011, 10:29 AM



Users browsing this thread: 1 Guest(s)