palistov
Posting Freak
Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation:
57
|
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 |
|