[DECORATE] Replacing Default Doom Weapons

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
anhydrophobic
Posts: 3
Joined: Sun Jun 17, 2018 8:48 pm

[DECORATE] Replacing Default Doom Weapons

Post by anhydrophobic »

Hello everyone,

I am attempting to create a complete weapon replacement for doom guy which involves overwriting the default weapon classes 'Fist', 'Shotgun', 'SuperShotgun' etc.

This is specifically meant for Zdoom 2.7.1 and newer, I have no intent of using the GZdoom and QZdoom forks.

I have defined a new "DoomPlayer" class as follows (Note: I am aware that I dont need to replace the entire DoomPlayer class, I am simply testing all available options to figure out a solution.)

Code: Select all

ACTOR TalviGuy : DoomPlayer replaces DoomPlayer
{
  Speed 1
  Health 250
  Radius 16
  Height 56
  Mass 100
  PainChance 255
  Player.DisplayName "TalviGuy"
  Player.ColorRange 112, 127
  Player.CrouchSprite "PLYC"
  Player.StartItem "TalvisotaChaingun"
  Player.StartItem "PerkFist"
  Player.StartItem "Clip", 200
  Player.WeaponSlot 1, "TalvisotaChainsaw", "PerkFist"
  Player.WeaponSlot 2, "TalvisotaChaingun"
  Player.WeaponSlot 3, "TalvisotaSuperShotgun", "TalvisotaShotgun"
  Player.WeaponSlot 4, "TalvisotaShotgunChaingun"
  Player.WeaponSlot 5, "TalvisotaElectroMagneticGun"
  Player.WeaponSlot 6, "TalvisotaExplosiveTipRifle"
  Player.WeaponSlot 7, "TalvisotaBFGOmegaX"
}

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
  }
}

and an example of a fist weapon class that I would like to replace with is "PerkFist."

Code: Select all

ACTOR PerkFist : Fist replaces Fist
{
Game Doom
  Weapon.SelectionOrder 3700
  Weapon.Kickback 100
  Weapon.SlotNumber 1
  Inventory.PickupMessage "You Learned CQC!!!"
  +WEAPON.MELEEWEAPON
  Weapon.AmmoType "Stamina"
  Weapon.AmmoGive 100
  +AMMO_OPTIONAL
States
  {
  Spawn:
    FIST P -1
    Loop
  Ready:
    PUCH A 0 A_JumpIfInventory("StamGen",5,3)
    PUCH A 0 A_GiveInventory("StamGen",2)
    PUCH A 1 a_weaponready
    loop
    PUCH A 0 A_TakeInventory("StamGen",5)
    PUCH A 0 A_JumpIfInventory("Stamina",100,2)
    PUCH A 0 A_GiveInventory("Stamina",2)
    PUCH A 1 a_weaponready	
    loop
  Deselect:
    PUCH A 1 A_Lower
    loop
  Select: 
    PUCH A 1 A_Raise
    loop
  Fire:
    PUCH A 0 A_JumpIfInventory("Stamina",5,1)
    goto Ready
    PUCH A 0 A_JumpIfInventory("FistToken", 1, "LeftPunch")
    PUCH A 3 A_Playsound ("FIST/SWING")
    PUCH B 2
    PUCH L 2 A_Punch
    PUCH L 0 A_Punch
    PUCH L 0 A_Punch   
    PUCH C 2
    PUCH M 2
    PUCH D 2
    PUCH N 2
    PUCH E 2
    PUCH R 2
    PUCH R 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_GiveInventory("FistToken",1)
    PUCH K 3 A_ReFire  	
    goto Ready
    LeftPunch:
    PUCH F 3 A_Playsound ("FIST/SWING")
    PUCH G 2
    PUCH O 2 A_Punch
    PUCH O 0 A_Punch
    PUCH O 0 A_Punch
    PUCH H 2
    PUCH P 2
    PUCH I 2
    PUCH Q 2
    PUCH J 2
    PUCH K 0 A_TakeInventory("Stamina",1)
    PUCH K 0 A_TakeInventory("FistToken",1) 
    PUCH K 3 A_ReFire  	
    goto Ready 
  Altfire:
    PUCH K 0 A_JumpIfInventory("Stamina",10,1)
    goto Ready
    PUCH K 2 A_Playsound ("FIST/SWING")
    MLEG A 2
    MLEG B 2 
    MLEG C 2 A_Punch
    MLEG C 0 A_Punch
    MLEG C 0 A_Punch
    MLEG C 0 A_Punch
    MLEG C 0 A_Punch
    MLEG D 2
    MLEG E 2
    MLEG F 2
    MLEG G 2
    MLEG H 2
    PUCH K 0 A_TakeInventory("Stamina",10)
    PUCH K 4 A_ReFire
    goto Ready    
  } 
}

