Jump to content
Sign in to follow this  
dragonsyr

spawn unit in a building

Recommended Posts

i have a problem spawning units in a building.

i use this command to get the position i want

copytoclipboard str getposASL player;

and this command for the spawn

 "B_Competitor_F"  createVehicle [1907.89,5716.65,18.4575];

but the unit is spawned out of the building.

if i use objects instead of units (ex "Chemlight_blue") then they spawned in the place that i want

how can i do it???

thanks

my goal is to spawn 3 units in the radiotower (in front of the consoles)

ps. i search for it , i found 2 threats that is not related to my problem ,i found no help for this .

Share this post


Link to post
Share on other sites

Sorry that was wrong info. You confused me, are you spawning vehicles or units (soldiers)

Units

man=createGroup west ;
man = grp createunit ["B_Competitor_F",[1907.89,5716.65,18.4575],[],0,"can_collide"];

Vehicles

veh = createVehicle ["vehicle_name",[1907.89,5716.65,18.4575],[], 0, "can_collide"] ;

Edited by F2k Sel

Share this post


Link to post
Share on other sites

omg!!! you right about this... i try with this and the units spawn without errors but not in the place... .... ok i will try now with that you send....

---------- Post added at 17:16 ---------- Previous post was at 17:11 ----------

what does the can_collide command???

---------- Post added at 17:25 ---------- Previous post was at 17:16 ----------

_tg4 = "B_Competitor_F" createVehicle [1876.47,5725,5.51393];
i test this again and the unit spawn in the place i want (ground test) not in building.... now the next test.......

---------- Post added at 17:37 ---------- Previous post was at 17:25 ----------

with this

man=createGroup west ;

man = grp createunit ["B_Competitor_F",[1907.89,5716.65,18.4575],[],0,"can_collide"];

i get error undefined variable in expression grp , when i run from a script.

if i run this command from debug console , no errors but nothing spawned

Edited by dragonsyr

Share this post


Link to post
Share on other sites

sorry typo grp=createGroup west ;

can_collide allows the object/unit to spawn while in contact with another object

Also using the full array is much less demanding on the CPU than "B_Competitor_F" createVehicle [1907.89,5716.65,18.4575];.

Share this post


Link to post
Share on other sites
grp=createGroup west ;

man = grp createunit ["B_Competitor_F",[1906.7,5712.63,18.4587],[],0,"can_collide"];

works perfect !

and how can i make the unit facing in some direction?

i tried and works with this

man = grp createunit ["B_Competitor_F",[1906.7,5712.63,18.4587],[],0,"can_collide"]; 
man setDir 145 ;
man disableAI "ANIM";

i use disable because without this the unit on spawn is facing 145 but after that return on default direction...

---------- Post added at 18:23 ---------- Previous post was at 18:11 ----------

and unarmed?

Share this post


Link to post
Share on other sites

thank you sir ! i set also

man disableAI "AUTOTARGET" ;
and i think this could be fine...

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  

×