Arma 3
Comark May 21, 2016 @ 6:15pm
create a unit from a unit pool?
I would like an script that would allow me to create a unit from a custom unit pool? Thank you in advance.
Last edited by Comark; May 21, 2016 @ 9:18pm
< >
Showing 1-8 of 8 comments
Seb May 22, 2016 @ 1:26pm 
just create the units you want and group them ?
Comark May 22, 2016 @ 1:38pm 
No exactly, let's say there are no units but I want them to be created from an spawner. however, I dont want all of them, I want just one unit from a list of units, and I want this unit to be randomly created. is that posible? By the way I am using this scrip to create units:

_units = [getMarkerPos "custom_marker", side, ["soldier_1", "soldier_2"],[],[],[],[],[],180] call BIS_fnc_spawnGroup
Seb May 22, 2016 @ 1:49pm 
if you want to create a group of the same units at a marker position yes it's possible.

you just need to use BIS_fnc_selectRandom to randomly chose the type of unit you want to spawn from your own list, and then have them created by BIS_fnc_spawnGroup.

then you could activate the spawner by radio via a trigger or w/e.

Comark May 22, 2016 @ 4:11pm 
Thank you man that is what I was looking for! I have another question kind of related to this one, lets say that I want to create units using both functions but it should stop once it reaches 20 units. later on lets say a unit gets killed, then it should create more units until it reaches 20 units again. I have tried it with triggers but no success. do you how to do it? if not, no worries because I answered the main question. Once again thank you for your help!
Last edited by Comark; May 22, 2016 @ 4:17pm
Seb May 22, 2016 @ 4:51pm 
yes i already done that you just need to have an infinite loop that checks the total number of enemies, and if there are less than 20 enemies the loop spawns one or many units.

you have to do that loop inside a .sqf file but you can activate it or stop it with a trigger later if you want.

to detect an emeny death you can add an event handler "killed" on the units when you create them. when an enemy will die it will do for example : TOTAL_ENEMIES = TOTAL_ENEMIES - 1.

and then the loop will see TOTAL_ENEMIES < 20 and spawn new units.
Comark May 22, 2016 @ 11:02pm 
Hey man sorry but I am not an scripter but could you pls type an script example I will really appreciate your help!!!!!
Last edited by Comark; May 22, 2016 @ 11:03pm
Seb May 23, 2016 @ 4:37am 
init.sqf :


SPAWNER = true;

while {SPAWNER} do

{

if TOTAL_UNITS < 20 then
{
"COMMAND TO CREATE A "NEW_UNIT""
}

"NEW_UNIT" addEventHandler ["Killed",{TOTAL_UNITS = TOTAL_UNITS - 1;}]

Sleep, 5000

};




and you can use a trigger to set SPAWNER from true to false if you want to disable it.


*not tested
Last edited by Seb; May 23, 2016 @ 4:37am
Comark May 23, 2016 @ 9:15pm 
Thank you man now it makes sense thank you so much for your time :steamhappy:
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: May 21, 2016 @ 6:15pm
Posts: 8