Replacing Weapons in DECORATE...

Archive of the old editing forum
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.
Locked
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Replacing Weapons in DECORATE...

Post by solarsnowfall »

I've never really messed with making weapons before, and now I seem to be paying the price. What I want to do is replace some of the default Doom weapons with slightly altered ones. All I'm trying to do is modify the Spawn state so that it executes a script. What's the correct way to do this? I've tried...

Code: Select all

actor _Shotgun : Shotgun replaces Shotgun
{
  states
  {
  Spawn:
    SHOT A 0
    SHOT A 0 ACS_ExecuteAlways(992, 0, 5)
    SHOT A -1
    Stop
  }
}
I've also tried inherriting from the DoomWeapon class and replacing the shotgun like this...

Code: Select all

actor _Shotgun : DoomWeapon replaces Shotgun
{
  Game Doom
  SpawnID 27
  Weapon.SelectionOrder 1300
  Weapon.AmmoUse 1
  Weapon.AmmoGive 8
  Weapon.AmmoType "Shell"
  Inventory.PickupMessage "$GOTSHOTGUN" // "You got the shotgun!"
  Obituary "$OB_MPSHOTGUN" // "%o chewed on %k's boomstick."
  States
  {
  Ready:
    SHTG A 1 A_WeaponReady
    Loop
  Deselect:
    SHTG A 1 A_Lower
    Loop
  Select:
    SHTG A 1 A_Raise
    Loop
  Fire:
    SHTG A 3
    SHTG A 7 A_FireShotgun
    SHTG BC 5
    SHTG D 4
    SHTG CB 5
    SHTG A 3
    SHTG A 7 A_ReFire
    Goto Ready
  Flash:
    SHTF A 4 Bright A_Light1
    SHTF B 3 Bright A_Light2
    Goto LightDone
  Spawn:
    SHOT A 0
    SHOT A 0 ACS_ExecuteAlways(992, 0, 5)
    SHOT A -1
    Stop
  }
}
The Shotgun is replaced with my _Shotgun, I can pick it up and the script gets run, so far so good. The problem I encounter is when using the weapon. Once I pick up the _Shotgun and it autoselects, I can't mouse-wheel to any of the other weapons. I have to select a weapon by pressing the coresponding # key. Then I can mouse-wheel between all other weapons except the _Shotgun, and I can't get back to it either by pressing 3. I tried adding the _Shotgun to slot 3 of the KEYCONF lump but that doesn't seem to make a difference. What am I ignorant about here, or can't this be done?
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing Weapons in DECORATE...

Post by Enjay »

Until recently, you had to use a KEYCONF lump to allocate the weapons to the weapon slots. That method still works for backwards compatibility but it has been deprecated in favour of using a custom player definition and using "Player.WeaponSlot" in it to allocate the weapons to slots.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing Weapons in DECORATE...

Post by Enjay »

Example:

Code: Select all

ACTOR SolarPlayer : DoomPlayer
{
	Player.StartItem "_Pistol"
	Player.StartItem "_Fist"
	Player.StartItem "Clip", 50
	Player.WeaponSlot 1, _Fist, _Chainsaw
	Player.WeaponSlot 2, _Pistol
	Player.WeaponSlot 3, _Shotgun, _SuperShotgun
	Player.WeaponSlot 4, _Chaingun
	Player.WeaponSlot 5, _RocketLauncher
	Player.WeaponSlot 6, _PlasmaRifle
	Player.WeaponSlot 7, _BFG9000
}
That defines a player that assumes all the weapons have been replaced using ones whose names start with "_".

Oh, you'd still have to include a KEYCONF like this:

Code: Select all

clearplayerclasses
addplayerclass SolarPlayer
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Replacing Weapons in DECORATE...

Post by Gez »

Or, more simply, "Weapon.SlotNumber" in the weapon declaration itself. This way, you don't have to redefine the player class and to mess with KEYCONF.

But indeed, the reason you can't use "next/previous weapon" is that it doesn't know which slot the weapon is in.
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Re: Replacing Weapons in DECORATE...

Post by solarsnowfall »

Thanks guys.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Replacing Weapons in DECORATE...

Post by Enjay »

Gez wrote:"Weapon.SlotNumber"
Quite right. I forgot about that option. That's obviously the simplest choice. I guess that a disadvantage of that method would be that it doesn't clear existing the weapons out of the slots so if the player somehow happened to get a weapon that they weren't meant to have, it would be selectable.
Locked

Return to “Editing (Archive)”