Jump to content

Recommended Posts

Posted

I've been working on a mission for over a week now, sunk loads of hours into it and still can't get it to do what I want.

 

What I want the mission to do is:

1. At game start (players in zone etc) randomly activate one of twelve missions (i.e. a convoy)

2. After a random period of time (say 15-30 minutes) activate another random as yet un-activated mission

3. Have up to, but no more than three missions running at once

4. Randomly decide how many missions will run in total (e.g. minimum of 6 maximum of 12)

 

It seems the trouble I am having is creating a loop that will select un-activated groups/missions in a random order after the first.

 

Any advice would be much appreciated. An excel template would be even better!:drunk:

[sIGPIC][/sIGPIC]

"Great minds think alike; idiots seldom differ.":pilotfly:

i5 3750K@4.3Ghz, MSI Z77A GD55, 8GB DDR3, Palit GTX 670, 24" Benq@1920*1080, X52 Pro, Win 7 64bit.

Posted (edited)
I've been working on a mission for over a week now, sunk loads of hours into it and still can't get it to do what I want.

 

What I want the mission to do is:

1. At game start (players in zone etc) randomly activate one of twelve missions (i.e. a convoy)

2. After a random period of time (say 15-30 minutes) activate another random as yet un-activated mission

3. Have up to, but no more than three missions running at once

4. Randomly decide how many missions will run in total (e.g. minimum of 6 maximum of 12)

 

It seems the trouble I am having is creating a loop that will select un-activated groups/missions in a random order after the first.

 

Any advice would be much appreciated. An excel template would be even better!:drunk:

 

