Jump to content
Sign in to follow this  
Sniperwolf572

Detecting weapons

Recommended Posts

OK, searched and only thing I found is how to detect if unit has a specific weapon, but I need to check if a unit has ANY weapon, including primary, secondary, pistol, NV's, binocs.

Simple story short, it's an MP mission, one of the players is POW, others are rescuers, now POW is standing next to a chair and if he moves away from it 10m in distance is no longer captive, now, if other player shoots a guy that is guarding the POW (There are multiple guards), the POW can get a weapon, but he is still in 10m radius of the chair, and can shoot other guards without them considering POW hostile, and I want to check if unit has any weapon to switch the "pow captive true" to false.

It would be easy if the POW had a defined location, I could check only for weapons of guards that are in 10m radius, but the location is random every time the mission is played, so there are about 3 dozens of weapons the POW can aquire, including the whole weapon selection of the friendly units.

I tried with pow hasweapon "any", but it didn't work. confused_o.gif

Please help. help.gif

Share this post


Link to post
Share on other sites

Hey, sniperwolf.

Try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?((count (weapons unitname)) > 0) : unitname setCaptive false

Weapons unitname returns an array of ALL weapons on the unit, like so: ["AK74", "Beretta", "Binocular", "NVGoggles"]

Count returns the number of elements in an array, in this case, the number of weapons.

Hope this helps.

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  

×