RowanSkie Posted July 28, 2019 Share Posted July 28, 2019 How do I do what I said in the title? I want that when you activate on something, you get something and get locked out until 1 full day arrives. Link to comment Share on other sites More sharing options...
hereami Posted July 28, 2019 Share Posted July 28, 2019 (edited) Can use GameDaysPassed global var to determine, if a full day has passed since last Player's activation. To avoid unneccessary persistence should use a dedicated Global for storing last access time. Like that (draft):OnActivate If ((gNextAccess.GetValue() < GameDaysPassed.GetValue()) && (akActionRef == Game.GetPlayer())) gNextAccess = GameDaysPassed.GetValue() + 1.0 ; do my thing Else ; show message ? EndifEnd event Or can use StartTimerGameTime(), if want an extra timer in game and a persistent object, depends on exact goals though - e.g. if want the activator to be disabled/enabled. Edited July 28, 2019 by hereami Link to comment Share on other sites More sharing options...
RowanSkie Posted July 28, 2019 Author Share Posted July 28, 2019 On 7/28/2019 at 2:45 PM, hereami said: Can use GameDaysPassed global var to determine, if a full day has passed since last Player's activation. To avoid unneccessary persistence should use a dedicated Global for storing last access time. Like that (draft):OnActivate   If ((gNextAccess.GetValue() < GameDaysPassed.GetValue()) && (akActionRef == Game.GetPlayer()))      gNextAccess = GameDaysPassed.GetValue() + 1.0        ; do my thing   Else        ; show message ?   EndifEnd event Or can use StartTimerGameTime(), if want an extra timer in game and a persistent object, depends on exact goals though - e.g. if want the activator to be disabled/enabled.The thing is I'm going to edit a script from a mod that's no longer public, and it has a faulty script. It uses StartTimerGameTime() but the else statement seems to make it loop. Essentially the script goes by:1. Set used variable to 02. If used, set variable to 1 and set timer to 24 hours, else set timer to 24 hours.3. Set used variable to 0 I want to fix that. Link to comment Share on other sites More sharing options...
hereami Posted July 29, 2019 Share Posted July 29, 2019 (edited) Is the variable used from outside for sync? Hm, sequence looks weird. Post the script as is, use Code statement for readability. Somebody might say something then. idk, could be like this then:Event OnActivate If (AccessLocked == False)&&(akActionRef == Game.GetPlayer()) self.BlockActivation(True, True) ; optional AccessLocked = True; ; do my thing StartTimerGameTime(24.0) Endif End Event Event OnTimerGameTime AccessLocked = False; self.BlockActivation(False) ; optional End Event Edited July 29, 2019 by hereami Link to comment Share on other sites More sharing options...
RowanSkie Posted July 29, 2019 Author Share Posted July 29, 2019 (edited) On 7/29/2019 at 10:29 AM, hereami said: Is the variable used from outside for sync? Hm, sequence looks weird. Post the script as is, use Code statement for readability. Somebody might say something then. idk, could be like this then:Event OnActivate If (AccessLocked == False)&&(akActionRef == Game.GetPlayer()) self.BlockActivation(True, True) ; optional AccessLocked = True; ; do my thing StartTimerGameTime(24.0) Endif End Event Event OnTimerGameTime AccessLocked = False; self.BlockActivation(False) ; optional End EventOkay, I'll try that. I'm modifying a version of reptileye's mod, which is why I can't show the code because he might come at me mad. Trying to contact with him right now. Hope it sticks when I get home to do your suggested code (after I replace the AccessLocked into the mod's variable). Reveal hidden contents GlobalVariable Property rep_BoSration1 Auto Event OnInit() Self.StartTimerGameTime(24, 1) EndEvent Event OnTimerGameTime(int aiTimerID) If (rep_BoSration1.GetValue() == 0 as float) rep_BoSration1.SetValue(1 as float) Self.StartTimerGameTime(24, 1) Else Self.StartTimerGameTime(24, 1) EndIf EndEvent Edited July 29, 2019 by RowanSkie Link to comment Share on other sites More sharing options...
hereami Posted July 29, 2019 Share Posted July 29, 2019 (edited) Well, you need to track the usage of rep_BoSration1 variable then. What i suggested is for a case of a single independent activator (exactly what you asked in first post). What is wrong with mod actually? This part of code is ok, but redundant, it may equal to OnTimer -> SetValue(1.0) -> StartTimer - BUT here assuming BoSration1 is a boolean-like (restoring access on timer no matter what). If not - track the variable usage and logic flow. Edited July 29, 2019 by hereami Link to comment Share on other sites More sharing options...
Recommended Posts