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

How do I add units to the player's group?

Recommended Posts

I'm making a mission where I want to add units to my group as I go. I know how to do this for high command but I just need to add to my own group one at a time.

Can anyone assist with this?

---------- Post added at 11:05 PM ---------- Previous post was at 10:35 PM ----------

I'm looking for something very basic here. Such as giving a unit a name, then on a trigger making that named unit join the player's group.

Share this post


Link to post
Share on other sites

Very basic? Here it is! Use the GLT Framework.

1. Place module in the editor

2. Place units that can be recruited by the player

3. In the init-line of the module you can alter the basic default settings. Possible values are:

GLTCANRECRUIT = ["Name_of_your_unit","Name_of_other_unit"];

(defines who is allowed to recruit units of a lower rank)

GLTRECRUITSIDES = ["West"];

(defines which side can be recruited, possible values are West, East, Resistance and Civilian)

GLTRECRUITBLACKLIST = ["Your_mother","your_father"];

(defines a list of unit(s) that have a lower rank than the player, but are not allowed to recruit, such as mission critical units)

In your init.sqf enter the following line:

waitUntil {!isnil "GLTFRAMEWORKINIT"};

This ensures that the framework is completly loaded after mission start.

Watch this to have a overview of the other functions of the framework:

scvYpJq43RY

Sadly I made no video for recruting.

This module works for SP as well as for MP missions, you can recruit players or AI soldiers and of course you can throw them out of your group again!

Share this post


Link to post
Share on other sites

I'm not looking for something modular like that. While it is cool and I have used it in missions that require it in the past, it's not exactly what I want.

I just want to know how to add a unit to the players group once the player hits a trigger. I figured it would be easy since it's pretty easy to add units under the player's high command.

I just don't want anyone to have to download any mods to play my mission(s) :(

Share this post


Link to post
Share on other sites

Condition Field: Player distance Man<= 5
On Activation Field: [man] join player

I think that should work. Essentially what happens is that if the player comes within 5 meters of the man the man will join his group. This way that unit can move around and doesn't have to stay in a trigger zone but the player can walk up to him anywhere and join him.

Share this post


Link to post
Share on other sites

Benny: I don't know what a unit array is.

I tried just naming a unit in the name field and using

name join group

But that didn't work. How do I put a unit into an array?

Jake:

Thanks I'll try that :)

Would "man" be the unit's name? Or do I just put "man" in the cond and act?

---------- Post added at 10:16 PM ---------- Previous post was at 10:06 PM ----------

Jake you rock! That works perfectly. And I really like that I can have the unit mobile to boot!

Thanks everyone!

So what I did is just what Jake said. I named a unit "man" and another unit "man2" and I made 2 different triggers exactly like jake said just changing the name for each trigger.

Share this post


Link to post
Share on other sites

If you want 2 people to join the group at the same time you can just use:

[man, man2] join player

And to make it work properly in MP you probably want to also name the player and do:

if (isServer) then
{
  [man, man2] join nameofplayer;
};

That is, assuming man and man2 are AI and their group is lead by an AI (which is the case if they are in a 1-man group, obviously) so that they are local to the server. Note that player is null on a dedicated server and will be a different unit every time on a hosted server (as the host could play the unit you want them to join or he could play something else that you don't want them to join).

Share this post


Link to post
Share on other sites

Thanks Galz. It's not an issue for MP, only SP. For MP all units would be playable.

But it's definitely useful to know how to add more than one at a time :)

Share this post


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

×