Jump to content
Sign in to follow this  
Obscure CIA_Agent

AI and Ammo Crates

Recommended Posts

Hi. I have a crate with 2 shotguns (Kozlice) in it.

I want to make 2 civilians take the weapons from the crate.

How do I do this?

Thanks,

CIA

help.gif

Share this post


Link to post
Share on other sites

This receives a list of units, the ammo crate object and a position to move in relative to it. (note that this script make civs to take AK74).

Call example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[[civil1, civil2], ammocrate, [3,3]]exec"armarciviles.sqs"

Once a civil is armed, the script calls to:

[_unit]exec"movercivil.sqs"

You may change it by a simple doMove command to move the civilian anywhere else.

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

;armarciviles.sqs

cutText["Civilians: We are free! Thanks Sir\nThere should be more hostages inside", "PLAIN DOWN"]

_lista = _this select 0

_ammo = _this select 1

_posr = _this select 2

_count = count _lista

_pos = [(getPos _ammo select 0)+(_posr select 0), (getPos _ammo select 1)+(_posr select 1), 0]

"_x setBehaviour ""AWARE"";_x doMove _pos" forEach _lista

_armados = 0

#armartodos

_i = 0

#armarcivil

_unit = _lista select _i

?((_unit distance _ammo > 4) || (count weapons _unit > 0) || (!alive _unit)): goto "salto"

_unit action ["take weapon",_ammo,0,0,"AK74"]

@((count weapons _unit) > 0) || (!alive _unit)

[_unit]exec"movercivil.sqs"

_armados = _armados + 1

#salto

~3

?((_unit distance _ammo > 4)&&(count weapons _unit == 0)&&(alive _unit)): _unit doMove _pos

_i = _i + 1

?(_i < _count): goto "armarcivil"

?(_armados < _count): goto "armartodos"

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  

×