Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
dosboot

how to add custom hexen weapons / other classes weapons (needs custom player?)

Recommended Posts

I'm trying to create custom weapons in Hexen. What I really want to do is to make copies of the existing Hexen weapons and make them available to the other classes, say by summoning them from the console.

One problem I ran into is if I copy/paste the decorate code for one of the original weapons there will be a "action native function" line which causes errors on loading the game. I've worked around this by inheriting from the original weapon.

So now I have something like this:

// The Mage's Frost Cone:

ACTOR ExMWeapFrost : MWeapFrost
{
	Weapon.SlotNumber 5
	Weapon.SelectionOrder 1700
}
This is inside a custom .pk3 that I load alongside hexen.wad in gzdoom.

What works: The console is able to "summon ExMWeapFrost", and if I'm playing as the Mage it will add this weapon to his inventory.

What doesn't work: once you switch away from this weapon you can't switch back to it using slot 5.

Do I need to create a custom player class and define Player.WeaponSlot 5? I've experimented with creating a custom player class. For testing purposes I made one with 166 health:
ACTOR MyMagePlayer : PlayerPawn replaces MagePlayer
{
	//Health 100
	Health 166
	ReactionTime 0
	PainChance 255
	Radius 16
	Height 64
	Speed 1
	+NOSKIN
	PainSound "PlayerMagePain"
	RadiusDamageFactor 0.25
	Player.JumpZ 9.75
	Player.Viewheight 48
	Player.ColorRange 146, 163
	Player.SpawnClass "Mage"
	Player.DisplayName "Mage"
	Player.SoundClass "mage"
	Player.ScoreIcon "MAGEFACE"
	Player.InvulnerabilityMode "Reflective"
	Player.HealRadiusType "Mana"
	Player.Hexenarmor 5, 5, 15, 10, 25
	Player.StartItem "MWeapWand"
	Player.ForwardMove 0.88, 0.92
	Player.SideMove 0.875, 0.925
	Player.WeaponSlot 1, MWeapWand
	Player.WeaponSlot 2, MWeapFrost
	Player.WeaponSlot 3, MWeapLightning
	Player.WeaponSlot 4, MWeapBloodscourge
	Player.WeaponSlot 5, ExMWeapFrost
	
	States
	{
	Spawn:
		MAGE A -1
		Stop
	See:
		MAGE ABCD 4
		Loop
	Missile:
	Melee:
		MAGE EF 8
		Goto Spawn
	Pain:
		MAGE G 4
		MAGE G 4 A_Pain
		Goto Spawn
	Death:
		MAGE H 6
		MAGE I 6 A_PlayerScream
		MAGE JK 6
		MAGE L 6 A_NoBlocking
		MAGE M 6
		MAGE N -1
		Stop		
	XDeath:
		MAGE O 5 A_PlayerScream
		MAGE P 5
		MAGE R 5 A_NoBlocking
		MAGE STUVW 5
		MAGE X -1
		Stop
	Ice:
		MAGE Y 5 A_FreezeDeath
		MAGE Y 1 A_FreezeDeathChunks
		Wait
	Burn:
		FDTH E 5 BRIGHT A_PlaySound("*burndeath")
		FDTH F 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
	}
}

I understand you need to use MAPINFO or GameInfo to actually have custom player classes replace original ones, but I can't figure out how to do that. From what I've read on the wiki it sounds as though Hexen has a custom format for this part of the process, but I can't find any documentation or tutorials.

e.g. I've tried adding this "MAPINFO" file into my .pk3:
GameInfo
{
   AddPlayerClasses = "MyMagePlayer"
}
But it doesn't seem to do anything.

Share this post


Link to post

You might need another new lump ala Mapinfo called Keyconf where you put

"Clearplayerclasses
Addplayerclass MyMagePlayer"

Share this post


Link to post
gemini09 said:

You might need another new lump ala Mapinfo called Keyconf where you put

"Clearplayerclasses
Addplayerclass MyMagePlayer"


This did make MyMagePlayer accessible (or rather it made it the only class, which is fine), but slot 5 still doesn't do anything when after summoning the custom weapon. I also removed the "MAPINFO" file from my previous post since it seemed redundant or incorrect.

Share this post


Link to post

Silly question perhaps but as Hexen has only 4 weapons by default, you're sure you have 5 bound to weapon slot 5?

Share this post


Link to post

Make sure that when you try to access slot 5, you actually access slot 5. Since Hexen did only have four weapons, the 5 to 0 keys were bound to non-weapon stuff. Precisely, the default bindings in Hexen are:
1: slot 1
2: slot 2
3: slot 3
4: slot 4
5: icon of the defender
6: porkelator
7: banishment device
8: chaos device
9: disc of repulsion
0: flechette

So if you haven't reconfigured your Hexen bindings, what happens when you press 5 is that you try to use an icon of the defender instead of selecting your 5th slot weapon, and so nothing happens if you do not have the invulnerability artifact.

Another thing to watch out for is that Hexen's weapons are forbidden to other player classes; so you need to clear out this interdiction in your inherited weapons.

gemini09 said:

You might need another new lump ala Mapinfo called Keyconf

Nope. KEYCONF is for key configuration. Doing anything else with it is deprecated and unadvised. Use MAPINFO for any sort of game setting changes like which play classes are available.

Share this post


Link to post

Thanks for all the help. The problem indeed was that the "5" key was not bound to select weapon slot 5. Creating a new playerclass is unnecessary to get the slot to work.

Regarding the class restriction problem. This doesn't seem to fix it:

ACTOR MyFighterWeapon : Weapon replaces FighterWeapon
{
	Weapon.Kickback 150
}

