tattooofhername Posted June 13, 2012 Share Posted June 13, 2012 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 More sharing options...
Lanceor Posted June 14, 2012 Share Posted June 14, 2012 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 More sharing options...
tattooofhername Posted June 14, 2012 Author Share Posted June 14, 2012 Oh that's perfect! Ok, I've not tested it yet, but it reads exactly right. I hadn't thought to actually use the gameday function to help determine the hour difference, but now I see it, it makes so much sense. Link to comment Share on other sites More sharing options...
Recommended Posts