Jump to content

Giving statics and units a % chance to spawn on mission start


Birko

Recommended Posts

Hey everyone.

 

Very new to the mission editor. Currently trying to make a singleplayer mission for with a lot of replayability. Sorry if this has already been covered but not knowing much about the mission editor I don't really know what to search the forums for.

 

Idea was to put a shit ton of trains and tents and trucks etc. across Normandy but for them to only have a smallish chance of spawning- so the mission (armed recce in a spitfire) is different everytime.

 

How do you give units or statics a % chance of spawning on mission start, if you can do that?

Link to comment
Share on other sites

Use late activation for your groups first. Then activate them using a script with random values. So let's say you have 40 groups called "SpawnMe #001", "SpawnMe #002", "SpawnMe #003", ..., "SpawnMe #040" and you want to spawn each of them with a 3% probability. Then your code could look like this:

 

for i = 1, 40 do
  local sNumber = "#"
  if i <= 9 then sNumber = sNumber .. 0 .. 0 .. i end
  if i > 9 and i < 100 then sNumber = sNumber .. 0 .. i end
  if math.random(1,100) <= 3 then
      Group.getByName( "SpawnMe " .. sNumber  ):activate()
  end
end

I have not tested this code, so excuse me, if there are any errors in there.

Link to comment
Share on other sites

If you are not into scripting, randomized unit spawning can also be achieved via mission editor functionality only (keyword "triggers"). Randomized spawning of non-units, however, is a different story.

 

Although a bit rusty (but still valid), you might find these simple tutorials by pickinthebanjo helpful:

 

-

-

 

There is also a page on the DCS wiki explaining triggers and mission randomization:

 

DCS_editor_Randomization


Edited by Catweedle
Link to comment
Share on other sites

3rd possibility aaaand probably easiest....

Set it in the units properties. Works only for units, not for statics

 

 

Here: 50% probability to spawn on mission start

...

 

Indeed -- I keep forgetting about this option. Only drawback using this method is you will not be able to control conditioned spawning (efficiently), i.e. if one group spawns, some other group/-s wouldn't.

Link to comment
Share on other sites

3rd possibility aaaand probably easiest....

Set it in the units properties. Works only for units, not for statics

...

 

Thank you ... didnt knew what that field was for :)

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Ahh so that's what condition is, always assumed it was health for some reason and I'd never used it. Thank you

 

Thanks everyone for your suggestions, will be really helpful getting me more into mission making and hopefully with the mission editor update apparently on the way Soon™ mission making will be easier to pickup for amateurs and more powerful and adaptable for pros

Link to comment
Share on other sites

  • Recently Browsing   0 members

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