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.
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Add IObjectWeaponItem.MaxAmmo and IObjectWeaponItem.CurrentAmmo
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
- Superfighter
- Posts: 97
- Joined: Thu Feb 07, 2019 4:36 am
- Gurt
- Lead Programmer
- Posts: 1884
- Joined: Sun Feb 28, 2016 3:22 pm
- Title: Lead programmer
- Started SFD: Made it!
- Location: Sweden
- Gender:
- Age: 34
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:
ScriptAPI: Added properties to read current ammo and max ammo for RangedWeaponItem, RifleWeaponItem, HandgunWeaponItem, MeleeWeaponItem, ThrownWeaponItem and PowerupWeaponItem.
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
0 x
Gurt