Jump to content
Sign in to follow this  
tobmic

Recruiting AI Soldiers

Recommended Posts

Hello

I searched forum before and found some other posts but not realy that what i was looking for.

I want to give a Warfare Barrack an action to recruit AI soldier that go to the player group and when the player disconnects the AI soldier delete again.

Aswell if the ai soldiers die that theyre corpse get removed after some time.

Also a max ai number that a player can recruit in his group.

Help in this would be really great i tried all weekend to get into this but seems like my scripting skill still sux : (

P.S it should run with a script and the Warfare Barrack should not get destroyed

Share this post


Link to post
Share on other sites

Perhaps you could pull the code from Xeno's Domination map. He has a barracks at the base where you can recruit AI soldiers. There is also an array for maximum AI based on player rank, but you could change that. Also, you could add your own custom soldiers besides the default selection.

Share this post


Link to post
Share on other sites
Perhaps you could pull the code from Xeno's Domination map. He has a barracks at the base where you can recruit AI soldiers. There is also an array for maximum AI based on player rank, but you could change that. Also, you could add your own custom soldiers besides the default selection.

you have any idea how to do that ?

Share this post


Link to post
Share on other sites

I use this:

Alright man check it out. In my mission folder I have several sqS files (as opposed to sqf) dunno if it matters but thats how I saw it done. The following one named hirerifeman.sws

"USMC_Soldier" createUnit [getmarkerpos "hire", group player];

and than in the barracks init i have this

addaction ["Recruit Rifleman1", "hirerifleman.sqs"];

My guy spawns at marker named "hire".

I

Only thing I need now is a simple way to dismiss them.

Share this post


Link to post
Share on other sites

Hi,

i just created a very simple script for recruiting ai soldiers...

You can get it here!

It's for recruiting squads, but it can easily be changed for recruiting single soldiers. It also has a dismiss function. (the units leave your squad and get deleted)

Tested on dedicated server. I think i fixed all bugs already! :)

You have to edit ALL files inside the Recuit folder and add the line into the init.sqf like you see in the example mission.

Just take a look at it! If you have any questions about installing and changing, i will help you.

Be advised: I suck at scripting :) so maybe the code sucks, but it's working! :yay:

Share this post


Link to post
Share on other sites

cool thanks sxp2high

can you change the script for me that its not defined to a name like charlie_1 ?

So that everyone can recruit soldiers

Share this post


Link to post
Share on other sites

I don't know how to do that, sorry... Exactly: I don't know how to limit the amount of soldiers then and how to assign the correct group. That's why i'm using sepperate scripts for each group.

Share this post


Link to post
Share on other sites
cool thanks sxp2high

can you change the script for me that its not defined to a name like charlie_1 ?

So that everyone can recruit soldiers

All you need to do is change that name to the one you want. Or use player.

Share this post


Link to post
Share on other sites

Hi,

i improved the recruit script. Less editing needed now. It's still very simple and easy. No rank check or so.

It's still designed for squad leaders. In other words: Not every player can recruit, only squad leaders.

...but, i could create a version for every player if you need that. Just ask for it.

Download the sample Mission here.

A small how-to:

Edit both triggers (see mission). Should be self explaining.

init.sqf

Add this for each group to enable the recuiting at mission start.

EchoEmpty = true;

EchoDismiss.sqf

Edit these two lines at the top.

_unit = echo_1;                            // the unit which recruits the ais
EchoDismiss = true;                        // group name dismiss

EchoRecruit.sqf

Edit these lines at the top.

_unit = echo_1;                            // the unit which recruits the ais
_spawnpos = (getmarkerpos "SpawnSquads");  // where the ais get spawned
EchoEmpty = false;                         // group name empty

Add as much as you like here. (Line 12)

// create ais
_ai1 = "USMC_Soldier" createUnit [_spawnpos, _group];

Edit this three lines. (Line 17, 19 and 20)

waitUntil {EchoDismiss};

EchoEmpty = true;                         // group name empty
EchoDismiss = false;                      // group dismiss

Share this post


Link to post
Share on other sites

Hello all another newb question from a newb scripter, firstly i can hire a rifle

man from my barracks using from my radio trigger juliet, "USMC_Soldier createUnit [getmarkerpos "hire", group player];and in my barracks i have, barracks addaction ["Recruit Rifleman1", "hirerifleman.sqs"]; with a marker named "hire". So i tried doing the same but hiring a corpseman from the field hospital using radio trigger india,"USMC_Soldier" createUnit [getmarkerpos "hire1", group player]; and for the hospital i have, hospital addaction ["Recruit Corpsman1", "hire1corpsman.sqs"]; with a marker named "hire1" but instead of a corpsman spawning from the hospital a rifeman spawns. What am i doing wrong tks in advanced. :)

Share this post


Link to post
Share on other sites

@sxp2high

can you reupload your sample mission somebody else???

Edited by TeilX

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  

×