Page 1 of 2

Heretic Max Ammo

Posted: Thu Dec 31, 2015 2:44 pm
by omyv
Hi,

In a .deh file this code works in Doom2, but not in Heretic.
What can I do to implement the same thing in Heretic? Is there any other way in Zandronum besides the .deh file?

Ammo 0
Max ammo = 500
Ammo 1
Max ammo = 500
Ammo 2
Max ammo = 500
Ammo 3
Max ammo = 500

Thanks

RE: Heretic Max Ammo

Posted: Thu Dec 31, 2015 4:05 pm
by Sean
Unless you need support for less capable engines, http://zdoom.org/wiki/DECORATE

RE: Heretic Max Ammo

Posted: Fri Jan 01, 2016 4:02 am
by Arctangent
DeHackEd is Doom-only, for reference.

RE: Heretic Max Ammo

Posted: Fri Jan 01, 2016 5:42 am
by SwordGrunt
Arctangent wrote: DeHackEd is Doom-only, for reference.
This pretty much seals the deal. And while Heretic's code may be very similar to Doom, it is not the same - it definitely has more objects, but more importantly, the object numbers are different. Dehacked works with certain numbers to identify each thing and modify them, and I highly doubt these are the same for Heretic.

While I believe it's possible to apply a Dehacked patch to Heretic with a PWAD (I've never tried it) there's no reason to do that over using Decorate which, as Sean mentioned, is a better tool for every purpose if you plan on using the ZDoom engine.

At first, I also thought Dehacked was simple to mess around with, and Decorate seemed too complex. But it's very easy to learn the basics if you use the ZDoom wiki, and it's far better.

RE: Heretic Max Ammo

Posted: Sat Jan 02, 2016 10:57 pm
by omyv
Thanks for the info. Regarding this DECORATE thing, how does it really works? I mean, by writing some commands in the console, in a separate file or how exactly
Is this the code I need for implement what I want?

ACTOR MaxCrossbowAmmo : CrossbowAmmo replaces CrossbowAmmo
{
Ammo.BackpackMaxAmount 666
}

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 12:37 am
by Arctangent
Ammo that inherits from another ammo actor ( besides the Ammo base class itself ) counts as the same ammo as its parent class, meaning you can't change the max amounts and such, only stuff relevant to an alternate ammo pickup ( such as pickupmessage, amount, etc. ).

You'll need remake the ammo pickups from scratch, including the alternate pickups for them as otherwise they'd give the old ammo type instead of the new one. You'll also have to redefine the weapons to use the new ammo type instead of the old, although that can be done mostly by just inheriting from the standard weapons and changing their ammotypes ( and their sister weapons, due to Heretic being the focus here ).

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 2:09 am
by SwordGrunt
Arctangent wrote: Ammo that inherits from another ammo actor ( besides the Ammo base class itself ) counts as the same ammo as its parent class, meaning you can't change the max amounts and such, only stuff relevant to an alternate ammo pickup ( such as pickupmessage, amount, etc. ).

You'll need remake the ammo pickups from scratch, including the alternate pickups for them as otherwise they'd give the old ammo type instead of the new one. You'll also have to redefine the weapons to use the new ammo type instead of the old, although that can be done mostly by just inheriting from the standard weapons and changing their ammotypes ( and their sister weapons, due to Heretic being the focus here ).
Indeed, as mentioned in the wiki's Dehacked page: "The only thing that can't be done any other way is changing the default amounts of Doom's Ammo items."

Replacing the ammo pickups (small and large) is the first step, then you have to replace the weapons as Arctangent mentioned.

The code you posted replacing the ammo is fine, just remember you have to do it for every ammo type you want to change, and for the weapons that use them.