Does it have to be with the trigger system and not with lua scripts? I think I could write a lua script that did what you want (lua scripts are run with a group's "Run Script" triggered action, and called with the AI ACTION trigger action). The mission editor's random trigger conditions are pretty inflexible and hard to work with... lua is superior in that regard. That said, I think Grimes was able to get a solution to a problem similar to yours using nothing but triggers, but it wasn't easy... I think he repeatedly evaluated multiple low probability (like 1%) conditions, and when one of them evaluated true that hadn't evaluated true yet, stopped evaluating the triggers and selected the "mission" that had rolled true.

Edited by Speed
  • Like 1

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Posted

Bits of what you want to do are fairly straight forward. Basically you need to combine several concepts into one giant logic loop. Also you need to use a single trigger to decide whether to choose a mission.

 

What I want the mission to do is:

1. At game start (players in zone etc) randomly activate one of twelve missions (i.e. a convoy)

 

"Timer Start" Once> Time more than 1> Set flag 30, Set flag 32

 

To choose a mission

Switched Condition > Flag 30 is True && Flag 20 is less than 3 && Flag Z is greater than 0> Set flag 31, Flag 30 off, Flag 20 increase 1

 

For each mission

 

Once> Flag 31 is true && Random 20%> Flag 31 Off, Set Flag 1 (to ID the mission), activate units or whatever

Once> Flag 31 is true && Random 20%> Flag 31 Off, Set Flag 2 (to ID the mission), activate units or whatever

.. For each mission

 

2. After a random period of time (say 15-30 minutes) activate another random as yet un-activated mission

 

Time since flag 32 is 15 minutes && Random 5% && Random 5% OR Time since flag 32 is 30 minutes> Flag 32 Off, Flag 30 On

 

This creates a minimum limit and an upper time limit. I used double random 5% because it adds to the delay. You can also use a single random 1 to 2% for about the same delay.

 

Be warned though that they way this is setup that if 3 tasks are running at once and the upper limit is reached, a new task will be assigned instantly once the task is completed.

 

3. Have up to, but no more than three missions running at once

 

Use a common activation and deactivation trigger to add and subtract a value from a specific flag. This flag will be part of the conditions for whether or not to select a new mission. For instance each time a new mission is selected have the action "Flag 20 increase 1". When an objective is completed use "flag 20 decrease 1".

 

Use the condition "flag 20 is less than 3" to limit the concurrent missions to 3.

 

Once Group1 Dead && Flag 1 is true> Flag 20 decrease 1

Once Group2 Dead && Flag 2 is true> Flag 20 decrease 1

... and so on.

 

 

4. Randomly decide how many missions will run in total (e.g. minimum of 6 maximum of 12)

 

Ok, this is the tricky one. There are a few different ways to go about making this via triggers, it is simply a question of the possible range. The quickest and easiest to build is similar to the mission selection triggers. Basically we are going to let random variables be active for a set time, each will add 1 to a counter. This counter will act as the upper limit of tasks given.

 

Once> Time More 1> Set flag Y

Once> Time since Flag Y is 20 seconds> Clear Flag Y

 

Once Flag Y is true && Random 5%> Flag Z increase 1

Once Flag Y is true && Random 5%> Flag Z increase 1

... and repeat how ever high you want to go.

  • 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
Does it have to be with the trigger system and not with lua scripts? I think I could write a lua script that did what you want (lua scripts are run with a group's "Run Script" triggered action, and called with the AI ACTION trigger action). The mission editor's random trigger conditions are pretty inflexible and hard to work with... lua is superior in that regard. That said, I think Grimes was able to get a solution to a problem similar to yours using nothing but triggers, but it wasn't easy... I think he repeatedly evaluated multiple low probability (like 1%) conditions, and when one of them evaluated true that hadn't evaluated true yet, stopped evaluating the triggers and selected the "mission" that had rolled true.

 

Wow, LUA scripts, that sounds like kinda serious! I've nothing against using them except my absence of knowledge! I wouldn't ask you to go to the trouble of writing one though, as I'd probably be unable to trouble shoot it and have to keep pestering you for answers!:smilewink:

 

Bits of what you want to do are fairly straight forward. Basically you need to combine several concepts into one giant logic loop. Also you need to use a single trigger to decide whether to choose a mission.

 

 

 

"Timer Start" Once> Time more than 1> Set flag 30, Set flag 32

 

To choose a mission

Switched Condition > Flag 30 is True && Flag 20 is less than 3 && Flag Z is greater than 0> Set flag 31, Flag 30 off, Flag 20 increase 1

 

For each mission

 

Once> Flag 31 is true && Random 20%> Flag 31 Off, Set Flag 1 (to ID the mission), activate units or whatever

Once> Flag 31 is true && Random 20%> Flag 31 Off, Set Flag 2 (to ID the mission), activate units or whatever

.. For each mission

 

 

 

Time since flag 32 is 15 minutes && Random 5% && Random 5% OR Time since flag 32 is 30 minutes> Flag 32 Off, Flag 30 On

 

This creates a minimum limit and an upper time limit. I used double random 5% because it adds to the delay. You can also use a single random 1 to 2% for about the same delay.

 

Be warned though that they way this is setup that if 3 tasks are running at once and the upper limit is reached, a new task will be assigned instantly once the task is completed.

 

 

 

Use a common activation and deactivation trigger to add and subtract a value from a specific flag. This flag will be part of the conditions for whether or not to select a new mission. For instance each time a new mission is selected have the action "Flag 20 increase 1". When an objective is completed use "flag 20 decrease 1".

 

Use the condition "flag 20 is less than 3" to limit the concurrent missions to 3.

 

Once Group1 Dead && Flag 1 is true> Flag 20 decrease 1

Once Group2 Dead && Flag 2 is true> Flag 20 decrease 1

... and so on.

 

 

 

 

Ok, this is the tricky one. There are a few different ways to go about making this via triggers, it is simply a question of the possible range. The quickest and easiest to build is similar to the mission selection triggers. Basically we are going to let random variables be active for a set time, each will add 1 to a counter. This counter will act as the upper limit of tasks given.

 

Once> Time More 1> Set flag Y

Once> Time since Flag Y is 20 seconds> Clear Flag Y

 

Once Flag Y is true && Random 5%> Flag Z increase 1

Once Flag Y is true && Random 5%> Flag Z increase 1

... and repeat how ever high you want to go.

 

Whoa, that's awesome. Gonna need to sit down and digest this one. That looks full on!

 

Re the task being instantly assigned - that's okay isn't it? I mean I can just delay the players being told about it by using a Time Since the Mission ID flag (or whatever) for the mission messages right?

 

Thank you very much guys, I'm feeling everything is possible again!:thumbup:

[sIGPIC][/sIGPIC]

"Great minds think alike; idiots seldom differ.":pilotfly:

i5 3750K@4.3Ghz, MSI Z77A GD55, 8GB DDR3, Palit GTX 670, 24" Benq@1920*1080, X52 Pro, Win 7 64bit.

Posted

Having a slight rethink on how the first few are organized because I forgot one little thing.

 

Change the first trigger to

Once> Time more 1> Set Flag 32 (get rid of the flag 30)

 

Then you can do 1 of 2 things.

 

1. And add the trigger

Switched Condition> Time since Flag 30 is true is 2 seconds> Flag 30 Off, Flag 32 On

 

What this does is it

Step 1: Starts the random delay immediately.

Step 2: Once the random delay is done it checks if it should add a mission.

Then:

If it can add a mission it will do so. It will also start the random delay again.

If no mission can be added the new trigger will start the random delay again and prevent a new mission from being chosen until the delay is over.

 

Or

 

edit the "select mission" trigger to include the "Flag 32 On" action and then use time since flags to delay any messages.

 

basically the difference is what happens when the mission limit is reached and how quickly a new mission will be assigned. The first way checks to add a new mission every 15-30 minutes. So if a mission is completed just after the check ends you have to wait 15-30 minutes. The 2nd way starts the check only when a new mission is chosen and if the limit isn't reached. So if you have 3 missions running, it will assign the new mission once one is completed, it will then start the delay again.

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

  • Recently Browsing   0 members

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