Jump to content

??? how to randomize the moment of spawning of a unit (group) ???


Recommended Posts

Posted

Does anyone knows how?

I know how to set random in the triggers with the result of the unit/group appearing or not, set by random, but how to make it spawn say randomly sometime within the first 60 minutes of game for example?

 

thanks

`

 

JEFX

[sIGPIC][/sIGPIC]

In DCS I fly jets with thousands of pounds of thrust...

In real life I fly a humble Cessna Hawx XP II with 210 HP :D

Posted

You could try setting a bunch of flags randomly at mission start, and letting the resulting combination decide when the group appears.

 

Example:

 

If flag 1 is true and time = 10, activate

 

or

 

If flag 2 is true and time = 20, activate

 

or

 

If flag 3 is true and time = 30, activate

 

etc.

Awaiting: DCS F-15C

Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files

 

Posted

thanks for the tip, but I never really understood the concept of FLAGS... Could you please tell me exactly all the steps to set this up and why? What do I do with these flags? what are flags actually? and how else could one use them? I dont think I get the concept... sorry:(

 

thanks very much

 

 

JEFX

[sIGPIC][/sIGPIC]

In DCS I fly jets with thousands of pounds of thrust...

In real life I fly a humble Cessna Hawx XP II with 210 HP :D

Posted

Flags are booleans, which means they say one of two things:

 

1. True

 

2. False

 

The simulator will do different things depending on the whether a flag is true or not, you as the mission designer decide the effect of each flag.

 

So to set it up (from memory, I don't have the game or PDF manual with me now):

==================================

 

Trigger type

Type: Mission Start

name: Choose Flag 1

 

Trigger Conditions

Random

Percentage: Any % you want

 

Trigger Result

Set flag # 1 to true

 

All of that means that at the start of the mission, the AI will random decide to set a flag true or not. Once the flag is set, you want the AI to respond accordingly, so you would need another trigger

 

======================================

 

Trigger Type

Type: Once

Name: Spawn at 10

 

Trigger Conditions

Flag # 1 is true

Time is 10

 

Trigger Result

Activate group

 

What that means is that if the flag was set to true at the mission start and the mission time is 10 seconds, the group will activate. If the flag was never set true, the group will not be activated by the trigger Spawn at 10. If you want there to be two possible spawn times for the unit that will change randomly each time you do the mission, you need another trigger like Spawn at 10 that is activated by a different flag and set to a different time:

 

========================================

 

Trigger type

Type: Mission Start

name: Choose Flag 2

 

Trigger Conditions

Random

Percentage: Any % you want

 

Trigger Result

Set flag # 2 to true

 

==========================================

 

Trigger Type

Type: Once

Name: Spawn at 20

 

Trigger Conditions

Flag # 2 is true

Time is 20

 

Trigger Result

Activate group

 

Spawn at 20 will only work if Spawn at 10 failed and Flag 2 was set to true. So now, your mission can happen three ways:

 

1. Flag 1 is set true at the beginning, and the group will spawn at 10 seconds

 

2. Flag 2 is set true at the beginning, and the group will spawn at 20 seconds

 

3. No flag is set true and the group never spawns.

 

If you want the group to always spawn, but at random times, simply add one more trigger:

 

===================================

 

Trigger type

Type: Once

name: Final Spawn

 

Trigger Conditions

Time is 60

 

Trigger Result

Activate Group

 

This last trigger will activate the group at 60 seconds if Spawn at 10 and Spawn at 20 fail to activate the group. Now you have a mission where the group will always spawn, but always at different times. You can add as many flags as you want to make it as random as you want.

 

Hope that helps.

Awaiting: DCS F-15C

Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files

 

Posted

Have a read of this post:

 

http://forums.eagle.ru/showthread.php?p=968305#post968305

 

Follow-up here if you have more questions...

 

For making something spawn some time at random, there's basically two approaches. You can do as Exorcet suggested and decide on a few specific times at which it may appear, and then randomly picking one of them.

 

The alternative is to add a trigger with a small random chance of occurring. Triggers are evaluated by the game approximately once every second, so if you have a trigger that says "random 1" then every second, there's a 1% chance of it becoming active.

 

So, the steps are:

 

 

  1. Decide on the conditions which need to be fulfilled in order for the group to appear. This might be simply "start of the mission", but it's normally best to wait until the player is airborne, or enters a particular area of the map, or similar. For example, you can use an "altitude higher than" condition to see if the player's aircraft has left the ground (remember these altitudes are above sea level, so move the cursor over the runway the player will be taking off to check the altitude in the status bar, and a few metres).
  2. Create a 'once' trigger and call it "Start" to wait until that condition is true, and then set a flag to true. Let's assume you're using flag number 10 for this discussion, but the particular number is arbitrary. Just make sure you don't use the same flag number for two unrelated things. Also add a "message" action that says "flag 10 set" or similar, so you can see in the game when this trigger becomes activated.
  3. Create another 'once' trigger and call it "Random activation" which has as its condition that 'flag 10 is true', and random(1) chance. For the actions in this trigger, activate your group. Again, add a "message" action to let you know the job has been done.
  4. Create a final 'once' trigger and call it "Timeout activation" which has as its condition "flag 10 true for 3600 seconds". Also set this trigger's action to activate your group. Again, a "message" action saying "time is up, group activated" will help when debugging your mission.

Now when the game starts, the triggers you made in steps 3 and 4 won't be true, because flag 10 isn't set.

 

The trigger you created in step 2 ("Start") will also probably not be true, so the game will just keep testing it until it is. Finally it will become true, and flag 10 will be set as true.

 

Now, the "Start" trigger will stop being tested (because it's a "once" trigger so it's limited to only activating one time). The "Random activation" and "Timeout activation" triggers from steps 3 and 4 will continue to be executed, and now flag 10 is true. So, there'll be a 1% chance every second that trigger #3 will evaluate as true, and the group will be activated.

 

If after one hour the "Random activation" trigger still hasn't activated, then finally the "Timeout activation" trigger will become activated.

 

If you're astute, you might notice that if the "Random activation" trigger becomes true, then the "Timeout activation" trigger will still be executed an hour after the start condition was fulfilled. In this particular case, that doesn't matter: activating an already-activated group has no effect. However you can prevent this by e.g. clearing flag 10 within the actions of both the 'Random activation' and 'Timeout activation' triggers, which will ensure only one of them is run.

Posted

Nomdeplume

Exorcet

Thanks a lot, this was really helpful!

 

I am working on making a complex, long, single mission, that has enough random elements to make it playable many times as single player...

[sIGPIC][/sIGPIC]

In DCS I fly jets with thousands of pounds of thrust...

In real life I fly a humble Cessna Hawx XP II with 210 HP :D

Posted (edited)

There is an other way:

 

For all german guys: http://spare-time-pilots.de/viewtopic.php?f=8&t=490

 

For the english guys:

 

... Set a Flag randomly at missionstart. Flag 1 is for RandomGroup#001, Flag 2 is for RandomGroup#002 and so on...

 

 

Triggername: Random Group #001

Triggertype: Missionstart

Triggerrule: Random - 20% (...depends on how many RandomGroups you want to trigger...)

Triggeraction: Set Flag - 1

 

Triggername: Random Group #002

Triggertype: Missionstart

Triggerrule: Random - 20% (...depends on how many RandomGroups you want to trigger...)

Triggeraction: Set Flag - 2

 

Triggername: Random Group #003

Triggertype: Missionstart

Triggerrule: Random - 20% (...depends on how many RandomGroups you want to trigger...)

Triggeraction: Set Flag - 3

 

Triggername: Random Group #004

Triggertype: Missionstart

Triggerrule: Random - 20% (...depends on how many RandomGroups you want to trigger...)

Triggeraction: Set Flag - 4

 

 

 

... and so on for every group you want to trigger randomly...

... now you can activate the groups like this...

 

 

Triggername: Activate Group #001

Triggertype: Once

Triggerrule#1: Unit inside zone - Player - Startzone (...or maybe "altetude higher than".... or maybe "Time more"....)

Triggerrule#2: Flag is true - 1

Triggeraction: Activate Group - RandomGroupe #001

 

Triggername: Activate Group #002

Triggertype: Once

Triggerrule#1: Unit inside zone - Player - Startzone (or maybe "altetude higher than".... or maybe "Time more"....)

Triggerrule#2: Flag is true - 2

Triggeraction: Activate Group - RandomGroupe #002

 

Triggername: Activate Group #003

Triggertype: Once

Triggerrule#1: Unit inside zone - Player - Startzone (or maybe "altetude higher than".... or maybe "Time more"....)

Triggerrule#2: Flag is true - 3

Triggeraction: Activate Group - RandomGroupe #003

 

Triggername: Activate Group #004

Triggertype: Once

Triggerrule#1: Unit inside zone - Player - Startzone (or maybe "altetude higher than".... or maybe "Time more"....)

Triggerrule#2: Flag is true - 4

Triggeraction: Activate Group - RandomGroupe #004

 

 

 

.... if you want to check if all random triggered units are dead - maybe for a message "Mission complete, all units dead" do following....

 

 

Triggername: Group dead #001

Triggertype: Once

Triggerrule: Group dead - RandomGroup #001

Triggeraction: Clear Flag - 1

 

Triggername: Group dead #002

Triggertype: Once

Triggerrule: Group dead - RandomGroup #002

Triggeraction: Clear Flag - 2

 

Triggername: Group dead #003

Triggertype: Once

Triggerrule: Group dead - RandomGroup #003

Triggeraction: Clear Flag - 3

 

Triggername: Group dead #004

Triggertype: Once

Triggerrule: Group dead - RandomGroup #004

Triggeraction: Clear Flag - 4

 

 

... and activate the message....

 

 

Triggername: Mission complete message

Triggertype: Once

Triggerrule#1: Flag false - 1

Triggerrule#2: Flag false - 2

Triggerrule#3: Flag false - 3

Triggerrule#4: Flag false - 4

Triggerrule#5: Group dead - whatever (...other mission objectives..)

Triggeraction: Message - "All units dead, mission complete"

Edited by =STP= Dragon
  • Recently Browsing   0 members

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