ACTOR MyClericWeapon : Weapon replaces ClericWeapon
{
	Weapon.Kickback 150
}

ACTOR MyMageWeapon : Weapon replaces MageWeapon
{
	Weapon.Kickback 150
}
I suppose if it did, I wouldn't need to create copies of the weapons anyway. And if I do create copies of the weapons I'm stuck inheriting from the originals, because they use "action native" function lines. I tried the "Give ExMWeapFrost" console command as well, but other classes won't actually have it added to their inventory.

I guess there are a few ways this could work:

1) Get the above parentclasses to override the parent class in my weapon copy.

2) Create a new playerclass that is nominally distinct from the existing ones so it doesn't get caught by the restriction. I don't understand what's the non-deprecated way to do create a custom playerclass.

Also, if I make a new distinct playerclass, how does the game decide what to spawn inside the levels where it needs to spawn a Slot 2/3/4 weapon?
Edit: The Player.SpawnClass property determines this.

Share this post


Link to post

The "replaces" keyword only works to replace spawns. This is something that needs to be stressed. You cannot override MWeapFrost's inherited properties by replacing MageWeapon, all you achieve by that is make it so that if an instance of MageWeapon was ever spawned in the map (which shouldn't happen since it's an abstract class) it would be replaced by your replacement.

So what you need to do is instead stuff like this:

// The Mage's Frost Cone:

ACTOR ExMWeapFrost : MWeapFrost
{
	Weapon.SlotNumber 5
	Weapon.SelectionOrder 1700
	Inventory.ForbiddenTo ""
}

Share this post


Link to post

Thanks again. It's finally work well. You'd think someone would have added cheats for exactly this sort of thing, but apparently not.

If anyone wants to play with this themselves, here is the "DECORATE" file I used for my .pk3. As is, this version will make weapons share their slot. You'll have to manually adjust the SlotPriority values or SlotNumbers to taste. The SelectionOrder values are basically irrelevant, it determines the auto-switch order when running out of ammo.

// Fist (first weapon) 
ACTOR ExFWeapFist : FWeapFist replaces FWeapFist
{
    Weapon.SlotNumber 1
    Weapon.SlotPriority 1
    Weapon.SelectionOrder 3400
    Inventory.ForbiddenTo ""
}


// The Fighter's Axe 
ACTOR ExFWeapAxe : FWeapAxe replaces FWeapAxe
{
    Weapon.SlotNumber 2
    Weapon.SlotPriority 1
    Weapon.SelectionOrder 1500
    Inventory.ForbiddenTo ""
}


// The Fighter's Hammer 
ACTOR ExFWeapHammer : FWeapHammer replaces FWeapHammer
{
    Weapon.SlotNumber 3
    Weapon.SlotPriority 1
    Weapon.SelectionOrder 900
    Inventory.ForbiddenTo ""
}


// The Fighter's Sword (Quietus) 
ACTOR ExFWeapQuietus : FWeapQuietus replaces FWeapQuietus
{
    Weapon.SlotNumber 4
    Weapon.SlotPriority 1
    Weapon.SelectionOrder 2900
    Inventory.ForbiddenTo ""
}


// The Cleric's Mace 
ACTOR ExCWeapMace : CWeapMace replaces CWeapMace
{
    Weapon.SlotNumber 1
    Weapon.SlotPriority 0.9
    Weapon.SelectionOrder 3500
    Inventory.ForbiddenTo ""
}


// The Cleric's Serpent Staff 
ACTOR ExCWeapStaff : CWeapStaff replaces CWeapStaff
{
    Weapon.SlotNumber 2
    Weapon.SlotPriority 0.9
    Weapon.SelectionOrder 1600
    Inventory.ForbiddenTo ""
}


// The Cleric's Flame Strike 
ACTOR ExCWeapFlame : CWeapFlame replaces CWeapFlame
{
    Weapon.SlotNumber 3
    Weapon.SlotPriority 0.9
    Weapon.SelectionOrder 1000
    Inventory.ForbiddenTo ""
}


// Cleric's Wraithverge (Holy Symbol?) 
ACTOR ExCWeapWraithverge : CWeapWraithverge replaces CWeapWraithverge
{
    Weapon.SlotNumber 4
    Weapon.SlotPriority 0.9
    Weapon.SelectionOrder 3000
    Inventory.ForbiddenTo ""
}


// The Mage's Wand 
ACTOR ExMWeapWand : MWeapWand replaces MWeapWand
{
    Weapon.SlotNumber 1
    Weapon.SlotPriority 0.8
    Weapon.SelectionOrder 3600
    Inventory.ForbiddenTo ""
}


// The Mage's Frost Cone 
ACTOR ExMWeapFrost : MWeapFrost replaces MWeapFrost
{
    Weapon.SlotNumber 2
    Weapon.SlotPriority 0.8
    Weapon.SelectionOrder 1700
    Inventory.ForbiddenTo ""
}


// The Mage's Lightning Arc of Death 
ACTOR ExMWeapLightning : MWeapLightning replaces MWeapLightning
{
    Weapon.SlotNumber 3
    Weapon.SlotPriority 0.8
    Weapon.SelectionOrder 1100
    Inventory.ForbiddenTo ""
}


// The Mages's Staff (Bloodscourge) 
ACTOR ExMWeapBloodscourge : MWeapBloodscourge replaces MWeapBloodscourge
{
    Weapon.SlotNumber 4
    Weapon.SlotPriority 0.8
    Weapon.SelectionOrder 3100
    Inventory.ForbiddenTo ""
}

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
×