FrankFamily Posted July 31, 2011 Posted July 31, 2011 I have a problem with a timer script, if someone can help me i would really apreciate it. Thanks in advance. Reveal hidden contents scn L04SecuritySequenceControlSCRIPT int Initialized float timer Begin OnAdd set Initialized to 1 set timer to 5 End Begin GameMode if Initialized == 1 if L04SecuritySequence == 1 ;global variable if timer > 3 set timer to timer - GetSecondsPassed endif if timer == 3 L04doorREF.setopenstate 0 L04doorREF.Lock 225 endif if timer == 2 L04SecurityDoor1.setopenstate 0 L04SecurityDoor2.setopenstate 0 L04SecurityDoor3.setopenstate 0 L04SecurityDoor5.setopenstate 0 L04SecurityDoor6.setopenstate 0 L04SecurityDoor7.setopenstate 0 endif if timer == 0 L04SecurityDoor1.Lock 225 L04SecurityDoor2.Lock 225 L04SecurityDoor3.Lock 225 L04SecurityDoor5.Lock 225 L04SecurityDoor6.Lock 225 L04SecurityDoor7.Lock 225 endif elseif L04SecuritySequence == 2 if timer > 3 set timer to timer - GetSecondsPassed endif if timer == 3 L04doorREF.Unlock endif if timer == 2 L04SecurityDoor1.setopenstate 1 L04SecurityDoor2.setopenstate 1 L04SecurityDoor3.setopenstate 1 L04SecurityDoor5.setopenstate 1 L04SecurityDoor6.setopenstate 1 L04SecurityDoor7.setopenstate 1 endif if timer == 0 L04SecurityDoor1.Disable L04SecurityDoor2.Disable L04SecurityDoor3.Disable L04SecurityDoor5.Disable L04SecurityDoor6.Disable L04SecurityDoor7.Disable L04MasterMine.Disable L04AlarmMarker.Disable endif endif player.RemoveItem L04SecuritySequenceControl 1 1 endif End
tunaisafish Posted July 31, 2011 Posted July 31, 2011 As timer is a float, then it will be very rare that it will be a whole integer number when the script runs.So that's probably the problem. Change the '==' operators to '>' or '>=', and use 'elseif' blocks. Something like... if timer > 3 ; more than 3 elseif timer > 2 ; 2 - 3 elseif timer > 1 ; 1 - 2 else ; less than or equal to 1 endif
FrankFamily Posted July 31, 2011 Author Posted July 31, 2011 ok, thank u very much, i'll try these things, kudos to you :thumbsup:
FrankFamily Posted August 1, 2011 Author Posted August 1, 2011 Well i've changed the script, now it's in a quest not in an object: scn L04SecuritySequenceControlSCRIPT float timer Begin GameMode if L04SecuritySequence == 1 || L04SecuritySequence == 2 if L04SecuritySequence == 1 XSecuritySequenceMarkerX.Enable 0 set timer to 5 - GetSecondsPassed if timer < 4 L04doorREF.setopenstate 0 L04doorREF.Lock 225 elseif timer < 3 L04SecurityDoor1.setopenstate 0 L04SecurityDoor2.setopenstate 0 L04SecurityDoor3.setopenstate 0 L04SecurityDoor5.setopenstate 0 L04SecurityDoor6.setopenstate 0 L04SecurityDoor7.setopenstate 0 elseif timer < 2 L04SecurityDoor1.Lock 225 L04SecurityDoor2.Lock 225 L04SecurityDoor3.Lock 225 L04SecurityDoor5.Lock 225 L04SecurityDoor6.Lock 225 L04SecurityDoor7.Lock 225 set L04SecuritySequence to 0 endif elseif L04SecuritySequence == 2 set timer to 4 - GetSecondsPassed if timer < 3 L04doorREF.Unlock elseif timer < 2 L04SecurityDoor1.setopenstate 1 L04SecurityDoor2.setopenstate 1 L04SecurityDoor3.setopenstate 1 L04SecurityDoor5.setopenstate 1 L04SecurityDoor6.setopenstate 1 L04SecurityDoor7.setopenstate 1 elseif timer < 1 XSecuritySequenceMarkerX.Disable set L04SecuritySequence to 0 endif endif endif End If anyone sees a mistake or something that i have to change, please tell me.And finally one more thing what i have to put in "Script Processing Delay"? i've put the default ("0").Thanks in advance.
AlexanderJVelicky Posted August 1, 2011 Posted August 1, 2011 On 8/1/2011 at 2:20 AM, FrankFamily said: Well i've changed the script, now it's in a quest not in an object: Reveal hidden contents scn L04SecuritySequenceControlSCRIPT float timer Begin GameMode if L04SecuritySequence == 1 || L04SecuritySequence == 2 if L04SecuritySequence == 1 XSecuritySequenceMarkerX.Enable 0 set timer to 5 - GetSecondsPassed if timer < 4 L04doorREF.setopenstate 0 L04doorREF.Lock 225 elseif timer < 3 L04SecurityDoor1.setopenstate 0 L04SecurityDoor2.setopenstate 0 L04SecurityDoor3.setopenstate 0 L04SecurityDoor5.setopenstate 0 L04SecurityDoor6.setopenstate 0 L04SecurityDoor7.setopenstate 0 elseif timer < 2 L04SecurityDoor1.Lock 225 L04SecurityDoor2.Lock 225 L04SecurityDoor3.Lock 225 L04SecurityDoor5.Lock 225 L04SecurityDoor6.Lock 225 L04SecurityDoor7.Lock 225 set L04SecuritySequence to 0 endif elseif L04SecuritySequence == 2 set timer to 4 - GetSecondsPassed if timer < 3 L04doorREF.Unlock elseif timer < 2 L04SecurityDoor1.setopenstate 1 L04SecurityDoor2.setopenstate 1 L04SecurityDoor3.setopenstate 1 L04SecurityDoor5.setopenstate 1 L04SecurityDoor6.setopenstate 1 L04SecurityDoor7.setopenstate 1 elseif timer < 1 XSecuritySequenceMarkerX.Disable set L04SecuritySequence to 0 endif endif endif End If anyone sees a mistake or something that i have to change, please tell me.And finally one more thing what i have to put in "Script Processing Delay"? i've put the default ("0").Thanks in advance.First, the default script processing delay is 5 seconds, and is what it is if you check the box. Second, I suggest completely redoing your timer in a 'staged timer' format instead. Check out Cipscis' tutorial on them here: http://www.cipscis.com/fallout/tutorials/staged_timers.aspx If you redo it, I dont think you will have any more issues. :) AJ Velicky
FrankFamily Posted August 1, 2011 Author Posted August 1, 2011 Oh my god, i was looking for a staged timer tutorial but i didn't think in Cipcis :wallbash:... So i made it by myself... LOL. Thank u very much. I'll redo the script, hope it works. Kudos to you. :thumbsup: :thumbsup:
FrankFamily Posted August 1, 2011 Author Posted August 1, 2011 Thank you very much, finally it works :) kudos to you.
Recommended Posts