actor Stamina : Ammo
{
	Inventory.MaxAmount 100
}

actor StamGen: Ammo 
{
	Inventory.MaxAmount 5
}

actor FistToken: Ammo 
{
	Inventory.MaxAmount 1
}
The code is functional, however when I startup my mod, I am given the original Doom Fist class. When I activate cheats (such as idfa) I am given the PerkFist class weapon.

I've scoured Zdoom and Doomworld and so far my research has concluded that I need to define my new player class in a lump (which is now depreciated) entitled "KEYCONF" for my new player class that doesnt yield the original doom weapons.

What is the proper way to go about this for the engine Zdoom 2.7.1 and its newer deviations?

Any help is appreciated.

Thank you.
User avatar
R4L
Global Moderator
Posts: 404
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: [DECORATE] Replacing Default Doom Weapons

Post by R4L »

Try this:

Code: Select all

ACTOR TalviGuy : PlayerPawn
{
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [DECORATE] Replacing Default Doom Weapons

Post by Graf Zahl »

No, don't try that. Inheriting from PlayerPawn will require a complete redefinition of the entire player.
The problem looks to be that the game needs to be told to use this new player class. "Replaces" is only relevant for map spawns but will not cause the player to be replaced.
anhydrophobic
Posts: 3
Joined: Sun Jun 17, 2018 8:48 pm

Re: [DECORATE] Replacing Default Doom Weapons

Post by anhydrophobic »

Graf Zahl wrote: The problem looks to be that the game needs to be told to use this new player class.
Hello, how do I go about performing that?

My only research is to declare the new player class in the KEYCONF lump which is depreciated.

What is the new method of declaring the new player class so that the player may have its own assigned weapons?

Thank you.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: [DECORATE] Replacing Default Doom Weapons

Post by wildweasel »

With a ZDoom version as old as that, Keyconf may be your only option, as I forget if the Mapinfo method existed back then. You're welcome to try it, though: https://zdoom.org/wiki/Creating_new_player_classes
anhydrophobic
Posts: 3
Joined: Sun Jun 17, 2018 8:48 pm

Re: [DECORATE] Replacing Default Doom Weapons

Post by anhydrophobic »

https://zdoom.org/wiki/Weapon_slots

Just to verify after testing, both KEYCONF and defining the method 'gameinfo' (or a directory pointing to the method gameinfo) in the MAPINFO lump work for Zdoom 2.7.1.

For KEYCONF

Code: Select all

clearplayerclasses

addplayerclass TalviGuy
For MAPINFO

Code: Select all

gameinfo
{
	weaponslot = 1, "TalvisotaChainsaw", "PerkFist"
	weaponslot = 2, "TalvisotaChaingun"
	weaponslot = 3, "TalvisotaSuperShotgun", "TalvisotaShotgun"
	weaponslot = 4, "TalvisotaShotgunChaingun"
	weaponslot = 5, "TalvisotaElectroMagneticGun"
	weaponslot = 6, "TalvisotaExplosiveTipRifle"
	weaponslot = 7, "TalvisotaBFGOmegaX"
	playerclasses = "TalviGuy"
}
Thanks for your help everyone. :)
Post Reply

Return to “Scripting”