Psychotogen Posted July 27, 2013 Share Posted July 27, 2013 Is there a way I can create a timer that runs for 45 seconds? Is it something like this? int counter = 0 While ( counter < 45) counterMessage.Show() If counter == 45 Game.Getplayer().Addspell (spell) end if counter += 1 EndWhile So I guess thats the basic structure maybe, but how do I make it so it counts real time seconds? Link to comment Share on other sites More sharing options...
BrotherBob Posted July 27, 2013 Share Posted July 27, 2013 So do you just want a spell to be added to the player after 45 seconds? If so, you could use an OnUpdate Event and the RegisterForSingleUpdate() function. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 27, 2013 Share Posted July 27, 2013 You can either use the OnUpdate event and register for a single update as BrotherBob stated or you can use the Wait function and simply wait 45 seconds. But waiting 45 seconds like that ties up a script thread that could be better spent on something else. Best option is the OnUpdate event. Link to comment Share on other sites More sharing options...
Psychotogen Posted July 27, 2013 Author Share Posted July 27, 2013 Well the add spell is there just for something to be in in the loop, I need to figure how to make the loop count seconds. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 27, 2013 Share Posted July 27, 2013 Can you explain exactly what you are trying to accomplish with this loop? Perhaps seeing the rest of the script and knowing exactly what you want to do will help to ensure that you are offered information that will work. Link to comment Share on other sites More sharing options...
Recommended Posts