1
OXCE Support Y-scripts / [problem] Strange behavior of damaging_item.setAmmoQuantity in hitUnit script
« on: December 20, 2024, 02:12:22 pm »
I have a certain number of guns that can only fire with aimed or snap shots. I made a skill that enables to use this weapon in automatic firing. For this weapon I have set the number of shots when firing automatically to 1 (via “autoShots: 1”). Now in the script “hitUnit” I handle a hit from this weapon on the target and I want that after this shot the number of shots is equal to zero. I use the function “damaging_item.setAmmoQuantity 0;”, but it doesn't work properly - after the script finishes, the weapon has one shot left instead of zero.
For example, I have a weapon in which there are three shots, I activate the skill and shoot, while the bullet flies it can be seen that the number of shots in the weapon became equal to two. Then there is a hit on the target and the script “hitUnit” starts working, the function “damaging_item.setAmmoQuantity 0;” is executed and I see that the weapon now has one shot instead of zero.
I tried using “damaging_item.setAmmoQuantity -1;” but the result is the same - one shot remains.
For example, I have a weapon in which there are three shots, I activate the skill and shoot, while the bullet flies it can be seen that the number of shots in the weapon became equal to two. Then there is a hit on the target and the script “hitUnit” starts working, the function “damaging_item.setAmmoQuantity 0;” is executed and I see that the weapon now has one shot instead of zero.
I tried using “damaging_item.setAmmoQuantity -1;” but the result is the same - one shot remains.