View Full Version : Detect wearing weapon

Feb 14 2006, 14:09
I'm trying to make a side vs side MP mission, where you have the choice to surrender, wich meaning the loose their weapon, and also becomes captive so AI soldiers doesn't shoot you. But, I wanna do so that if you pick up a weapon you're not a captive anymore (set by setCaptive false) so that AI will open fire at you again, if you steal a dead guys weapon.
Can it be detected by triggers or easy script when carrying a weapon (maybe that carrying a weapon means "this setCaptive false") or something?

Darn, I hate that OFPEC is down http://forums.bistudio.com/oldsmileys/confused_o.gif

Feb 14 2006, 14:21
The weapons command will return an array of all the weapons carried by a unit - you could have a trigger fire when this array is not empty.  Alternatively primaryWeapon is another command that will return a string giving the name of the primary weapon carried by a unit.   The trigger could fire whenever this is not = ""

Quote[/b] ]Darn, I hate that OFPEC is down Me too.

Feb 15 2006, 15:17
Uhmm. I don't really understand that.
Could you explain a little more?

Thanks for helping anyways http://forums.bistudio.com/oldsmileys/smile_o.gif

Feb 15 2006, 16:01
Well I am on holiday and so am away from my games computer and ofpec is down so I can't check their comref. So from memory try something like:

@<hidden> (weapons unitname &#33;= [])


@<hidden> (unitname primaryWeapon &#33;= "")

It may be a load of crap but it is worth experimenting with.

Feb 15 2006, 16:14
This is what I have in trigger for one of my missions, it will detect if unit POW has ANY weapons or ANY magazines (incl. Hand Grenades, Satchels, Smokes, etc.) in their inventory.

Condition: ((count (weapons pow)) > 0) or ((count (magazines pow)) > 0)

On Activation: pow setcaptive false

Works great for me.

Feb 15 2006, 16:31
Count&#33;&#33; That&#39;s it&#33;&#33; I was forgetting. Weapons unitname gives you an array of the weapons carried by the unit. Count weapons unitname will count how many wepaons the guy has.