Custom Weapon works in PK3 file, stops working in WAD

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Custom Weapon works in PK3 file, stops working in WAD

Postby LeeAurich » Fri Jun 04, 2021 11:39 pm

Hello everyone,

I've made a custom weapon in a separate PK3 file which I have working perfectly. It replaces the Pistol, and the player starts with the new weapon. All animations and sounds work as intended.

Now that it works fine, I'm trying to add it to my mappack I'm building which is a WAD. I copied everything over and now it doesn't work. Slot 2 is empty, even when using IDKFA, I can't switch to weapon 2 anymore. Can anyone please help to get it working in my WAD?

This is my Decorate file:

ACTOR SanctuaryGuy : PlayerPawn replaces PlayerPawn

{

Speed 1
Health 100
Radius 16
Height 56
Mass 100
PainChance 255
Player.DisplayName "Sanctuary DoomGuy"
Player.ColorRange 112, 127
Player.CrouchSprite "PLYC"
Player.StartItem "RailGun"
Player.StartItem "Fist"
Player.StartItem "Clip",100
Player.WeaponSlot 1, Chainsaw, Fist
Player.WeaponSlot 2, RailGun
Player.WeaponSlot 3, SuperShotgun, Shotgun
Player.WeaponSlot 4, Chaingun
Player.WeaponSlot 5, RocketLauncher
Player.WeaponSlot 6, PlasmaRifle
Player.WeaponSlot 7, BFG9000

States
{
Spawn:
PLAY A -1
Loop
See:
PLAY ABCD 4
Loop
Missile:
PLAY E 12
Goto Spawn
Melee:
PLAY F 6 BRIGHT
Goto Missile
Pain:
PLAY G 4
PLAY G 4 A_Pain
Goto Spawn
Death:
PLAY H 0 A_PlayerSkinCheck("AltSkinDeath")
Death1:
PLAY H 10
PLAY I 10 A_PlayerScream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
Stop
XDeath:
PLAY O 0 A_PlayerSkinCheck("AltSkinXDeath")
XDeath1:
PLAY O 5
PLAY P 5 A_XScream
PLAY Q 5 A_NoBlocking
PLAY RSTUV 5
PLAY W -1
Stop
AltSkinDeath:
PLAY H 6
PLAY I 6 A_PlayerScream
PLAY JK 6
PLAY L 6 A_NoBlocking
PLAY MNO 6
PLAY P -1
Stop
AltSkinXDeath:
PLAY Q 5 A_PlayerScream
PLAY R 0 A_NoBlocking
PLAY R 5 A_SkullPop
PLAY STUVWX 5
PLAY Y -1
Stop
}
}

ACTOR RailGun : Doomweapon replaces Pistol

{

Inventory.PickupMessage "A railgun? Slow, but powerful!"
Weapon.SelectionOrder 1900
Weapon.AmmoGive1 100
Weapon.AmmoType "Clip"
Weapon.AmmoUse 10
Weapon.SlotNumber 2
Weapon.MinSelectionAmmo1 10
Weapon.KickBack 80
AttackSound "weapons/railgun"
Tag "$TAG_RAILGUN"

States

{

Ready:
RLGN A 1 A_WeaponReady
Loop
Select:
RLGN A 1 A_Raise
Loop
Deselect:
RLGN A 1 A_Lower
Loop
Fire:
RLGN A 0 A_GunFlash
RLGN A 1 A_FireBullets(0.1, 0.1, 1, 75, "BulletPuff", 1)
RLGN B 3
RLGN C 3 Offset(0,48)
RLGN D 3 Offset(0,48)
RLGN B 3 Offset(0,40)
RLGN B 10
RLGN A 6
RLGN E 10
RLGN F 3 Offset(0,40)
RLGN F 3 Offset(0,36)
RLGN F 4
RLGN A 3 Offset(0,40)
RLGN A 3 Offset(0,36)
RLGN A 10
Goto Ready
Flash:
RLGN B 3 Bright A_Light2
RLGN C 3 BRIGHT A_Light1
RLGN D 3 BRIGHT A_Light2
TNT1 A 1 A_Light0
Goto LightDone

}

}
LeeAurich
 
Joined: 05 Jun 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom Weapon works in PK3 file, stops working in WAD

Postby Jarewill » Sat Jun 05, 2021 2:38 am

Without seeing the wad it's hard to tell.
Is the file named DECORATE?
Is the player class changed in MAPINFO?
Code: Select allExpand view
GameInfo
{
    PlayerClasses = "SanctuaryGuy"
}

Are the sprites between S_START and S_END?
In a .wad file the sprites only work if they are between S_START and S_END markers.
They can be empty files just named that between the sprites.

Would be helpful if you could upload your wad somewhere so that people can take a look at it.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Custom Weapon works in PK3 file, stops working in WAD

Postby LeeAurich » Sat Jun 05, 2021 9:28 am

Fixed the problem. The issue was the sprites not being between SS_Start and SS_End. I had the column sorted alphabetically in Slade and couldn't figure out how to return it to being sorted non-alphabetically, so I couldn't move the files around!

For anyone who might find this in the future and has the same issue. Click the header a couple of times to unsort the column, then you can move the files between SS_Start and SS_End.

I now have a new issue though. The Weapon is working fine, but I can't place it in the map in Doombuilder. I've updated the code in the WAD so it no longer replaces the starter Pistol, but is instead a separate new weapon in the same slot. I can't place it as an item in the map though. It doesn't show up in the things list, and if I type the ID number in there, it just shows up as a yellow exclamation mark when testing the map.

Code: Select allExpand view
ACTOR SanctuaryGuy : DoomPlayer replaces DoomPlayer

