Inheritance Can't Replace Weapons?

Discuss all aspects related to modding Zandronum here.
Post Reply
newbiejackcity
New User
Posts: 12
Joined: Tue Aug 06, 2013 10:26 am

Inheritance Can't Replace Weapons?

#1

Post by newbiejackcity » Mon Aug 19, 2013 12:47 am

I've been playing around with inheritance to do some balancing on an existing mod. Everything is going pretty well, but I realized for one tweak I wanted to modify the behavior of the existing weapon, not just of the projectile.

However, it looks like inheritance can't be used to replace existing weapons? Or am I doing something wrong?

Here's the code I tested in Zandronum and ZDoom. If I'm reading it right, it should replace the Pistol with a weapon which is similar to the BFG. However, upon running, the Pistol behaves the same as always.

Code: Select all

ACTOR BFG_tw : Pistol replaces Pistol
{
  Game Doom
  Height 20
  SpawnID 31
  Weapon.SelectionOrder 2800
  Weapon.AmmoUse 40
  Weapon.AmmoGive 40
  Weapon.AmmoType "Cell"
  +WEAPON.NOAUTOFIRE
  Inventory.PickupMessage "$GOTBFG9000"
  Tag "$TAG_BFG9000"
  States
  {
  Ready:
    BFGG A 1 A_WeaponReady
    Loop
  Deselect:
    BFGG A 1 A_Lower
    Loop
  Select:
    BFGG A 1 A_Raise
    Loop
  Fire:
    BFGG A 20 A_BFGSound
    BFGG B 10 A_GunFlash
    BFGG B 10 A_FireBFG
    BFGG B 20 A_ReFire
    Goto Ready
  Flash:
    BFGF A 11 Bright A_Light1
    BFGF B 6 Bright A_Light2
    Goto LightDone
  Spawn:
    BFUG A -1
    Stop
  }
}
I also tried inheriting from DoomWeapon and Weapon instead of inheriting from Pistol, but still no luck.

User avatar
Ænima
Addicted to Zandronum
Posts: 3582
Joined: Tue Jun 05, 2012 6:12 pm

RE: Inheritance Can't Replace Weapons?

#2

Post by Ænima » Mon Aug 19, 2013 2:20 am

You need to bind the weapon to a key so that it can be selected.
http://zdoom.org/wiki/Adding_weaponsections


And since you're replacing one of the player's default starting weapons (the pistol), you need to create a new playerclass that starts with that weapon instead.
http://zdoom.org/wiki/DoomPlayer
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

The Endertainer
 
Posts: 49
Joined: Thu Jun 28, 2012 12:25 pm
Location: Hell

RE: Inheritance Can't Replace Weapons?

#3

Post by The Endertainer » Mon Aug 19, 2013 3:26 am

I had a similar problem once. Thing is, you cant just replace the pistol by "Weapon replaces Pistol". You need to make a new playerclass entirely:

Code: Select all

Actor Doomer : Doomplayer replaces Doomplayer
{
	Player.Startitem "BFG_tw"
	Player.Startitem "Fist"
	Player.Startitem "WhateverElseYouWantTostartWith"
}
And then remove the basic player in KEYCONF, and replace it with your new player:

Code: Select all

clearplayerclasses
addplayerclass "Doomer"

Post Reply