MantisBT - Soldat Dedicated Server
View Issue Details
0000616Soldat Dedicated ServerScripting Corepublic2015-06-10 09:282016-03-15 01:27
deguix 
 
normalminoralways
confirmedopen 
amd64Debian GNU/Linux7.0
2.7.9b1 
 
0000616: TPlayer.ForceWeapon reloads secondary whenever its ammo is set to 0
I was trying to make force weapon to jam the primary weapon artificially (by setting its ammo to 0 every second with TGame.OnClockTick), but whenever I do that after the secondary weapon is reloading, that secondary weapon is automatically fully reloaded.

The "workaround" is to save that ammo in another variable, and whenever weapons are switched again, use it, and save the new one in this one, and then do another force weapon, but then the weapon will starting reloading from the beginning if its ammo is 0, which is what I don't want.

(I didn't test with 2.7.8, but it should be there too)
Use the script as in http://wiki.soldat.pl/index.php/TActivePlayer.ForceWeapon, [^] except set NewSecondary.WType to an actual weapon id (like 1 for deagles).
Historically with ScriptCore 2 ForceWeapon, 0 meant "max ammo" for primary, but it shouldn't. 255 should be "max ammo" instead, and 0 should make it stay in reloading state. Preferably there should also be another variable for the reloading percentage, but I think that's pushing it.
No tags attached.
Issue History
2015-06-10 09:28deguixNew Issue
2015-06-11 01:41deguixNote Added: 0002470
2016-03-15 01:27FalconStatusnew => confirmed

Notes
(0002470)
deguix   
2015-06-11 01:41   
Setting ammo to 255 when weapon can't store that much will make it set it to 0 right now, which does what I need (currently)... but it's still very weird, and it won't work if a weapon has 255 bullets.