Jump to content
jonilahtinen

Spawn unit to another units group (BIS_fnc_spawnGroup)

Recommended Posts

This should be simple thing, but I cannot get this done right. I can spawn units okay, but i need to spawn them to another units group.

 

So like this:

 

- Unit A

- Script spawns unit B which should join A's group

 

Share this post


Link to post
Share on other sites

would be great to see how you are doing it currently.

 

the main concept would be this though

 

_unitB = (group _unitA) createUnit [_unitClassName, _desiredPos, [], 0, "FORM"];

or the simpler syntax version

_unitB = _unitClassName createUnit [_desiredPos, group _unitA];

 

according to: https://community.bistudio.com/wiki/createUnit

 

and

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

Share this post


Link to post
Share on other sites
4 minutes ago, bad benson said:

would be great to see how you are doing it currently.

 

the main concept would be this though

 


_unitB = (group _unitA) createUnit [_unitClassName, _desiredPos, [], 0, "FORM"];

or the simpler syntax version

_unitClassName createUnit [_desiredPos, group _unitA];

 

according to: https://community.bistudio.com/wiki/createUnit

 

I did the single unit with this line:  [getPos aPos, EAST, ["unit"],[],[],[],[],[],1] call BIS_fnc_spawnGroup

 

Thanks. Your line was what I wanted.

Share this post


Link to post
Share on other sites
10 minutes ago, bad benson said:

would be great to see how you are doing it currently.

 

the main concept would be this though

 


_unitB = (group _unitA) createUnit [_unitClassName, _desiredPos, [], 0, "FORM"];

or the simpler syntax version

_unitB = _unitClassName createUnit [_desiredPos, group _unitA];

 

according to: https://community.bistudio.com/wiki/createUnit

 

and

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

 

It works, but the units just stand still. They won't follow the groupleader. Any idea how to fix this?

 

Nevermind, it works. Thank you.

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

×