moggel Posted November 12, 2021 Share Posted November 12, 2021 (edited) Admittedly, I haven't been doing a lot of ME for some time and stuff might have changed but I must've missed something very basic here. I'm just creating a pretty vanilla miz, for personal training purposes, where I want various units to randomly (~30%) activate when I fly into a nearby zone. The puropse of the mission is to practice finding and attacking units within a certain assigned area so I don't want all of them spawned in, and I also don't want them to activate immediately at mission start. This is what I did: 1. Added trigger zone (let's call it "Zone-1") 2. Added five different units at five different locations, set them all to "LATE ACTIVATION" and added their waypoints, options etc. 3. Created trigger for "UNIT INSIDE ZONE" for "Zone-1" and specified the unit I intend to fly (set to "client"). The trigger simply sets "FLAG 2" to "1" 4. Created five more triggers, all with the exact same conditions (see list below), and made each trigger GROUP ACTIVATE each of the five aggressor units. Here's the conditions I used for these triggers: - FLAG 2 IS TRUE - RANDOM (30%) I assumed this would spawn one or two of the units (sometimes more, occasionally none) as I fly into "Zone-1". But what happens when I start the miz is that all of the units spawn and start moving. What am I missing? Edited November 12, 2021 by moggel i7-3930K CPU @ 3.20GHz; 16Gb DDR3; GeForce GTX 1070; Windows 10; TM Warthog HOTAS Link to comment Share on other sites More sharing options...
cfrag Posted November 12, 2021 Share Posted November 12, 2021 (edited) If you are anything like me, you probably mis-read how the random trigger works. Hint: it'll re-try every second until it succeeds. In your case, that'll be some three seconds on average (30% chance per second) until it is executed. We can definitely give you better hints if you include the miz -ch Edited November 12, 2021 by cfrag Link to comment Share on other sites More sharing options...
Sedlo Posted November 12, 2021 Share Posted November 12, 2021 I like to do it something like this: TRIGGER CONDITION ACTION Mission Start Set Flag Random Value (flag 5050, between 1-4) Activate Group 1 Flag 5050 = 1 Unit Inside Zone Group Activate Group 1 Activate Group 2 Flag 5050 = 2 Unit Inside Zone Group Activate Group 2 Activate Group 3 Flag 5050 = 3 Unit Inside Zone Group Activate Group 3 Activate Group 4 Flag 5050 = 4 Unit Inside Zone Group Activate Group 4 My Youtube Channel MY DCS MISSIONS Link to comment Share on other sites More sharing options...
moggel Posted November 13, 2021 Author Share Posted November 13, 2021 19 hours ago, cfrag said: If you are anything like me, you probably mis-read how the random trigger works. Hint: it'll re-try every second until it succeeds. In your case, that'll be some three seconds on average (30% chance per second) until it is executed. We can definitely give you better hints if you include the miz -ch Turns out it was just a silly mistake on my part. For some reason I had duplicated the actions to a completely irrelevant trigger that wasn’t randomized. The units doesn’t activate on miz start anymore but I have been wondering why all the units seemed to activate every time I tested the mission and you just explained why. This makes it impossible to actually activate units randomly, at least without having to resort to lua, right? i7-3930K CPU @ 3.20GHz; 16Gb DDR3; GeForce GTX 1070; Windows 10; TM Warthog HOTAS Link to comment Share on other sites More sharing options...
nomdeplume Posted November 15, 2021 Share Posted November 15, 2021 Not impossible, but requires the use of extra triggers and flags to guard the 'not-selected' activation. Also it depends exactly what your goal is - to only activate one of the groups ever, or if you want to activate them all but one at a time in a random order, etc. Sedlo's method is good for "just one of these groups" - the key here is setting a flag to a random value to select the group, but only doing it once. Then the additional triggers are never executed because the flag can't be set to the value they're looking for. I do prefer to use lua though as this method is inefficient - if you want to select 1 of 4 groups, then three of the triggers will never do anything but will be considered every second regardless. I usually use random groups to give me different layouts of the 'same' threat (e.g. an area is guarded by 2 AAA, so make 5 groups of 2 AAA at different locations around the area and select one of them at random to actually use). If you have a lot of these then it's a heap of triggers continuously being evaluated without any chance of executing. In your case, you could just change your "unit in zone -> set flag 2" trigger to "unit in zone -> set flag 2 to random value (1,4)" and then for each of your groups, modify the condition to be "flag equals value" instead of just "flag is true". The 'RANDOM' trigger is mostly useful for ON MISSION START triggers, since if it returns false then the trigger's actions won't be run. For other trigger types it's more of a random delay function, e.g. a ONCE trigger with a RANDOM 1% condition is almost certain to eventually trigger, and very likely within 100 seconds of its other conditions being satisfied. Even a trigger with 10x RANDOM 1% chance conditions will eventually execute, if the mission runs long enough. Link to comment Share on other sites More sharing options...
Recommended Posts