kontiuka Posted August 30, 2013 Posted August 30, 2013 I was playing around with trigger conditions involving trigger zones and the random function. Say, I have trigger conditions of ‘Unit Inside Zone(Player, Trigger Zone A)’ and ‘Random 10%’ and if those two conditions are true, an enemy group appears. It seems that if the player is in the trigger zone long enough, the chances of the enemy group appearing are closer to 100% than 10%. This is because the program is “rolling the dice” every second so eventually the random condition will become true. These are my observations. Let me know if I’m wrong. One way I’ve gotten around this is by placing a slightly smaller trigger zone inside the original trigger zone and using a flag. So, for example: First, I create the trigger zones and flags … - Trigger Zone A is 3000 m in diameter - Trigger Zone B is 2900 m in diameter and is inside Trigger Zone A - Flag 1 is initialized to true at start of mission Then I create the triggers … ------------------------------------------------------- Trigger A conditions: - Unit Inside Zone(Player, Trigger Zone A) and - Random 10% and - Flag 1 is true Trigger A actions: - Activate enemy group ------------------------------------------------------- Trigger B conditions: - Unit Inside Zone(Player, Trigger Zone B) Trigger B actions: - Set Flag 1 to false ------------------------------------------------------- This way, the conditions for an enemy group appearing can only become true at the very edge of trigger zone A and there is more truly a 10% chance of the enemy group appearing. Just thought I’d share this little trick. Kon.
Grimes Posted August 30, 2013 Posted August 30, 2013 This is because the program is “rolling the dice” every second so eventually the random condition will become true. These are my observations. Let me know if I’m wrong. That is an accurate assessment to what its doing. Another way is to randomly pre-determine if the group will spawn anyways. Simply do: Mission Start>Random 10%>Flag 1 On Once>Unit InsideZone A and Flag 1 is True> Spawn Group 1 The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Radar Rider Posted August 30, 2013 Posted August 30, 2013 That's much easy Grimes. Thanks. The option of kontiuka can be used in another differents situations and be usefull too. Thanks you two.
kontiuka Posted August 30, 2013 Author Posted August 30, 2013 (edited) That is an accurate assessment to what its doing. Another way is to randomly pre-determine if the group will spawn anyways. Simply do: Mission Start>Random 10%>Flag 1 On Once>Unit InsideZone A and Flag 1 is True> Spawn GroupThat is a good approach and cleaner. I didn't think of that. Maybe my approach could be used for multiple entries into the trigger zone. Edited August 30, 2013 by kontiuka
kontiuka Posted August 31, 2013 Author Posted August 31, 2013 Cleaned it up a bit ... ------------------------------------------------------- First, I create the trigger zones … - Trigger Zone A is 3000 m in diameter - Trigger Zone B is 2900 m in diameter and is inside Trigger Zone A Then I create the trigger … Trigger conditions: - Unit Inside Zone(Player, Trigger Zone A) and - Random 10% and - Unit Outside Zone(Player, Trigger Zone B) Trigger actions: - Activate enemy group ------------------------------------------------------- As I said, maybe this approach could be used for multiple entries into the trigger zone where you want to do a random test every time you enter the zone. 1
Recommended Posts