ENO Posted April 18, 2013 Posted April 18, 2013 (edited) Eh guys. So I've been trying to implement some random triggers and had a quick question about how it is that they're read by the logic. I had one set for when a certain group is "alive less than 10%" a flag (500) would be set to a random value between 1-100. I then had it set that if it came in below 40 (whoops- just as I typed this I think I figured it out), a certain thing would happen... if it came in over 60 then another thing would happen and if it came in the middle then both things would happen. Every time I started the mission- the "below 40" message would come up right at mission start. Now I realize that because my trigger condition was "flag 500 value below 40"- yeah, you guessed it... when the flag is not true technically the value would be 0... which is less than 40 which I guess is why that message kept being sent. 0 wasn't even an allocated value- I'd set it between 1-40 just for that reason... but I guess the logic doesn't see it that way. 0 is indeed less than 40. I'd have had to add a "more than 0" flag there as well. Is "more than 0" going to start at 1... or is it a "greater than or equal to" type of situation? I've since added an additional condition- but I'm wondering do you have to set the flag you're going to add value to to "true" first? Can you make it the same flag, or do you need to set an additional flag to true in order to not cause this from happening again. Edited April 18, 2013 by ENO "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
mjeh Posted April 18, 2013 Posted April 18, 2013 (edited) As you've discovered, if you're going to have triggers that act based on the value of the flag then it's good practice to initialize the flag to a safe value first. Do you have to? No, not strictly, but your mission may display unpredictable (and in most cases, unwanted) behaviour if you don't. Adding a "time more" condition (eg time more than 30 seconds) to said trigger is one way to ensure you have time to initialize the flag value properly before it is read and used. Edited April 18, 2013 by mjeh
ENO Posted April 18, 2013 Author Posted April 18, 2013 I'd noticed that with the MIST functions as well. I've got to start getting into that habit of adding that. Any idea if the (more than) is actually MORE THAN or is it that number and above ie: equal or greater than? So If I need a flag to be more than 0... will it still read 0 or will it start at 1? It's not a huge deal but I am curious. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
mjeh Posted April 18, 2013 Posted April 18, 2013 "Flag is more" is definitely a "greater than-operator", rather than an "equal or greather than-operator", I assume it's conversely the same for "Flag is less" edit: to be perfectly clear, a "Flag is more than 1" condition will not be true if the flag's value is 1. It will only be true once the flag value is 2 or greater. 1
ENO Posted April 18, 2013 Author Posted April 18, 2013 Thanks for the clarification! "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
mjeh Posted April 18, 2013 Posted April 18, 2013 Happy to be of use, I learned something in the process myself too :thumbup:
Recommended Posts