Jump to content
Sign in to follow this  
nap1991

Grouping objects and units in editor

Recommended Posts

The idea is:

I want to create a enemy camp with some tents, fireplace and enemy units.

However, i dont want to give them a fixed position as i want players to search for the camp.

Therefore, i give all objects and units a placement radius say 2000m.

But as i do this, all the stuff will just scatter randomly in that 2000m parameter but not in the position i want them to be.

So is there any method to group all those objects and units so that they can appear as a group randomly in that 2000m parameter instead of scattering around individually?

Many thanks.

Share this post


Link to post
Share on other sites

Edit: doh just saw the bit about the editor - nevermind lol - still can use this if you can stray away from the editor.

not sure if this is any help? used this for loads of stuff

creates a new marker in random dir from a marker- named "centre" - which you will need to set (empty)on the map.


_distances = [1800,1900,2000] call BIS_fnc_selectRandom;  //distance away from the centre marker. 
	_ang = random 360;  	
	_dis = _distances; 
	_dx = sin(_ang)*_dis; 
	_dy = cos(_ang)*_dis; 
	_loc = [((getmarkerpos "centre") select 0) + _dx, ((getmarkerpos "centre") select 1) + _dy, 0];
_marker =	createMarker ["spawnloc", _loc ];
"spawnloc" setMarkerShape "ELLIPSE";
			"spawnloc" setMarkerType "Empty";
			//"spawnloc" setMarkerSize [0, 0];



from the newley created marker - this spawns loads of units within a raduis defined by the distance 20. 

for "_i" from 0 to 5 do     
{
	_distances = [20] call BIS_fnc_selectRandom;
	_ang = random 360;  	
	_dis = _distances; 
	_dx = sin(_ang)*_dis; 
	_dy = cos(_ang)*_dis; 
	_loc = [((getmarkerpos "spawnloc") select 0) + _dx, ((getmarkerpos "spawnloc") select 1) + _dy, 0];
	_terrorsupportteam = [_loc, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1", "TK_INS_Soldier_Sniper_EP1", "TK_INS_Soldier_2_EP1","TK_INS_Soldier_2_EP1"],[],[],[],[],
[],180] call BIS_fnc_spawnGroup;
//add anything else you want to create here...
};

not tested but should work.

Edited by Mikie boy

Share this post


Link to post
Share on other sites

thanks,,,i haven't tested it yet,,,but seems the code can spawn units around the marker,,,

but wt if i also want to include some specific orientation which i can set in the editor but not just simply spawning units by script?

also i am new to scripting :P

so is there anyway i can do it in the editor with some simpler commands?

Share this post


Link to post
Share on other sites

sorry dude - nothing that i can tell you - to be honest the code supplied wont do you any harm -

_terrorsupportteam - after this line - that is where you can add your tents etc forexample..

_tent = "CampEast_EP1" createVehicle (_loc );

you can set direction but it will take a bit of working out for each one as they spawn randomly -

As a whole or separate groups to set their direction - _terrorsupportteam setdir 45; (face north east) or randomise it.

_angles = [25,45,65,180]; _randmoise = _angles select random 3; _terrorsupportteam setdir _angles;#

sorry cant be of any more help; i had a go in the editor but to be honest it would have taken loads of markers and triggers.

Share this post


Link to post
Share on other sites

Look at this post here. What you need requires "object compositions".

http://forums.bistudio.com/showthread.php?88644-The-answer-how-to-create-your-custom-object-compositions&highlight=object+compositions

Even when you understand and can create the object compositions...then you will have to randomly select empty, flat places large enough to hold your compositions. That'll take a bit of scripting also I'm afraid.

Share this post


Link to post
Share on other sites
sorry dude - nothing that i can tell you - to be honest the code supplied wont do you any harm -

_terrorsupportteam - after this line - that is where you can add your tents etc forexample..

_tent = "CampEast_EP1" createVehicle (_loc );

you can set direction but it will take a bit of working out for each one as they spawn randomly -

As a whole or separate groups to set their direction - _terrorsupportteam setdir 45; (face north east) or randomise it.

_angles = [25,45,65,180]; _randmoise = _angles select random 3; _terrorsupportteam setdir _angles;#

sorry cant be of any more help; i had a go in the editor but to be honest it would have taken loads of markers and triggers.

Look at this post here. What you need requires "object compositions".

http://forums.bistudio.com/showthread.php?88644-The-answer-how-to-create-your-custom-object-compositions&highlight=object+compositions

Even when you understand and can create the object compositions...then you will have to randomly select empty, flat places large enough to hold your compositions. That'll take a bit of scripting also I'm afraid.

Thanks man. I've tried to do it my way,,, it's like that:

I create a reference object (A1) with a placement radius 2000m

then i create other elements of the camp with specific dir and use "this setpos [((getpos A1 select 0)+/- x), ((getpos A1 select 1)+/- y),0]"

but as you guys said, it just require loads of work as i have to preview the position for each objects

maybe i'll just stick to your scripting method then :P

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  

×