Hexen - Custom Player Class weapons switch to Hammer of Retibution when mana runs out.

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!)
willj99
Posts: 1
Joined: Mon Mar 03, 2025 7:07 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Win10

Hexen - Custom Player Class weapons switch to Hammer of Retibution when mana runs out.

Post by willj99 »

Hi all,

So i've been modding this game recently, I've managed to set up a brand new player class using Decorate, which is inheriting from the PlayerPawn class, with the below properties:

Code: Select all

actor Elf : PlayerPawn {
  Health 100
  ReactionTime 0
  PainChance 255
  Radius 16
  Height 64
  Speed 1
  +NOSKIN
  +NODAMAGETHRUST
  +NOTHRUSTWHENINVUL
  PainSound "PlayerMagePain"
  RadiusDamageFactor 0.25
  Player.JumpZ 9
  Player.Viewheight 48
  Player.SpawnClass 4
  Player.DisplayName "Elf"
  Player.SoundClass "Cleric"
  Player.ScoreIcon "CLERFACE"
  Player.InvulnerabilityMode "Ghost"
  Player.HealRadiusType "Health"
  Player.HexenArmor 10, 10, 25, 5, 20
  Player.StartItem CWeapMace
  Player.Portrait "M_EBOX"
  Player.WeaponSlot 1, CWeapMace
  Player.WeaponSlot 2, CWeapStaff
  Player.WeaponSlot 3, CWeapFlame
  Player.WeaponSlot 4, CWeapWraithverge
  Player.FlechetteType "ArtiPoisonBag1"

  Player.ColorRange 146, 163
  Player.ColorSet     0, "Blue",          146, 163,    161
  Player.ColorSetFile 1, "Red",           "TRANTBL7",  0xB3
  Player.ColorSetFile 2, "Gold",          "TRANTBL8",  0x8C
  Player.ColorSetFile 3, "Dull Green",    "TRANTBL9",  0x41
  Player.ColorSetFile 4, "Green",         "TRANTBLA",  0xC9
  Player.ColorSetFile 5, "Gray",          "TRANTBLB",  0x30
  Player.ColorSetFile 6, "Brown",         "TRANTBLC",  0x72
  Player.ColorSetFile 7, "Purple",        "TRANTBLD",  0xEE

  States
  {
  Spawn:
    CLAY A -1
    Stop
  See:
    CLAY ABCD 4
    Loop
  Pain:
    CLAY H 4
    CLAY H 4 A_Pain
    Goto Spawn
  Missile:
  Melee:
    CLAY EFG 6
    Goto Spawn
  Death:
    CLAY I 6
    CLAY J 6 A_PlayerScream
    CLAY KL 6
    CLAY M 6 A_NoBlocking
    CLAY NOP -1
    Stop     
  XDeath:
    CLAY R 5 A_PlayerScream
    CLAY S 5
    CLAY T 5 A_NoBlocking
    CLAY UVWXYZ 5
    CLAY [ -1
    Stop
  Ice:
    CLAY "\" 5 A_FreezeDeath
    CLAY "\" 1 A_FreezeDeathChunks
    Wait
  Burn:
    FDTH C 5 Bright A_PlaySound("*burndeath")
    FDTH D 4 Bright
    FDTH G 5 Bright
    FDTH H 4 Bright A_PlayerScream
    FDTH I 5 Bright
    FDTH J 4 Bright
    FDTH K 5 Bright
    FDTH L 4 Bright
    FDTH M 5 Bright
    FDTH N 4 Bright
    FDTH O 5 Bright
    FDTH P 4 Bright
    FDTH Q 5 Bright
    FDTH R 4 Bright
    FDTH S 5 Bright A_NoBlocking
    FDTH T 4 Bright
    FDTH U 5 Bright
    FDTH V 4 Bright
    ACLO E 35 A_CheckPlayerDone
    Wait
    ACLO E 8
    Stop
  }
}
[/c]

The issue is, when any of the mana based weapons for this class run out of mana, it will autoswitch to the Hammer of Retribution in that slot. I am using the base game classes in addition to this class. I notice this functions perfectly fine when the "nra" cheat isn't used. But this happens when nra is used. Is there any way to stop it from doing this when the nra cheat is used.

Any help, greatly appreciated. Thanks.
User avatar
Player701
 
 
Posts: 1706
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: Hexen - Custom Player Class weapons switch to Hammer of Retibution when mana runs out.

Post by Player701 »

The way Hexen weapons are set up is that each class-specific weapon is forbidden to the other two classes (e.g. cleric's weapons are forbidden to fighters and mages). Being a custom player class, yours is exempt from any of these restrictions, and thus can receive and use all of the classes' weapons.

Since you apparently want your class to use the Cleric's weapons, you could try subclassing it from ClericPlayer instead of PlayerPawn. Provided that the inventory restriction mechanism takes inheritance into account, it should solve your problem by making other weapons inaccessible to your player class.

Return to “Scripting”