Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
I'm working on two mods - one single player, another multi-player. This question applies to the latter.
I notice one gripe I found when testing the MP mod in the past was someone and myself wanted different sprites based on the particular weapon or ability they were using.
Since the mod is more cartoony, the player pawns whip the weapon out of "hammerspace" if you will. Basically they don't walk around with the weapon, merely it shows up in their hands when they use it (as in, when they are attacking).
My problem is not the sprite designing itself - either editing from a base or from scratch in Flash or Photoshop. It's the coding. My current method isn't working well.
The theory is when a player selects a certain weapon, the player is given an inventory "flag", if you will, that basically indicates they are holding, in this case SSBFUsingGun1. The name is generic so I can reuse it across the various classes. The problem is it's not rendering the correct sprites, it's showing the "failsafe" Missile or Melee. At least as far as I can tell, testing this has been difficult with me alone.
Allow me to show some example code. Keep in mind my mods aren't typical ZDoom/Skulltag fare
Spoiler:
The Weapon Indicating Code, given upon selecting corresponding weapon slot.
actor SSBFMarioPlunger : Weapon
{
Weapon.Kickback 0
Weapon.SelectionOrder 300
Obituary "%k > PLUNGER'D > %o."
Inventory.Icon "GUNMAR_3"
+WEAPON.MELEEWEAPON
+WEAPON.WIMPY_WEAPON
States
{
Ready:
PLNG A 1 A_WeaponReady
loop
Deselect:
PLNG A 0 A_TakeInventory("SSBFUsingGun3", 255) // I think this is only taking the inventory to the weapon itself, I could be wrong.
PLNG A 1 A_Lower
goto Deselect+1
Select:
PLNG A 0 A_GiveInventory("SSBFUsingGun3", 1) // Same as above, but giving instead of taking.
PLNG A 1 A_Raise
goto Select+1
Fire:
PLNG B 2
PLNG C 2
PLNG D 3 A_Punch
PLNG C 2
PLNG C 6 A_ReFire
goto Ready
}
}
actor SSBFMario : PlayerPawn
{
Player.ScoreIcon "MUSHICON"
Player.ForwardMove 0.65
player.SideMove 0.75
Speed 1
Health 150
Radius 16
Height 56
Mass 150
scale 0.5
PainChance 255
Player.ColorRange 112, 127
Player.DisplayName "Mario"
Player.SoundClass "mario"
Player.StartItem "SSBFMarioFireflower"
Player.StartItem "SSBFMarioZapper"
Player.StartItem "SSBFMarioPlunger"
Player.StartItem "SSBFFireBallAmmo", 120 //Primary
Player.StartItem "SSBFZapperAmmo", 75 //Secondary
Player.StartItem "SSBFArmorMario"
Player.WeaponSlot 1, SSBFMarioFireflower
Player.WeaponSlot 2, SSBFMarioZapper
Player.WeaponSlot 3, SSBFMarioPlunger
+NOBLOOD
States
{
Spawn:
MRIO A -1
Loop
See:
MRIO ABCD 6
Loop
Melee:
Missile:
// The code where the magic is supposed to happen.
MRIO A 0 A_JumpIfInventory("SSBFUsingGun1", 1, "Missile.FireFlower")
MRIO A 0 A_JumpIfInventory("SSBFUsingGun2", 1, "Missile.NESZapper")
MRIO A 0 A_JumpIfInventory("SSBFUsingGun3", 1, "Melee.Plunger")
// Fall through if default (Failsafe)
Missile.FireFlower:
MRIO F 12 bright
Goto Spawn
Missile.NESZapper:
MRIO H 12 bright
Goto Spawn
Melee.Plunger:
MRIO J 12
Goto Spawn
Pain:
MRIO K 4
MRIO K 4 A_Pain
Goto Spawn
Death:
MRIO KL 10
MRIO M 10 A_PlayerScream
MRIO NO 10 A_NoBlocking
MRIO N 0 // A_SpawnItemEx("BFCDroppedBackpack")
MRIO P -1
Stop
}
}
Yeah. I'm having a hard time, although It's not of urgency to fix this. This isn't "necessary" except for aesthetic purposes.
I might make a project topic soon, but I post this here because in general I've had trouble with giving inventory flags to the player through weapons, and I figure if I solve this, it could benefit others.
I wouldn't know how to solve your problem, but this guy might. He seems to be doing something similar to what you want to do, though in a different manner.