{
 
  Speed 1
  Health 100
  Radius 16
  Height 56
  Mass 100
  PainChance 255
  Player.DisplayName "SanctuaryGuy"
  Player.ColorRange 112, 127
  Player.CrouchSprite "PLYC"
  Player.StartItem "Pistol"
  Player.StartItem "Fist"
  Player.StartItem "Clip",100
  Player.WeaponSlot 1, Chainsaw, Fist
  Player.WeaponSlot 2, RailGun, Pistol
  Player.WeaponSlot 3, SuperShotgun, Shotgun
  Player.WeaponSlot 4, Chaingun
  Player.WeaponSlot 5, RocketLauncher
  Player.WeaponSlot 6, PlasmaRifle
  Player.WeaponSlot 7, BFG9000
 
  States
  {
  Spawn:
    PLAY A -1
    Loop
  See:
    PLAY ABCD 4
    Loop
  Missile:
    PLAY E 12
    Goto Spawn
  Melee:
    PLAY F 6 BRIGHT
    Goto Missile
  Pain:
    PLAY G 4
    PLAY G 4 A_Pain
    Goto Spawn
  Death:
    PLAY H 0 A_PlayerSkinCheck("AltSkinDeath")
  Death1:
    PLAY H 10
    PLAY I 10 A_PlayerScream
    PLAY J 10 A_NoBlocking
    PLAY KLM 10
    PLAY N -1
    Stop
  XDeath:
    PLAY O 0 A_PlayerSkinCheck("AltSkinXDeath")
  XDeath1:
    PLAY O 5
    PLAY P 5 A_XScream
    PLAY Q 5 A_NoBlocking
    PLAY RSTUV 5
    PLAY W -1
    Stop
  AltSkinDeath:
    PLAY H 6
    PLAY I 6 A_PlayerScream
    PLAY JK 6
    PLAY L 6 A_NoBlocking
    PLAY MNO 6
    PLAY P -1
    Stop
  AltSkinXDeath:
    PLAY Q 5 A_PlayerScream
    PLAY R 0 A_NoBlocking
    PLAY R 5 A_SkullPop
    PLAY STUVWX 5
    PLAY Y -1
    Stop
  }
}

ACTOR RailGun : DoomWeapon 5757

{

  Inventory.PickupMessage "A Railgun! Slow, Powerful and Piercing"
  Weapon.SelectionOrder 800
  Weapon.AmmoGive1 100
  Weapon.AmmoType "Clip"
  Weapon.AmmoUse 10
  Weapon.SlotNumber 2
  Weapon.MinSelectionAmmo1 10
  Weapon.KickBack 80
  AttackSound "weapons/railgun"
 
States

  {
 
  Ready:
  RLGN A 1 A_WeaponReady
  Loop
  Select:
  RLGN A 1 A_Raise
  Loop
  Deselect:
  RLGN A 1 A_Lower
  Loop
  Fire:
  RLGN A 0 A_GunFlash
  RLGN A 1 A_FireBullets(0.1, 0.1, 1, 120, "BulletPuff", 1)
  TNT1 A 0 A_RailAttack(60, 0, 0, "none", "none", RGF_SILENT)
  RLGN B 3
  RLGN C 3 Offset(0,48)
  RLGN D 3 Offset(0,48)
  RLGN B 3 Offset(0,40)
  RLGN B 10
  RLGN A 6
  RLGN E 10
  RLGN F 3 Offset(0,40)
  RLGN F 3 Offset(0,36)
  RLGN F 4
  RLGN A 3 Offset(0,40)
  RLGN A 3 Offset(0,36)
  RLGN A 20
  Goto Ready
  Flash:
  RLGN B 3 Bright A_Light2
  RLGN C 3 BRIGHT A_Light1
  RLGN D 3 BRIGHT A_Light2
  TNT1 A 1 A_Light0
  Goto LightDone
  Spawn:
  RAIL A -1
  Loop
 
  }
 
}
LeeAurich
 
Joined: 05 Jun 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom Weapon works in PK3 file, stops working in WAD

Postby Jarewill » Sat Jun 05, 2021 11:05 am

That happens if there's no Spawn sprite for the actor. Are you sure your weapon's spawn sprite is called RAIL?
Even if it doesn't show up in the thing list, it should still work by placing it down manually with it's ID and when I copied the code it worked fine.
The only thing I can think of is that the RAIL sprite is missing.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Custom Weapon works in PK3 file, stops working in WAD

Postby LeeAurich » Sat Jun 05, 2021 9:05 pm

It's definitely there:

https://i.imgur.com/RpVFsgm.png

I think I've placed it correctly in doombuilder:

https://i.imgur.com/Zsk8Xks.png

I'm assuming "type" is where I put the ID# as it's the only place I can find to put it. But when testing it still just shows as an exclamation which I can't pick up.

Edit: Figured it out after submitting this, had to wait for it to be approved so I could add this edit. I had the texture just named "RAIL", forgetting it needed to be named "RAILA0". Renamed it, and it's working fine now.
LeeAurich
 
Joined: 05 Jun 2021
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom Weapon works in PK3 file, stops working in WAD

Postby ramon.dexter » Mon Jun 07, 2021 12:20 am

The sprite is called RAIL. this is not a complete name of a sprite for the engine to recognize it as a proper sprite. You need to add a frame name and an angle.

Edit: for better understanding, don't refer the sprite graphics as a texture. It's a sprite, and should be referred only as a sprite. A texture is little bit different kind of graphic. Mixing these two names together would bring lot of confusion.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: Hidden Hands and 0 guests