Any way to loop a AddEntityCollideCallback? - 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: Any way to loop a AddEntityCollideCallback? (/thread-14497.html) |
Any way to loop a AddEntityCollideCallback? - theabcs - 04-04-2012 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. RE: Any way to loop a AddEntityCollideCallback? - stonecutter - 04-04-2012 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 ! RE: Any way to loop a AddEntityCollideCallback? - theabcs - 04-04-2012 (04-04-2012, 10:35 PM)stonecutter Wrote: check out ! RE: Any way to loop a AddEntityCollideCallback? - stonecutter - 04-04-2012 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 ? RE: Any way to loop a AddEntityCollideCallback? - theabcs - 04-05-2012 (04-04-2012, 10:59 PM)stonecutter Wrote: is this right ?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. RE: Any way to loop a AddEntityCollideCallback? - stonecutter - 04-05-2012 so i think you added a Counter reset ? set "arm" = 0 after you reach 10, so that you will count again ? RE: Any way to loop a AddEntityCollideCallback? - theabcs - 04-13-2012 (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. |