dedmax Posted December 1, 2008 Share Posted December 1, 2008 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. Link to comment Share on other sites More sharing options...
QQuix Posted December 1, 2008 Share Posted December 1, 2008 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 codeFloat xTimer Begin onactivate Set xTimer to 3 End Begin gamemode Set xTimer to xTimer - GetSecondsPasssed If xTimer <= 0 [delayed code here] Endif EndYou 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. Link to comment Share on other sites More sharing options...
dedmax Posted December 1, 2008 Author Share Posted December 1, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.