Author Topic: help with a delay script  (Read 328 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
help with a delay script
« on: May 30, 2015, 10:31:24 pm »


               

I was hoping I could get some help with this, What I would like to do is delay the time between an item can be used. As an example I have an on item activate script that adds a couple of effects to the PC then after they use the item they would have to wait a few minutes before they could use it again.  I know this can be done with variables but I have no idea how to do it.


 


Another way of doing it would be to store the time and then check whether it's been a set amount of time since the last time the item was used. But again not sure how to do that.


 


Any help with this would be appreciated.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
help with a delay script
« Reply #1 on: May 30, 2015, 10:58:30 pm »


               DelayCommand(60.0, ExecuteScript... would run a script after 1 minute to reactivate the item.


Or run every 10 seconds using SendMessageToPC to give feedback on cooldown, e.g. "50 seconds until you can use this again".


Set/GetLocalInt on the item to flag it as unusable, block use in the activate script, and reactivate.


There are other methods, but that will do it.
               
               

               
            

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
help with a delay script
« Reply #2 on: May 31, 2015, 12:00:19 am »


               

I figured it out thanks for your help.