Jump to content
Sign in to follow this  
nullrick

Making multiple assets spawn (together) randomly?

Recommended Posts

I know how to make a unit/object spawn randomly using map markers. However when trying to make, for instance, a fireteam spawn at a randomly location using the same method, different units will spawn at different locations.

In this case I'm trying to spawn 3 different objects (trigger, map marker, object) spawn on a few different locations while still keeping them in the composition that I originally placed them. Please note that the map marker that I included in the list of objects I'm needing to randomly spawn is not one of the markers I'm using for a random spawn location.

For example - I've placed a trigger about 15 meters away from a marker which is on top of an object in an east-to-west fashion.

How do?

Share this post


Link to post
Share on other sites
I know how to make a unit/object spawn randomly using map markers. However when trying to make, for instance, a fireteam spawn at a randomly location using the same method, different units will spawn at different locations.

In this case I'm trying to spawn 3 different objects (trigger, map marker, object) spawn on a few different locations while still keeping them in the composition that I originally placed them. Please note that the map marker that I included in the list of objects I'm needing to randomly spawn is not one of the markers I'm using for a random spawn location.

For example - I've placed a trigger about 15 meters away from a marker which is on top of an object in an east-to-west fashion.

How do?

you could just spawn the squad leader at the random location then spawn his subordinates using a for loop for maximum efficiency at the squad leaders position. After that you could cheat and use attachto to warp them to the proper location in the formation they should be in, then after they are attached properly then simply detach them all. (offset values can be found in cfgGroups, are defined for every unit that is in the squad, the number usually starts at 0,0,0 which is the squad leaders position, then from there it increments by 5 on the x and y axis, ((5,5,0),(-5,-5,0),etc)

if your doing this with objects and not units then you'll need to create a composition then store it inside a variable using BIS_fnc_objectsgrabber/objectsmapper. The variable will need to be defined before you use the composition and it WILL cause the game to lock up while its reading that stuff off the hard drive, and it can take minutes if the composition is large or if the game is fighting other programs for hard drive access (if your smart you'll preprocess the script that contains this data so it will get processed before mission starts). After the data is loaded on the RAM the freezing shouldn't be a problem as RAM is a lot faster than a hard drive

Edited by austin_medic

Share this post


Link to post
Share on other sites

If a fireteam leader is set to randomly spawn at a location the units in his squad will also spawn with him provided they are set to "In Formation" when placed in the editor.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×