virginharvester Posted May 6, 2018 Share Posted May 6, 2018 hi, sorry for my bad english,i like make some script,if you cast it it will give you one gold every minutes,any clue to make it? ,i searching google for 30 minutes and found nothing,please help, Link to comment Share on other sites More sharing options...
Evangela Posted May 6, 2018 Share Posted May 6, 2018 (edited) Uhh... I can give you a quick example. MiscObject property Gold001 auto Bool property bKeepUpdating = TRUE auto { Set to false when ready to stop polling. } Actor Player Event OnInit() Player = Game.GetPlayer() ; 30min RegisterForSingleUpdate(1800.0) EndEvent Event OnUpdate() Player.AddItem(Gold001, 1) if bKeepUpdating == TRUE RegisterForSingleUpdate(1800.0) endif EndEvent UpdateGameTime is probably better, but I don't feel like calculating time differences for things like fast traveling, sleeping, waiting, etc. Edited May 6, 2018 by Rasikko Link to comment Share on other sites More sharing options...
virginharvester Posted May 6, 2018 Author Share Posted May 6, 2018 (edited) thanks, i will try it right away, based your script the player will get a gold coin every 30 minutes,but how to stop it?something like : give player 1 gold coin every 10 second for 1 minutes Edited May 6, 2018 by virginharvester Link to comment Share on other sites More sharing options...
foamyesque Posted May 7, 2018 Share Posted May 7, 2018 thanks, i will try it right away, based your script the player will get a gold coin every 30 minutes,but how to stop it?something like : give player 1 gold coin every 10 second for 1 minutes You'd add a counter and an if statement: MiscObject property Gold001 auto int Property iMaxAdd = 0 auto Bool property bKeepUpdating = TRUE auto { Set to false when ready to stop polling. } int iAddedCount = 0 Actor Player Event OnInit() Player = Game.GetPlayer() ; 30min RegisterForSingleUpdate(1800.0) EndEvent Event OnUpdate() if iAddedCount < iMaxAdd && bKeepUpdating iAddedCount += 1 Player.AddItem(Gold001, 1) RegisterForSingleUpdate(1800.0) else bKeepUpdating = false endif EndEvent You'd then set the max count via property to be whatever you like. I defaulted it to zero so it fails safe and doesn't execute if you forget to set it. Link to comment Share on other sites More sharing options...
virginharvester Posted May 7, 2018 Author Share Posted May 7, 2018 ahhh, turn out the RegisterForSingleUpdate() is single use, not loop thing,thanks, i have sent a kudo to both of you Link to comment Share on other sites More sharing options...
Recommended Posts