Jump to content

[LE] Constant check with an event that runs only once when the conditions are met?


Recommended Posts

As the title states, how could one implement an effect for which the conditions are constantly checked, but once they are met it only runs once until the conditions were not met and then met again?

 

In plain english, I want to create a timed effect that is applied only once when the player is underwater (I detect this through a global value). When the duration of the effect has worn out nothing happens until the player exits and then re-enters the water, at which point the effect plays once again.

 

So is there a scriptfree way of doing this or alternatively a script that doesn't impact performance too much?

Link to comment
Share on other sites

I figured out how to do this, and since no one seemed to know, here is how:

 

1. Create a script effect that only starts when the condition is met and when a global value is 0, this script sets that global value to 1
2. However first (it is very important this comes first, else this will not work), the script adds a different effect, the effect you want to apply only once each time the conditions are met.
3. Create an inverse copy of the first script effect which only triggers if the condition is not met and the global value is 1, this script sets that global value to 0

 

To put it simply, create a loop that breaks itself and can only repeat when the conditions are not met anymore.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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