Jump to content

Recommended Posts

Posted

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.

Posted
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

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted (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 Group

That 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 by kontiuka
Posted

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.

  • Like 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...