Jump to content
Sign in to follow this  
horror1

recruit ai

Recommended Posts

hello im looking for a good and easy script to recruit ai soldiers in a mp mission.

it should restrict the groupsize and allow only 1 recruiting action till player dies and respawns and ai should be deleted when player leaves .

any hint is much apreciated

Share this post


Link to post
Share on other sites

i did not miss it , i even posted in it but the thread was not exactly what im looking for and it dont even get any solution.

it seems to be very difficult cause i couldnt find a single solution for it even though i searched for days.

so i decided to post my specific problem in an seperate thread.

perhaps yu can give me a working solution for it?

Share this post


Link to post
Share on other sites

You'd limit the recruitment with this:

this addAction["recruit","recruit.sqf",[],1,false,true,"","(count units group player) <= 2"];

Change the 2 to whatever group size you want, 2 meaning you can get 2 units max.

As for deleting them after you log off, you'd probably do something with onPlayerDisconnected, but I'm not familiar with how that works and can't test it at the moment.

Share this post


Link to post
Share on other sites

Take a look at how you can recruit units in my TFOR mission - I extracted this feature into a sample mission which can be downloaded here:

http://forums.bistudio.com/showthread.php?t=107549

(I hope you own Operation Arrowhead, otherwise all you have to change is the file recruitable_units.sqf).

It deletes dead recruit bodies after 2 minutes, kills recruited AI in case the player disconnects and deletes them afterward.

You can access the dialog by calling the script "bon_recruit_units\open_dialog.sqf", as you do it via mouse action in the sample mission.

Restricting this to be available only once per life is another story, where many different approaches exist...

Edited by Bon

Share this post


Link to post
Share on other sites

thx alot for your help guys you both helped me alot.

@bon your script is great it should be in the scripting faqs and you should release your script as download.:)

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  

×