Jump to content
Sign in to follow this  
GotheriK

Recruiting Soldiers

Recommended Posts

Could anyone explain how I can implement a system similar to the one the Demo had where you could walk into a certain area and "Hire Soldiers" (Just plain-old AI) to your squad?

Share this post


Link to post
Share on other sites

put this on the init line of an object like a table>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

[this] exec "set_able_atank.sqs";

then you need to make 2 .sqs

set_able_atank.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_sniper = _this select 0

_sniper addAction ["Recruit AT Gunner", "set_join_atank.sqs"]

set_join_atank.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = player

_sniper = _this select 0

?!(alive _sniper):exit

?!(alive _player):exit

"SoldierWAT" createUnit [position player, group player]

that should work.

Share this post


Link to post
Share on other sites

Thank you, it worked. One thing though: is it possible to limit the amount of soldiers you can recruit? I.E. So a player couldn't recruit like, 40 guys?

Share this post


Link to post
Share on other sites

try adding something like this to the join script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if ((count units group player) >= 10) then {hint "You already command the maximum number of men";exit}

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  

×