periodic events really behave with low performance, a while loop is way more effient. the conditions for the while loop are ther ones that would have turned off your former periodic trigger and you call the loop action when turninig your former trigger on. it's not a replacement for the content of the trigger (which might contain conditions that are allowed to fail)
So basically if I didn't want any conditions I could just use Repeat Forever instead of While and it would still be more efficient then periodic effect? The idea is just that loops in general are more efficient?
Quote:
Do ONE trigger with MapInit, then call actions in this trigger which must be executed on map start, add a wait and call the actions that must be called later. if you ever leave the map and come back half a year later, you wont have to check/find all triggers with mapInit event to see whats going on on mapstar
Yea, I was just trying to figure out if this was an organization thing or it had some impact on performance or something to have more than one mapInit.
Quote:
the other trick is to use instead of any unit a unit variable and set it during the game. this allows dynamic event units too and doesnt require custom script.
Oh, I thought you couldn't use variables in events for some reason. Or is that only specific kinds of events?
So, I'm a very sloppy triggerer and I'm looking to cleanup triggers on some of my maps. I have some questions - I'm sure they all sound dumb, not great at triggers.
First, is there any good tutorial for creating your own actions/functions/etc? I have no experience with these and am not exactly sure how to use them or what they are best used for.
Quote:
If there is no event, dont use a trigger, use an action...
What is the reason behind this? Are triggers somehow inherently less efficient than making your own action? Or is it just better organization?
Quote:
In general events should be used as less as possible to maintain clear code and good performance.
I don't get this - aren't events necessary to make your trigger run? How do you eliminate them? What are some common examples of excessive/redundant event usage?
Quote:
One thing i see again and again is the use of the MapInit event more than once. There should be only ONE entry point to your map.
Why is this? The only reason I ever do it is if I need something with a wait in it to run at the start of the map (so I want other things to be not waiting on the wait) but I'm not sure why its better to have it under a time elapsed 0.001 rather than multiple MapInit. Maybe its because I don't really get what MapInit is doing, I always just think of it as the same thing as time elapsed 0.001 except without that tiny bit of delay.
Quote:
Avoid the use of periodic events, they cost too much performance, instead call an custom action (instead of turning your former trigger on) :
I REALLY don't understand this one. Why do periodic events cause more lag than doing it this way? Plus I don't get how your workarounds work; the While loop will stop at one failure to meet conditions but for many periodic event triggers you want them to continue to keep going even if they do fail a condition check once.
Quote:
Instead of ANY X (i.e. any unit being killed) you should use dynamic Event adding with one specific unit; anyway there is another "trick": use a variable in the event, but be carefully with i.e "no unit"
Lost me again, not sure how to do Dynamic Events (Do you mean using custom script to add events?) but also I'm not sure what you mean by the other "trick" you can use. Also, I'm presuming this is only applicable if you are using "any x" when you actually want it to be a specific unit, just one not on the map yet. Because I don't see how its any better to add hundreds of events to one trigger dynamically, especially when you said to avoid using events earlier.
Quote:
Take care what conditions you are using. There are several which costs alot of performance (pathing costs between 2 points, etc).
Wondering if you could be more specific and say what other conditions cost a lot of performance besides pathing costs between 2 points?
So basically if I didn't want any conditions I could just use Repeat Forever instead of While and it would still be more efficient then periodic effect? The idea is just that loops in general are more efficient?
Yea, I was just trying to figure out if this was an organization thing or it had some impact on performance or something to have more than one mapInit.
Oh, I thought you couldn't use variables in events for some reason. Or is that only specific kinds of events?
So, I'm a very sloppy triggerer and I'm looking to cleanup triggers on some of my maps. I have some questions - I'm sure they all sound dumb, not great at triggers.
First, is there any good tutorial for creating your own actions/functions/etc? I have no experience with these and am not exactly sure how to use them or what they are best used for.
What is the reason behind this? Are triggers somehow inherently less efficient than making your own action? Or is it just better organization?
I don't get this - aren't events necessary to make your trigger run? How do you eliminate them? What are some common examples of excessive/redundant event usage?
Why is this? The only reason I ever do it is if I need something with a wait in it to run at the start of the map (so I want other things to be not waiting on the wait) but I'm not sure why its better to have it under a time elapsed 0.001 rather than multiple MapInit. Maybe its because I don't really get what MapInit is doing, I always just think of it as the same thing as time elapsed 0.001 except without that tiny bit of delay.
I REALLY don't understand this one. Why do periodic events cause more lag than doing it this way? Plus I don't get how your workarounds work; the While loop will stop at one failure to meet conditions but for many periodic event triggers you want them to continue to keep going even if they do fail a condition check once.
Lost me again, not sure how to do Dynamic Events (Do you mean using custom script to add events?) but also I'm not sure what you mean by the other "trick" you can use. Also, I'm presuming this is only applicable if you are using "any x" when you actually want it to be a specific unit, just one not on the map yet. Because I don't see how its any better to add hundreds of events to one trigger dynamically, especially when you said to avoid using events earlier.
Wondering if you could be more specific and say what other conditions cost a lot of performance besides pathing costs between 2 points?
Thanks!