Help Needed! AddTimer Sequence problem - 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: Help Needed! AddTimer Sequence problem (/thread-17712.html) |
Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 i have made a timer for a sequence to my custom story. it's the second sequence timer in the map, but this one does not want to go past case 1. can someone please help me to fix this error/bug or mismade script? it would be a great help! the timer is activate by a script area, and as i said it works, but just not past case 1. it is the "WakeUp1" script that does not work the full Script: 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"); AddEntityCollideCallback("Player", "WakeUp_1", "WakeUp", true, 1); //Finally start //Finally Start FadeOut(0); FadeIn(4); StartPlayerLookAt("prodlook", 2.0f, 2.0f, ""); AddTimer("Debug", 1, "Debug"); //door unlocks SetEntityConnectionStateChangeCallback("lever", "unlockdoor"); AddUseItemCallback("", "key", "door_key", "KeyDoor", true); //monster functions SetEntityCallbackFunc("key", "OnPickup"); } 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"); SetLocalVarInt("AllowPlayerPushMove",1); //Say we are allowing the player to be pushed AddTimer("PushPlayerStart1", 0.01, "PushPlayer1"); //Timer as normal here 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); //Say we are no longer allowing the push timer //instead of Removing the timer SetLocalVarInt("AllowPlayerPushMove",0); break; } if( GetLocalVarInt("IntroInt") < 126) AddTimer("blackout", 1, "Intro"); } void PushPlayer1(string &in asTimer) { AddPlayerBodyForce(0, 0.0f, 435.1f, true); //Only renew the push loop whilst we are allowing the player to be pushed. if(GetLocalVarInt("AllowPlayerPushMove")==1) AddTimer("PushPlayerLoop1", 0.012, "PushPlayer1"); } void unlockdoor(string &in asEntity, int alState) { if(GetLeverState("lever")==1) { SetSwingDoorLocked("door_lever", false, true); PlaySoundAtEntity("", "unlock_door", "door_lever", 0, false); } } void KeyDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door_key", false, true); PlaySoundAtEntity("", "unlock_door", "door_key", 0, false); RemoveItem("key"); } void OnPickup(string &in asItem, string &in asEntity) { SetEntityActive("servant_grunt_1", true); AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1", 0, ""); AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_2", 0, ""); CheckPoint("", "PlayerStartArea_4", "", "DeathHints", "Death1"); } void WakeUp(string &in asParent, string &in asChild, int alState) { AddTimer("WakeUp1", 0.5, "WakeUp1"); } void WakeUp1(string &in asTimer) { AddLocalVarInt("WakeUpInt", 1); switch(GetLocalVarInt("WakeUpInt") ) { case 1: FadeOut(2); SetEntityActive("servant_grunt_1", false); break; case 3: PlayMusic("music/WakeUp.ogg", false, 1, 0.1, 1, true); break; case 5: FadeIn(0.3); FadeImageTrailTo(2, 2); FadeSepiaColorTo(100, 4); TeleportPlayer("PlayerStartArea_5"); SetPlayerActive(false); FadePlayerRollTo(50, 220, 220); // "Tilts" the players head FadeRadialBlurTo(0.15, 2); SetPlayerCrouching(true); // Simulates being on the ground SetInventoryDisabled(true); break; case 23: ChangePlayerStateToNormal(); SetPlayerActive(true); FadePlayerRollTo(0, 33, 33); // Change all settings to defaults FadeRadialBlurTo(0.0, 1); FadeSepiaColorTo(0, 4); SetPlayerCrouching(false); FadeImageTrailTo(0,1); break; } if(GetLocalVarInt("WakeUpInt") < 126) AddTimer("blackout", 1, "WakeUp"); } RE: Help Needed! AddTimer Sequence problem - Traggey - 08-12-2012 Right, don't make two posts for your issue, and please atleast post them in the right section of the forums. RE: Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 (08-12-2012, 05:01 PM)Traggey Wrote: Right, don't make two posts for your issue, and please atleast post them in the right section of the forums.it was never my point to make 2 posts and i am sorry for that. and i actually thought i was posting in the right section. if its not the right section then where should i post it? RE: Help Needed! AddTimer Sequence problem - Traggey - 08-12-2012 (08-12-2012, 05:04 PM)bjaffedj Wrote:I've moved it to the right section.(08-12-2012, 05:01 PM)Traggey Wrote: Right, don't make two posts for your issue, and please atleast post them in the right section of the forums.it was never my point to make 2 posts and i am sorry for that. and i actually thought i was posting in the right section. if its not the right section then where should i post it? RE: Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 thank you sir. and from now on i'll keep in might which section to post RE: Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 really? no one? RE: Help Needed! AddTimer Sequence problem - Your Computer - 08-12-2012 Why don't you just check against the timer name with if(-else) statements instead of incrementing a local map variable with a switch statement? RE: Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 but will i be able to set a kind of timer through that? RE: Help Needed! AddTimer Sequence problem - Theforgot3n1 - 08-12-2012 Does the other switch(intro) work without problems? By the way, your way of delaying the next case is really not as good as it can be. Look at rainy halls for example! Code: void TimerBlackOut(string &in asTimer) RE: Help Needed! AddTimer Sequence problem - bjaffedj - 08-12-2012 (08-12-2012, 07:27 PM)Theforgot3n1 Wrote: Does the other switch(intro) work without problems? yes my other "switch" script works. after the intro switch there is a gameplay sequence and then i wanted to get a new sequence going, but it do'nt want to work this time :/ (08-12-2012, 07:27 PM)Theforgot3n1 Wrote: By the way, your way of delaying the next case is really not as good as it can be. Look at rainy halls for example! I actually wan't to thank you a lot! your advise really helped me and i got it to work! |