Frictional Games Forum (read-only)
Script Area triggering twice? Why? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script Area triggering twice? Why? (/thread-24544.html)



Script Area triggering twice? Why? - FurtherGames - 02-04-2014

So, I created a script area so that if the character tries to process before they read the note, it turns them to look at the note and tells them to read it. Fair do's, everything is fine. I've even set up a block box so they can't sneak past the script area. But one small problem.

As they leave the script area, after just triggering it, they trigger it again by walking out of it. I know setting the

Quote:AddEntityCollideCallback("Player", "ScriptArea_12", "Func7", false, 0);

"false," part to true would fix the issue, but this would mean that the script area would deactivate itself/not work again if the user tried to walk on without the note. Would making the script area thinner work or am I just going to have to deal with it? Or set it to "true" and let the block boxes do the work, just no message.


RE: Script Area triggering twice? Why? - daortir - 02-05-2014

the 0 is the part determining if the function will be called when entering the script area, or when exiting it.
1 = enter
-1 = leave
0 = both.


Here take a look at this :

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called

alStates - 1 = only enter, -1 = only leave, 0 = both <=== THERE YOU GO

That's directly from this page http://wiki.frictionalgames.com/hpl2/amnesia/script_functions. It holds a very detailed explanation of how every function work ^^.


RE: Script Area triggering twice? Why? - Mudbill - 02-05-2014

The last number, 0 in this case, is the state this event is executed at. If you read on the syntax, it says 1 = enter, -1 = exit, 0 = both. So you should change that number into 1 to have it only run when you enter the area.

Edit: Looks like daortir beat me to it xD


RE: Script Area triggering twice? Why? - daortir - 02-05-2014

(02-05-2014, 12:31 AM)Mudbill Wrote: The last number, 0 in this case, is the state this event is executed at. If you read on the syntax, it says 1 = enter, -1 = exit, 0 = both. So you should change that number into 1 to have it only run when you enter the area.

Gotcha xD
Sorry for the ninja-answer ; >


RE: Script Area triggering twice? Why? - FurtherGames - 02-05-2014

(02-05-2014, 12:30 AM)daortir Wrote: the 0 is the part determining if the function will be called when entering the script area, or when exiting it.
1 = enter
-1 = leave
0 = both.


Here take a look at this :

void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called

alStates - 1 = only enter, -1 = only leave, 0 = both <=== THERE YOU GO

That's directly from this page http://wiki.frictionalgames.com/hpl2/amnesia/script_functions. It holds a very detailed explanation of how every function work ^^.


Thanks. I'll try this later.


RE: Script Area triggering twice? Why? - FurtherGames - 02-05-2014

___________