Jump to content

Need scripting help.


FrankFamily

Recommended Posts

I have a problem with a timer script, if someone can help me i would really apreciate it. Thanks in advance.

 

 

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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:
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...