Frictional Games Forum (read-only)

Full Version: Any way to loop a AddEntityCollideCallback?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my script:

void scare(string &in asParent, string &in asChild, int alState) {
AddLocalVarInt("arm", 1);
if(GetLocalVarInt("arm") == 10){

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);

GiveSanityDamage(10.0f, true);
SetSwingDoorClosed("door2", true, true);
SetEntityActive("grunt2", true);

AddEnemyPatrolNode("grunt2", "PathNodeArea_17", 0, "idle");
AddEnemyPatrolNode("grunt2", "PathNodeArea_18", 0, "idle");
AddEnemyPatrolNode("grunt2", "PathNodeArea_19", 0, "idle");
AddEnemyPatrolNode("grunt2", "PathNodeArea_20", 0, "idle");
AddEnemyPatrolNode("grunt2", "PathNodeArea_21", 0, "idle");
AddEnemyPatrolNode("grunt2", "PathNodeArea_22", 0, "idle");
AddTimer("monster1", 30.0f, "gleave");
}
}


Is there any way to loop the script so that even if the script has been used, it can be reset/reused? The script works fine in game, however it is a one time deal and I would like it to be reusable multiple times.
check out !

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


It has nothing to do with your script yor callback gets deleted after one use ! Take a look at your "OnStart" and check you set the red market thing to false !
(04-04-2012, 10:35 PM)stonecutter Wrote: [ -> ]check out !

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


It has nothing to do with your script yor callback gets deleted after one use ! Take a look at your "OnStart" and check you set the red market thing to false !

Well in my script i have a local variable that has to be added until it reaches a limit. Because of this, the script is already on false. Here is my parent function:

AddEntityCollideCallback("Player", "ScriptArea_5", "scare", false, 0);

So, my script works fine, until it is 100% activated and it is then unresponsive.

is this right ?
AddLocalVarInt("arm", 1);

you set it to 1 but in the next if statement it has to be 10 ?

where is the function to increase the variable "arm" ?
maybe it has something to do that you have to set the variable again to 1.
can you post the whole script ?
(04-04-2012, 10:59 PM)stonecutter Wrote: [ -> ]is this right ?
AddLocalVarInt("arm", 1);

you set it to 1 but in the next if statement it has to be 10 ?

where is the function to increase the variable "arm" ?
maybe it has something to do that you have to set the variable again to 1.
can you post the whole script ?
I cannot post the whole script because it is over 400 lines. Firstly, AddLocalVarInt("arm", 1); means that you are adding a value of 1 to "arm". So this script says when the player collides with a certain script function so many times (10), then to activate the following. I also figure out the answer to my problem so no need to worry.


so i think you added a Counter reset ? set "arm" = 0 after you reach 10, so that you will count again ?
(04-05-2012, 10:07 AM)stonecutter Wrote: [ -> ]so i think you added a Counter reset ? set "arm" = 0 after you reach 10, so that you will count again ?
Yes i did exactly that by forcing the script to add a negative value to the variable.