![]() |
(fixed) RemoveTimer Problem! please help :( - 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: (fixed) RemoveTimer Problem! please help :( (/thread-17643.html) |
(fixed) RemoveTimer Problem! please help :( - bjaffedj - 08-10-2012 okay i have a map script. in the script i have a function which makes the player being pushed (AddPlayerBodyForce). but each time i try to remove the timer of the function it does not seem to work. the player still gets pushed :/ i have tried many things and hopefully you can help ![]() The scripting: void OnStart() { SetMapDisplayNameEntry("Intro"); //User properties SetPlayerActive(false); SetSanityDrainDisabled(true); SetInventoryDisabled(true); SetPlayerCrouchDisabled(true); SetPlayerJumpDisabled(true); ShowPlayerCrossHairIcons(false); SetPlayerLampOil(0.0f); //Sound properties PlayMusic("music/intro_bg.ogg", true, 0.5, 2, 0, true); //Timers AddTimer("Intro", 8, "Intro"); //Finally start //Finally Start FadeOut(0); FadeIn(4); StartPlayerLookAt("prodlook", 2.0f, 2.0f, ""); AddTimer("Debug", 1, "Debug"); } void Debug(string &in asTimer) { AddLocalVarInt("aq", 1); AddDebugMessage(" "+ GetLocalVarInt("aq"), false); AddTimer("Debug", 1, "Debug"); } void Intro(string &in asTimer) { AddLocalVarInt("IntroInt", 1); switch( GetLocalVarInt("IntroInt") ) { case 1: FadeOut(2); break; case 4: FadeIn(4); TeleportPlayer("PlayerStartArea_2"); StartPlayerLookAt("titellook", 2.0f, 2.0f, ""); break; case 12: FadeOut(3); break; case 14: FadeIn(4); TeleportPlayer("PlayerStartArea_3"); AddTimer("PushPlayerStart1", 0.01, "PushPlayer1"); StartPlayerLookAt("halllook", 2.0f, 2.0f, ""); break; case 15: SetMessage("Messages", "Popup1", 5); break; case 22: SetMessage("Messages", "Popup2", 5); break; case 29: SetMessage("Messages", "Popup3", 5); break; case 36: SetMessage("Messages", "Popup4", 5); break; case 43: SetMessage("Messages", "Popup5", 5); break; case 50: SetMessage("Messages", "Popup6", 5); break; case 57: SetMessage("Messages", "Popup7", 5); break; case 62: FadeOut(3); break; case 64: SetMessage("Messages", "Popup8", 5); break; case 69: FadeIn(4); TeleportPlayer("PlayerStartArea_4"); SetPlayerActive(true); SetInventoryDisabled(false); SetPlayerCrouchDisabled(false); SetPlayerJumpDisabled(false); ShowPlayerCrossHairIcons(true); StopPlayerLookAt(); StopMusic(3.0f , 0.0f); RemoveTimer("PushPlayerLoop1"); break; } if( GetLocalVarInt("IntroInt") < 126) AddTimer("blackout", 1, "Intro"); } void PushPlayer1(string &in asTimer) { AddPlayerBodyForce(0, 0.0f, 435.1f, true); AddTimer("PushPlayerLoop1", 0.012, "PushPlayer1"); } RE: RemoveTimer Problem! please help :( - Apjjm - 08-10-2012 It is possible it isn't working because the timer is too quick, but there may be a bug in your script i'm not seeing as I've only taken a quick glance. Either way, one solution would just be to not use RemoveTimer, and instead use a variable to mark when to no longer re-add the timer. RE: RemoveTimer Problem! please help :( - bjaffedj - 08-10-2012 (08-10-2012, 01:43 PM)Apjjm Wrote: It is possible it isn't working because the timer is too quick, but there may be a bug in your script i'm not seeing as I've only taken a quick glance. Either way, one solution would just be to not use RemoveTimer, and instead use a variable to mark when to no longer re-add the timer.thanks for reply! ![]() im sorry to ask, since im new to scripting, but which variable is it you recommend i change ![]() RE: RemoveTimer Problem! please help :( - Apjjm - 08-10-2012 I would suggest trying the following: in case 14, before starting the timer, we will need to allow the push loop to work Code: case 14: In case69, where you are using remove timer we will need to tell the pushing to stop: Code: case 69: And the timer method: Code: void PushPlayer1(string &in asTimer) RE: RemoveTimer Problem! please help :( - bjaffedj - 08-10-2012 You Sir... Are Truly AMAZING! it worked like a charm stright ahead, and you also made the scripting nice and easy to understand. you are a very good teacher and thanks man! i been trying to make this work for days and you just make it work in a matter of minutes! i will dedicate my life to you from now on! c: |