OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Black Operative on 17 Jun 2003, 19:50:20

Title: Check if unit has smoke shells left?
Post by: Black Operative on 17 Jun 2003, 19:50:20
Hi again! :)

Today I'd like to know if it's possible to check if a unit has smoke shells left in his inventory. Thanks for any answers! :)
Title: Re:Check if unit has smoke shells left?
Post by: Kaliyuga on 17 Jun 2003, 20:42:40
 You sure can... check it out:


Command :
Ammo
 
Description :
Used to check how much ammo is left in a weapon.
 
Syntax :
UnitName Ammo "WeaponName"
 
UnitName is the name of the unit you are checking
WeaponName is the name of the weapon you want to check. Check the Weapon/Ammo Type List for valid ammo types.
 
Returns :
Number of rounds remaining in the weapon.

Example :
?(MyGuy ammo "M16" == 0):aP sidechat "Reload damn it!"
 
Title: Re:Check if unit has smoke shells left?
Post by: MI_Fred on 17 Jun 2003, 21:59:21
Eh Kali can you? As a smokeshell is only a mag, not a weapon to which you have magazines, that returns 0 always. So instead, u can use:
Code: [Select]
? ({_x == "smokeshell"} count (magazines player)==0) : player globalChat "got smoke?"

right? (http://www.ofpec.com/yabbse/YaBBImages/smilies/cool2.gif)
Title: Re:Check if unit has smoke shells left?
Post by: Ace on 17 Jun 2003, 23:56:46
Quote
?(MyGuy ammo "M16" == 0):aP sidechat "Reload d**n it!"

?(MyGuy ammo "Smokeshell" >= 1):aP sidechat "I have smoke"
He's right it won't work.

But if the unit doesn't have anything elso to throw you can right:
?(MyGuy ammo "Throw" >= 1):aP sidechat "I have smoke"