Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
redarmy

unit setPos (getPos player)

Recommended Posts

Hi all

 

im attempting to create a scenario where i can use the unit setposition function to place a member of my team at my side.

 

THE REASON: Not all buildings have pre defined positions,so i figured i could use this command to "manually" place my teamates in a house beside me.

with the unit setpos command and a radio trigger set to repeat i can do this...however this involves pre-naming any unit i want to do this with

 

THE EXAMPLE:  BOB setPos (getPos playername);  To be activated on radio Alpha                         MIKE setPos (getPos playername); to be activated on radio bravo....and so on

 

THE DILEMMA: My mission will involve me recruiting more and more AI as the mission unfolds,and there are not enough radio triggers to assign to each AI unit.

 

MY HOPE: Is there a way to set unit setPos for any "selected" AI in the group of units within your command?

 

Iv been searching all day and nothing close comes up

 

any help would be awesome

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/groupSelectedUnits

 

Or you can use addAction instead of radio triggers.

Thanks for reply

 

the add action wont be appropriate this time round.

 

And the link you gave me....im honestly unsure as to what it is.

 

Is there a way even,to set position for all AI in my squad to be sent to my postion? Iv tried unitsgroupplayer setPos (playername)   but it didnt work

Share this post


Link to post
Share on other sites
{
   _x setPos (getPos player);
}foreach (groupSelectedUnits player);

groupSelectedUnits return an array, so you'll need to go through it by foreach.

 

for all units:

{
  _x setPos (getPos player);
}foreach (units group player) - [player]; 

the "- [player]" is not really necessary, but I myself would put it there (it skips player from moving, but it would be moved where it is anyways)

Share this post


Link to post
Share on other sites
{
   _x setPos (getPos player);
}foreach (groupSelectedUnits player);

You are the man zapat!!!

 

Cant tell you how much this works perfectly!  Thank you

Share this post


Link to post
Share on other sites

There is one other issue.With tha line of code you gave me,is there anyway to alter it so the game recognizes what floor of a building im on and can set altitude for ai? currently it always sets their position to the ground floor even if im on a roof top

Share this post


Link to post
Share on other sites

For the selected team member:

{ 
 _x setPosAGL getPosAGL player;
} forEach (groupSelectedUnits player);
For all units in players group:

{ 
 _x setPosAGL getPosAGL player;
} forEach (units group player);

Share this post


Link to post
Share on other sites

There is one other issue.With tha line of code you gave me,is there anyway to alter it so the game recognizes what floor of a building im on and can set altitude for ai? currently it always sets their position to the ground floor even if im on a roof top

use setPosASL instead of AGL

Share this post


Link to post
Share on other sites

I wish the Arma3 AI were as smart as you guys...first attemp  set their position to join me on a roof top..

 

Next command i give was regroup....next thing i know the AI decide to test gravity :D

Share this post


Link to post
Share on other sites
Sign in to follow this  

×