Jump to content
Sign in to follow this  
vitaliy0001

Making a unit join you or your group

Recommended Posts

So... I've been reading a few threads but none of the information contained in them answers my question:

I'm trying to create a mission which includes un-grouped soldiers positioned randomly. I want them to automatically join me (my group) when I come within 5m of them.

My attempts so far have not worked:

Attempt 1)

Having placed a unit (LostSoldier1) approx. 20m away from me (Myself), I entered the following in LostSoldier1's init field:

meters = LostSoldier1 distance Myself;if (meters<5) then {LostSoldier1 join Myself};

Upon myself approaching LostSoldier1, nothing happened.

Attempt 2)

In the init field of Myself I entered:

grp_ALPHA = group this;

I created a trigger of radius 50 next to LostSoldier1. Activation=BLUFOR, Type=None, Activation=

m = LostSoldier1 distance Myself; if (m<5) then {};

On Act=

[LostSoldier1] join grp_ALPHA;

Does nothing as above.

Would anyone have any suggestions?

Share this post


Link to post
Share on other sites

Attempt 1): Don't use an object's Init field, the code only runs at mission start. When you approach it won't run again. Stick with the trigger.

Attempt 2): It looks like the code you have returns nothing. You need a condition code that returns "true." Try using:

LostSoldier1 distance Myself < 5;

Share this post


Link to post
Share on other sites

Thank you both! It worked using the trigger! :D

Condition: LostSoldier1 distance Myself < 5;

On Act: [LostSoldier1] join (group player);

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  

×