Jump to content
Sign in to follow this  
frankie2spankie

Ordering unit to take weapon

Recommended Posts

ok guys

basically wot ive done is ive created a trigger which checks to see if a LAW soldier is dead.

If he is, i want the group leader to tell a unit to take the LAW from him.

What is the command to take a weapon?

Share this post


Link to post
Share on other sites

BOB is a LAW soldier

BOB die

JIM is the soldier i want to take the LAW launcher from the dead BOB

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">JIM action ["Take Weapon", BOB, 0,0, "LAWLauncher"]

This will work in a trigger

JIM will drop on his knees to get the LAW launcher , and will stand up with it on his shoulder.

Only problem : JIM will no run to BOB corpse , he will just drop on his knees to grab the LAW launcher where he is actually at the trigger activation and the LAW Launcher will be teleported from BOB location to JIM location by magic.

There is certainly a solution in the trigger , to have it activated when JIM is near BOB (after ordering JIM to go to BOB position), but i have no time to search actually.

I hope this will help.

Share this post


Link to post
Share on other sites

Something like

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

;;exec with [soldier,lawsoldier] exec "script.sqs"

;;basicly name 1 guy that doesn't have a law, soldier, and one that does, lawsoldier.

_man = _this select 0

_manwith = _this select 1

#loop

~1

?!alive _manwith : goto "continue"

goto "loop"

#continue

_man domove getpos _manwith

@_man distance _manwith <3

_man RemoveMagazines "Handgrenade"

_man action ["Take Weapon", _manwith, 0,0, "LAWLauncher"]

exit

There, that works, tested.

Share this post


Link to post
Share on other sites

Just as good scripting practice though, you should throw in a way for the script to end if the guy whom is supposed to pick up the law dies. Otherwise, the script will run forever:

;;exec with [soldier,lawsoldier] exec "script.sqs"

;;basicly name 1 guy that doesn't have a law, soldier, and one that does, lawsoldier.

_man = _this select 0

_manwith = _this select 1

#loop

~1

?!alive _manwith : goto "continue"

? alive _man : goto "loop"

exit

#continue

_man domove getpos _manwith

@_man distance _manwith <3 || !(alive _man)

? !(alive _man) : exit

_man RemoveMagazines "Handgrenade"

_man action ["Take Weapon", _manwith, 0,0, "LAWLauncher"]

exit

Share this post


Link to post
Share on other sites

What is the || i see in some scripts, does it do the same thing OR does?

Share this post


Link to post
Share on other sites

I believe the word TAKEWEAPON should be in this thread for searching purposes even though it is wrong.

Share this post


Link to post
Share on other sites
Don't forget to check ammo of LAW before take weapon

I can't count properly how many ammo (law rocket) left .

script check dead lawsoldiers nearby

---------------------------------------------------

_man = objnull

_man = nearestObject [player, "SoldierWLAW"]

?(!Isnull _man and !alive _man): _num = _man ammo "LAWlauncher"; hint format ["%1 ammo left", _num]

---------------------------------------------------

I allways got 1 value even if I know the LAWsoldier has all 3 rockets.

sad_o.gif

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  

×