Glide Posted June 4, 2024 Posted June 4, 2024 What is the Condition field, specifically, what are we allowed to type in that field?
Kanelbolle Posted June 4, 2024 Posted June 4, 2024 2 hours ago, Glide said: What is the Condition field, specifically, what are we allowed to type in that field? From the DCS manual: CONDITION. The condition for the random spawning of a group in a mission. For this, LUA expressions used in the Simulator Scripting Engine Documentation are entered into the field. First, the initialization script should be loaded in the trigger panel. The script is executed before the mission is loaded and its result is used to set the conditions for the random group spawn. Page 190 DCS user manual (digitalcombatsimulator.com) 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Solution TEMPEST.114 Posted June 4, 2024 Solution Posted June 4, 2024 6 hours ago, Glide said: It's still a mystery how to use it. I'm making an assumption you're not a programmer and don't understand what the manual is saying, if I'm incorrect, I apologise, but this explanation will help others regardless. First you have to understand what a CONDITION is: "Conditionals are expressions that evaluate to either true or false. They are mostly used to determine Program Flow through if statements and while loops." So we have to have an EXPRESSION - which is: "An expression in programming is a combination of literals, variables, operators, and function calls that produce a value when evaluated. It represents a computation and can be as simple as a single variable or as complex as a mathematical equation." Finally you need to understand what a STATEMENT is: "In a computer programming language, a statement is a line of code commanding a task. Every program consists of a sequence of statements." So therefore, you need some LUA STATEMENT in that condition box that uses an CONDITIONAL type of EXPRESSION that will always result in either returning a value of TRUE or FALSE. This is most easily done by calling a function from this dialog box to a function that you have previously written which uses your script's logic, expressions, conditions, state machine and statements to result in either a TRUE or FALSE being the RETURN VALUE of that function. Where this LUA function is contained, is inside the LUA script that the manual and explanation above tells you to load in the Initialisation box in the Triggers Dialog. The % is the likelihood that this group will be spawned. It just a RNG that's created at mission start and if the number is greater than the figure set in this % box then the group will spawn. It will NOT overwrite the decision that is returned from the script as called in the CONDITION box; so even if your CONDITION returns TRUE, if the game's RNG is less than the percentage value set, it STILL won't spawn. I'd suggest having the % as 100 if you're using your own condition. Does that clear up your mystery? ****** ****** ****** Now, here's the usual 'DCS gotcha!' It's broken. You can put a condition in there that will always return true with a percentage of 100% and it still won't spawn. Gotta love the 'DCS consistency'... just when you think you have it sussed out it bites you again eh? 1 1
Glide Posted June 4, 2024 Author Posted June 4, 2024 i got it! Thanks for that excellent explanation. Yes I am a reluctant programmer. If the initialization script has a function called GunsOnly that returns True, then if a Unit has only guns, set % to 100, call GunsOnly in the condition field, and this unit will always spawn. Set % to anything less than 100, and it's a roll of the dice if this unit spawns. If a Unit has missiles, Call GunsOnly in the Condition field, and set % to Zero.
TEMPEST.114 Posted June 4, 2024 Posted June 4, 2024 (edited) 2 hours ago, Glide said: i got it! Thanks for that excellent explanation. Yes I am a reluctant programmer. If the initialization script has a function called GunsOnly that returns True, then if a Unit has only guns, set % to 100, call GunsOnly in the condition field, and this unit will always spawn. Set % to anything less than 100, and it's a roll of the dice if this unit spawns. If a Unit has missiles, Call GunsOnly in the Condition field, and set % to Zero. You're not changing the %, but if you return a FALSE, then regardless of the % spawn likelihood, it won't spawn. The CONDITION and the % are two things, the CONDITION is evaluated first, and should that result in a TRUE, it is THEN that the % is evaluated. So your CONDITION could pass, but the % will still prevent the spawn. And this is just like I did it to test if it's working or broken: Edited June 4, 2024 by TEMPEST.114 1
Recommended Posts