Jump to content

Timer script problems - Tutorials? Advice?


Recommended Posts

I'm trying to get a script to work so that an item (classed in the CS as furniture, in case that's important) can only be activated and give an effect once per hour and no ore often than that.

 

The tutorials I've found so far refer to quest scripts, which aren't helpful, or once-per-day activations, which also aren't helpful since those rely on game day rather than time passed.

 

Trying to improvise with the instructions from the quest script tutorials isn't getting me anywhere. Can someone point me at a tutorial that does this or lay out for me how it's supposed to work?

Link to comment
Share on other sites

One way you could do this with an object script that compares the date an time with the last time the effect was granted. For example:

 

float FinishTime
short FinishDay

BEGIN ONACTIVATE

if ( Gamehour >= FinishTime ) && ( GameDay >= FinishDay )

set FinishTime to Gamehour + 1

if ( FinishTime >= 24 )
	set FinishTime to FinishTime - 24
	set FinishDay to GameDaysPassed + 1
else
	set FinishDay to GameDaysPassed
endif

Messagebox "Furniture activated!"
;(Do stuff)

else

messagebox "You must wait an hour in between uses."

endif

END

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...