Help - Search - Members - Calendar
Full Version: Scriptng Question How to set a timer
The Nexus Forums > Specific Games > Oblivion > Oblivion Modifications > General Mod Talk
dedmax
I made a spell that when hits the target remote activates a chest i have placed in my cell at which time i place objects into the chest.
The script then calls for the chest to removeallitems to the target.
The chest opens fine and i place items inside it but i have to hit the target again to have the objects remove to target.i would like to set a time delay on the remove call to allow the objects i placed into the chest to become true(assuming thats the problem).Ive consulted the wiki which is why im now having to ask this community for enlightenment.Several of my spell ideas are on hold untill i can understand timers so any input on the basics of timers would be appreciated.
QQuix
Does not seem to be a timing issue. But anyway . . .

The most common timer is a count-down timer that uses the GetSecondsPasssed function:
1- Some event sets the timer to its initial value, say, 3 (meaning 3 real time seconds)
2- Every frame, a gamemode block subtracts GetSecondsPasssed from the timer
3- When the timer gets negative, the elapsed time has passed and you do your stuff

Simple sample code
CODE
Float xTimer
Begin onactivate
    Set xTimer to 3
End
Begin gamemode
    Set xTimer to xTimer - GetSecondsPasssed
    If xTimer <= 0
        [delayed code here]
    Endif
End

You may also set a count-up timer if you need to run code at several different moments after an original event.
And, I suppose, there must be many other less common variations.
dedmax
Thanx QQuix This should be very helpful to me.

If i put something into the chest prior to using the spell

then activate the spell and add an item at that time only the first item will transfer .
I will try the code you provinded thanx again

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.