Page 1 of 1

Add IObjectWeaponItem.MaxAmmo and IObjectWeaponItem.CurrentAmmo

Posted: Mon Mar 23, 2020 6:41 am
by NearHuscarl
I'm writing a modified version of the whip weapon for a boss that can retrieve the weapon the enemy is holding back to the them on every hit. The boss then will decide whether to equip the new weapon or not by comparing with the current weapon type and ammo. There is no way to tell how much ammo an IObjectWeaponItem has at the moment.

IObjectWeaponItem.MaxAmmo and IObjectWeaponItem.CurrentAmmo will have different meanings depend on the IObjectWeaponItem.WeaponItemType:

If it's a melee weapon, CurrentAmmo and MaxAmmo will be the durability of that weapon
If it's a rifle or handgun, CurrentAmmo and MaxAmmo will be the ammo of that weapon
If it's a throwable weapon, CurrentAmmo and MaxAmmo will be the number of the throwable items
If it's a powerup, CurrentAmmo and MaxAmmo will always be 0

Both values are float because the largest floating point precision type is durability which use float.

Re: Add IObjectWeaponItem.MaxAmmo and IObjectWeaponItem.CurrentAmmo

Posted: Sun Apr 26, 2020 1:06 pm
by Gurt
Added after v.1.3.5:
ScriptAPI: Added IObjectWeaponItem.GetCurrentAmmo(), IObjectWeaponItem.GetMaxAmmo() which returns current ammo for the item. Read documentation for details what it means for different weapon types.

IObjectWeaponItem:
► Show Spoiler
ScriptAPI: Added properties to read current ammo and max ammo for RangedWeaponItem, RifleWeaponItem, HandgunWeaponItem, MeleeWeaponItem, ThrownWeaponItem and PowerupWeaponItem.