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


Notices

Reply
 
Thread Tools Display Modes
Old 11-06-2019, 08:18 PM   #1
Birko
Member
 
Birko's Avatar
 
Join Date: Dec 2018
Posts: 299
Default Giving statics and units a % chance to spawn on mission start

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?
Birko is offline   Reply With Quote
Old 11-06-2019, 09:52 PM   #2
Tiramisu
Member
 
Join Date: Oct 2018
Location: Germany
Posts: 592
Default

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:

Code:
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.
Tiramisu is offline   Reply With Quote
Old 11-07-2019, 08:49 AM   #3
Catweedle
Junior Member
 
Catweedle's Avatar
 
Join Date: Mar 2015
Posts: 49
Default

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:

- DCS World Editor - Randomized trigger condition
- DCS World Editor - Randomized Flags

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

DCS_editor_Randomization

Last edited by Catweedle; 11-07-2019 at 08:52 AM.
Catweedle is offline   Reply With Quote
Old 11-07-2019, 09:11 AM   #4
iFoxRomeo
Member
 
Join Date: Jun 2013
Posts: 685
Default

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


Attached Thumbnails
Click image for larger version

Name:	ME.jpg
Views:	205
Size:	98.3 KB
ID:	220714  
iFoxRomeo is offline   Reply With Quote
Old 11-07-2019, 09:23 AM   #5
Catweedle
Junior Member
 
Catweedle's Avatar
 
Join Date: Mar 2015
Posts: 49
Default

Quote:
Originally Posted by iFoxRomeo View Post
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.
Catweedle is offline   Reply With Quote
Old 11-07-2019, 10:20 AM   #6
Rudel_chw
Veteran
 
Join Date: Nov 2013
Location: Antofagasta, Chile
Posts: 6,454
Default

Quote:
Originally Posted by iFoxRomeo View Post
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: 27" Monitor - Ryzen 1500X - 32 GB DDR4 2400 - MSI GTX970 - SSD 1.25 TB - HDD 10 TB - Windows 10 Pro - Thrustmaster HOTAS Cougar - Oculus Rift CV1
Mobile: iPad Pro 12.9" of 256 GB
Rudel_chw is offline   Reply With Quote
Old 11-07-2019, 01:50 PM   #7
Birko
Member
 
Birko's Avatar
 
Join Date: Dec 2018
Posts: 299
Default

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
Birko is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:28 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.