Page 1 of 1

Weapon won't register as ammo in multiplayer only

Posted: Tue Sep 29, 2015 3:01 am
by Death Egg
Okay, this is a strange issue I'm having, and I have no idea what's causing it. I have a DECORATE code to make it so each class has their own separate weapons in multiplayer. It works perfectly fine in every aspect except that if the class already has a weapon and they try to pick up another as ammo, it won't pick up. The weird thing is, it's completely fine in single player, everything works exactly as it's supposed to. I searched the DMFlags but didn't notice one that would cause this behavior to happen. Is this a bug or am I missing something? I'm not exactly DECORATE-savvy.

Code: Select all

actor ChainsawDrop replaces Chainsaw
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("1ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("2ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("3ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("4ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("5ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("6ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("7ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("8ChainsawSpawner")
		TNT1 A 0 A_SpawnItemEx("9ChainsawSpawner")
		Stop
	}
}

actor 1ChainsawSpawner : RandomSpawner
{
	DropItem "1Chainsaw"
}

actor 2ChainsawSpawner : RandomSpawner
{
	DropItem "2Chainsaw"
}
actor 3ChainsawSpawner : RandomSpawner
{
	DropItem "3Chainsaw"
}

actor 4ChainsawSpawner : RandomSpawner
{
	DropItem "4Chainsaw"
}

actor 5ChainsawSpawner : RandomSpawner
{
	DropItem "5Chainsaw"
}

actor 6ChainsawSpawner : RandomSpawner
{
	DropItem "6Chainsaw"
}

actor 7ChainsawSpawner : RandomSpawner
{
	DropItem "7Chainsaw"
}

actor 8ChainsawSpawner : RandomSpawner
{
	DropItem "8Chainsaw"
}

actor 9ChainsawSpawner : RandomSpawner
{
	DropItem "9Chainsaw"
}

RE: Weapon won't register as ammo in multiplayer only

Posted: Tue Sep 29, 2015 3:10 am
by Ænima
It might help to see the code for 1chainsaw, 2chaimsaw, etc. What kind of ammo?

RE: Weapon won't register as ammo in multiplayer only

Posted: Tue Sep 29, 2015 3:15 am
by Arctangent
If weapon stay is on, classes can only pick up their own weapons, because if they could pick up weapons of other classes then they could just walk over one of said weapons and get full ammo from it instant, since the weapon would stay but the player would still be picking up the ammo.

... Also, what's even the point of the RandomSpawners? Why not just A_SpawnItemEx the weapons directly?

RE: Weapon won't register as ammo in multiplayer only

Posted: Tue Sep 29, 2015 3:16 am
by Death Egg
Chainsaw was probably a bad example. Here's code for the shotgun, which is the thing that pretty much relies on picking up more shotguns for ammo:

Code: Select all

ACTOR 2Shotgun : DoomWeapon
{
	Game Doom
	SpawnID 27
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse 1
	Weapon.AmmoGive 8
	Weapon.AmmoType "Shell"
	Inventory.PickupMessage "dang nice!!!!"
	Obituary "$OB_MPSHOTGUN"
	Tag "$TAG_SHOTGUN"
	VisibleToPlayerClass "Sonic"
	Inventory.RestrictedTo "Sonic"
	+INVENTORY.RESTRICTABSOLUTELY
	States
	{
	Ready:
		SHTG A 1 A_WeaponReady
		Loop
	Deselect:
		SHTG A 1 A_Lower
		Loop
	Select:
		SHTG A 1 A_Raise
		Loop
	Fire:
		SHTG A 3
		SHTG A 7 A_FireShotgun
		SHTG BC 5
		SHTG D 4
		SHTG CB 5
		SHTG A 3
		SHTG A 7 A_ReFire
		Goto Ready
	Flash:
		SHTF A 4 Bright A_Light1
		SHTF B 3 Bright A_Light2
		Goto LightDone
	Spawn:
		SHOT A -1
		Stop
	}
}
As it stands, since the mod is in the early stages, all of them are the same as this one minus the number at the beginning. It's pretty much just a copy paste of the normal shotgun DECORATE right now. (Also the little pickup message was changed for testing)
Arctangent wrote: If weapon stay is on, classes can only pick up their own weapons, because if they could pick up weapons of other classes then they could just walk over one of said weapons and get full ammo from it instant, since the weapon would stay but the player would still be picking up the ammo.
It should be letting them pick up copies of their own weapon for ammo each time though. There isn't separate ammo for each class, just different weapons.
... Also, what's even the point of the RandomSpawners? Why not just A_SpawnItemEx the weapons directly?
A very good point. I used code (with permission) from another mod that used random spawners. Heh. I'm not great at coding.

EDIT: Everything works perfectly fine now that I got rid of the RandomSpawner thing. That's alright with me.

RE: Weapon won't register as ammo in multiplayer only

Posted: Mon Oct 05, 2015 3:03 pm
by Popsoap
Arctangent wrote: ... Also, what's even the point of the RandomSpawners? Why not just A_SpawnItemEx the weapons directly?
If I recall correctly, using a RandomSpawner makes the pickup act as if it was placed on the map (Obeys "Weapons Stay" and "Item Respawn" flags).