You should put the code in a text lump name Decorate (in wads, or Decorate.txt in a pk3 file) using a wad editor such as Slade 3.

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 1:12 pm
by omyv
Could you please help me with that, by posting the code that I need. It seems to be more complicated for me than I thought :(

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 2:23 pm
by omyv
So, for one single type of ammo, is this enough?

ACTOR MaxPhoenixRod : PhoenixRod replaces PhoenixRod
{
Weapon.AmmoType1 "MaxPhoenixRodAmmo"
Weapon.SisterWeapon "MaxPhoenixRodPowered"
}
ACTOR MaxPhoenixRodPowered : PhoenixRodPowered replaces PhoenixRodPowered
{
Weapon.SisterWeapon "MaxPhoenixRod"
}
ACTOR MaxPhoenixRodAmmo : PhoenixRodAmmo replaces PhoenixRodAmmo
{
Ammo.BackpackMaxAmount 666
}

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 5:30 pm
by SwordGrunt
That's almost exactly what you need. The only thing you need is to give MaxPhoenixRodPowered the new ammotype, which you forgot, and to replace the large ammo (PhoenixRodHefty) by inheriting from your new ammo type, and redefining the larger ammo count properties from the original PhoenixRodHefty (since you are not inheriting from it). Like this:

Code: Select all

actor MaxPhoenixRodHefty : MaxPhoenixRodAmmo replaces PhoenixRodHefty
{
 Inventory.PickupMessage "$TXT_AMMOPHOENIXROD2"
  Inventory.Amount 10
  States
  {
  Spawn:
    AMP2 ABC 4
    Loop
  }
}
Here's another important thing: defining the weapon slots for the new weapons in a modified player class, and add that class in KEYCONF, a new text lump, which will look like this:

Code: Select all

clearplayerclasses
addplayerclass MyHereticPlayer
And all you have to do with the player class is inherit from the original, then redefine the weapon slots to accomodate your modified weapon(s). So if you're changing ONLY the Phoenix Rod, you only need to change that name, but include all the other ones because all weapon slot definitions are cleared upon inheriting from a playerclass (I might be wrong on this though).

Code: Select all

actor MyHereticPlayer : HereticPlayer // replacing a player class will do nothing, KEYCONF is required!
{
Player.WeaponSlot 1, Staff, Gauntlets
Player.WeaponSlot 2, GoldWand
Player.WeaponSlot 3, Crossbow
Player.WeaponSlot 4, Blaster
Player.WeaponSlot 5, SkullRod
Player.WeaponSlot 6, MaxPhoenixRod
Player.WeaponSlot 7, Mace
}

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 6:19 pm
by Lollipop
When the ammo type does not inherit from the 'Ammo' internal class, it is the same type of ammo, and hence editing the weapons shouldn't be required, as you will replace the used ammo type with itself.
http://zdoom.org/wiki/Classes:Ammo

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 6:52 pm
by Sean
SwordGrunt wrote: Here's another important thing: defining the weapon slots for the new weapons in a modified player class, and add that class in KEYCONF, a new text lump
NO. Use Weapon.SlotNumber instead. Much, much easier. No new classes, KEYCONF lumps, or any of that shit. Just one property in the weapon definition.

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 7:52 pm
by SwordGrunt
Lollipop wrote: When the ammo type does not inherit from the 'Ammo' internal class, it is the same type of ammo, and hence editing the weapons shouldn't be required, as you will replace the used ammo type with itself.
http://zdoom.org/wiki/Classes:Ammo
I did not know that! I don't think I've ever attempted to replace default ammo in any of my mods, so that's good to know, and makes it much easier for the thread author, too.
Sean wrote:
SwordGrunt wrote: Here's another important thing: defining the weapon slots for the new weapons in a modified player class, and add that class in KEYCONF, a new text lump
NO. Use Weapon.SlotNumber instead. Much, much easier. No new classes, KEYCONF lumps, or any of that shit. Just one property in the weapon definition.
Yeah, it's been a long time since I touched any playerclass mods so I forgot about the slot number defining in individual weapons, which is indeed a lot better. I looked at the ZDoom Wiki when posting here before and saw that the weapons were still defined in the player class, so I mistakenly assumed it was the preferable method. Thanks for the correction!

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 9:29 pm
by omyv
I'm kind of lost now :( Could someone please post all the code that is needed in the file decorate.txt for one single weapon?

RE: Heretic Max Ammo

Posted: Sun Jan 03, 2016 11:40 pm
by SwordGrunt
Actually I understand what Lollipop said now, I misread that. I have no idea how I overlooked the obvious ammo inheritance. If you inherit from an ammo type your class will use that ammo type's properties, so you need to create a new class derived from Ammo itself. The ZDoom wiki even mentions that you shouldn't copy code, unless "if what you want is changing Ammo capacity, you need to create a new type from Ammo."

So for the Phoenix Rod, you'd do this for the ammo, using 200 and 400 for maxamounts instead of 20 and 40 in this example:

Code: Select all

ACTOR MyPhoenixRodAmmo : Ammo
{
  Inventory.PickupMessage "$TXT_AMMOPHOENIXROD1"
  Inventory.Amount 1
  Inventory.MaxAmount 200
  Ammo.BackpackAmount 1
  Ammo.BackpackMaxAmount 400
  Inventory.Icon "INAMPNX"
  States
  {
  Spawn:
    AMP1 ABC 4
    Loop
  }
}

actor MyPhoenixRodHefty : MyPhoenixRodAmmo
{
 Inventory.PickupMessage "$TXT_AMMOPHOENIXROD2"
  Inventory.Amount 10
  States
  {
  Spawn:
    AMP2 ABC 4
    Loop
  }
}
And then you'd modify the Phoenix Rod itself to use this new ammo type:

Code: Select all

actor MyPhoenixRod : PhoenixRod replaces PhoenixRod
{
Weapon.AmmoType1 "MyPhoenixRodAmmo"
Weapon.SisterWeapon "MyPhoenixRodPowered"
Weapon.SlotNumber 6
}

actor MyPhoenixRodPowered : PhoenixRodPowered // no need to replace, as you will never spawn the powered-up version of a weapon
{
Weapon.AmmoType1 "MyPhoenixRodAmmo"
Weapon.SisterWeapon "MyPhoenixRod"
// I don't think slot number is needed because the sisterweapon property should automatically share the slot
}
Both can be included in the same Decorate.txt file, or if you're going to work with more weapons, I'd recommend using the PK3 structure's folders to keep each weapon and their ammotype in a different text file. For example, in the folder "actors" you can have "PhoenixRod.txt" and "Hellstaff.txt", and then in your Decorate.txt file (main directory, not inside any folders!) you'd have:

Code: Select all

#include "actors/PhoenixRod.txt"
#include "actors/Hellstaff.txt"

RE: Heretic Max Ammo

Posted: Mon Jan 04, 2016 12:43 am
by omyv
Thanks for your help, but that code is not working propertly.

In the game there are two types of ammo in the hud, and when you pick some ammo, it goes to the "old one" and not to the "new one"

RE: Heretic Max Ammo

Posted: Mon Jan 04, 2016 3:30 am
by Empyre
I'm relatively new to DECORATE, but I think you need to have the new ammo type replace the old one, like this:
ACTOR MyPhoenixRodAmmo : Ammo replaces PhoenixAmmo
and
ACTOR MyPhoenixRodHefty : MyPhoenixRodAmmo replaces PhoenixRodHefty
Leave the rest of the code as SwordGrunt had it. I might be wrong, but if I am, you wasted not much time.

RE: Heretic Max Ammo

Posted: Mon Jan 04, 2016 5:12 am
by SwordGrunt
Empyre wrote: I'm relatively new to DECORATE, but I think you need to have the new ammo type replace the old one, like this:
ACTOR MyPhoenixRodAmmo : Ammo replaces PhoenixAmmo
and
ACTOR MyPhoenixRodHefty : MyPhoenixRodAmmo replaces PhoenixRodHefty
Leave the rest of the code as SwordGrunt had it. I might be wrong, but if I am, you wasted not much time.
You're 100% correct, I forgot to replace the actual ammotypes, that's why it messed up for him. Thanks!


Also, the original weapon definitions use weapon.ammotype and not weapon.ammotype1. As far as I know they mean exactly the same but it's possible that it's not properly replacing the old ammo type, so try changing it (from weapon.ammotype1to weapon.ammotype)

RE: Heretic Max Ammo

Posted: Mon Jan 04, 2016 6:29 pm
by omyv
Much better, thanks a lot.
But I still don't know why there are two types of weapons now.
Check the screenshot here http://asturcon.0lx.net/temp/heretic.png

RE: Heretic Max Ammo

Posted: Mon Jan 04, 2016 6:46 pm
by Klofkac
That's because the "old" weapon still exists. If you play and pick the weapon up legit, there won't be the duplicates since you wil only pick up the "new" one.