Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002282Zandronum[All Projects] Bugpublic2015-06-03 15:582024-03-21 15:04
ReporterPawlacz 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformMicrosoftOSWindowsOS VersionXP/Vista/7
Product Version2.0 
Target VersionFixed in Version 
Summary0002282: Ammo Switching is bugged in MP with my mod
DescriptionI tried making 2 items which "simulates" ammo cycling,
one uses Var Int User_X; which for some reason doesn't work when I host my mod on Best-Ever and TSPG-Britsteel.

Which is why I made the other Item uses only (Custom-)Inventory to achieve the same effect which works both in my dedicated server and on TSPG-Britsteel, but when the player "toys" around with the cannon and the ammo switcher all the items the player has disappears.


Mod File:'http://www73.zippyshare.com/v/7kGhrkPy/file.html [^]'
Files containing those actors:
Internal/Cannon_AmmoSwitch.txt
Weapon/75mmWeapon.txt

This bug does not happen at all on Singleplayer and works as intended.
Steps To Reproduce1. Host a dedicated server and join it.
2. Bind the "Switch Cannon Ammo" under Customize Controls.
3. Spawn as Heavy Tank.
4. select the cannon.
5. "toy" around with the fire button and the ammo switch bind.
6. select weapons manually by pushing 1 .
7. when it doesn't work type in printinv command.
8. all the Items the player has is gone.

1. zandronum -file inventory_01.wad -host
2. zandronum -file inventory_01.wad -connect localhost
3. Join the game.
4. Fire with the pistol and wait for approx. 4 seconds.
Attached Files? file icon inventory_01.wad [^] (1,754 bytes) 2015-06-07 19:16

- Relationships

-  Notes
User avatar (0012588)
unknownna (updater)
2015-06-07 19:27

It's a weird issue that seems to have something to do with the "Held" state in the inventory item that is given to the player when firing a weapon.

I'd say that this issue is caused by undefined behavior, but I could be wrong. If I remove the tic duration from the first frame in the state, Zandronum crashes.

From:
Held:
 TNT1 A 145
 TNT1 A 0 A_GiveInventory("MT_Sound_GunLoaded5")
 TNT1 A 0 A_TakeInventory("75mmReloadTime",1)
 TNT1 A 0
 stop

To:
Held:
 TNT1 A 0
 TNT1 A 0 A_GiveInventory("MT_Sound_GunLoaded5")
 TNT1 A 0 A_TakeInventory("75mmReloadTime",1)
 TNT1 A 0
 stop
User avatar (0012592)
Pawlacz (reporter)
2015-06-08 06:22
edited on: 2015-06-08 06:23

" If I remove the tic duration from the first frame in the state, Zandronum crashes."

It is because my weapon fires very fast, and I limit this speed by a inventory item. I have to do so that the player can immediately use the Coax-MG/Altfire after firing the gun.

The second reason why the weapon firing state is always 0 tic is because some of those ammo types
have a 2nd firing mode and the weapon bugs when the tic duration is larger than 0.
Like the HEAT ammo can fire a HEI shell instead

So basically if the firing state has tics larger than 0 and the player tries to
switch the weapon mode, the weapon doesn't function properly read: it is bugging.

User avatar (0012594)
unknownna (updater)
2015-06-08 15:24
edited on: 2015-06-08 15:25

Quote from Pawlacz
So basically if the firing state has tics larger than 0 and the player tries to switch the weapon mode, the weapon doesn't function properly read: it is bugging.

FYI, the mod still bugs up without switching the weapon mode, i.e., without using the MT_AmmoSwitcher actor. It all seems to boil down to the "Held" state in the 75mmReloadTime inventory item that is given to the player. Here's how it goes:

* Player fires the weapon and is given (A_Giveinventory) 75mmReloadTime.
* 75mmReloadTime goes to the "Held" state and gives (A_Giveinventory) MT_Sound_GunLoaded5 to the player before removing (A_TakeInventory) itself from the player's inventory.
* MT_Sound_GunLoaded5 goes to the "Use" state and triggers A_PlaySound before removing (A_TakeInventory) itself from the player's inventory.

For some reason the client removes all of its inventory when MT_Sound_GunLoaded5 removes itself from the player's inventory, and only when MT_Sound_GunLoaded5 is given to the player through 75mmReloadTime. Giving it directly to the player doesn't cause it to happen.

User avatar (0012598)
Pawlacz (reporter)
2015-06-08 17:22

Thanks for pin pointing the problem and the detailed explanation.

I changed the 75mmReloadTime

From:
ACTOR 75mmReloadTime : MT_A_BooleanValue
{
States
{
 Held:
 TNT1 A 145
 TNT1 A 0 A_GiveInventory("MT_Sound_GunLoaded5",1)
 TNT1 A 0 A_TakeInventory("75mmReloadTime",1)
 TNT1 A 0
 stop
}}

To:

ACTOR 75mmReloadTime : MT_A_BooleanValue
{
States
{
 Held:
 TNT1 A 145
// TNT1 A 0 A_GiveInventory("MT_Sound_GunLoaded5",1)
// TNT1 A 0 A_TakeInventory("75mmReloadTime",1)
 TNT1 A 0
 stop
}}


then I did another test by hosting a dedicated server and mashing all 4 buttons
(Fire , AltFire , Switch Cannon Mode and Switch Weapon Mode (Primary) )
and no bug is appearing.


So I need then find a other way to let the player know he can use the weapon now.
User avatar (0023450)
Ru5tK1ng (updater)
2024-03-21 15:03

In the example wad, added a 1 tic delay in the Held state before 'stop' resolved the issue of the player losing their inventory:

 Held:
 TNT1 A 145
 TNT1 A 0 A_GiveInventory("MT_Sound_GunLoaded5")
 TNT1 A 0 A_TakeInventory("75mmReloadTime",1)
 TNT1 A 1
 stop

It's just best practice to avoid using a bunch of TNT1 A 0 with actions repeatedly without a delay to avoid issues like this.

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2015-06-03 15:58 Pawlacz New Issue
2015-06-07 19:16 unknownna Status new => confirmed
2015-06-07 19:16 unknownna File Added: inventory_01.wad
2015-06-07 19:19 unknownna Steps to Reproduce Updated View Revisions
2015-06-07 19:27 unknownna Note Added: 0012588
2015-06-08 06:22 Pawlacz Note Added: 0012592
2015-06-08 06:23 Pawlacz Note Edited: 0012592 View Revisions
2015-06-08 15:24 unknownna Note Added: 0012594
2015-06-08 15:25 unknownna Note Edited: 0012594 View Revisions
2015-06-08 17:22 Pawlacz Note Added: 0012598
2024-03-21 15:03 Ru5tK1ng Note Added: 0023450
2024-03-21 15:04 Ru5tK1ng Status confirmed => closed
2024-03-21 15:04 Ru5tK1ng Resolution open => no change required






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker