Jump to content

Conditioning : Time Passed Since Last Object Placed


ajs52698

Recommended Posts

Im having a hard time finding a way to condition a certain object to be placed only if a certain amount of time has passed since a another action before happened.

 

Im aware of timers and this | but could use some help.

V

 

https://forums.nexusmods.com/index.php?/topic/4779470-how-to-get-game-days-passed-with-activator/ Im unable to use isharas suggesting as I need it to be condition for when a object is placed, to start a timer.

 

Really what I need is a condition such as hastimerexpired, that would solve all my problems :(

Edited by ajs52698
Link to comment
Share on other sites

If you are placing the object in script you can start a timer when you've placed the item and have it change a global variable withc you can then use as a condition with GetGlobalvalue. For example:

GlobalVariable Property HasTimerExpired Auto ;Add this to the start of your script

;Code that places the object
StartTimer(Amount of time in seconds,TimerID) ;The TimerID is an int you use when it expires
then later in the script you put this

Event OnTimer(int aiTimerID)
    If aiTimerID == TimerID
         HasTimerExpired.SetValue(1) ;Change the HasTimerExpierd for the name of your golobalvariable and make sure to add an unique prefix to it so it won't conflict with other mods
    EndIf
EndEvent
You can use the condition GetGlobalvalue = 1 to detect if the timer has expired, But if you don't reset it to 0 after youve used this it will only work once. If you want to use this as a condition in script you can use If(HasTimerExpiered.GetValue() == 1)

If your not placing the item in script you'll have to find a way of detecting when the items gets placed.

Edited by LoneRaptor
Link to comment
Share on other sites

Would there be way to set a seperate timer for each object?

 

Say I was getting a object from a array and for each one have a timer rather than having 1 timer updated each time a object is spawned.

 

The way I was thinking of doing this is with the random int, so say for each object StartTimer(24,RandomInt(0,25), but im not sure if thats practical

Edited by ajs52698
Link to comment
Share on other sites

You coud use the index of the location in your array as the timerID but you would need to know the index for each item in your array. Then in the on timer change the If accordingly.

 

Edit: you would also need a global for each item.

Edited by LoneRaptor
Link to comment
Share on other sites

  • Recently Browsing   0 members

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