Decorate Inheritance from File

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!)
Post Reply
JossTheFox
Posts: 30
Joined: Sat Jun 19, 2021 6:35 am
Preferred Pronouns: She/Her

Decorate Inheritance from File

Post by JossTheFox »

I tried looking this up, but I couldn't find anything on the wiki about it.

I'm currently making a mod that has several different player characters. All the characters use the same weapons, but they have slightly different sprites (i.e. one weapon is blue, one is red, etc), and to make sure every weapon definition isn't just a huge maze of jumps, every character has their own weapon classes that inherit from the base weapon classes and replace the sprites (and make sure they can actually use it, since the base classes are forbidden to everyone). I've never had any issues with this so far.
Recently, I decided to make an extra file with some additional characters for my friends to use if/when they want to play Doom with me. I didn't have any issues making the first player class, but the second I added their weapons, it stopped working at all.
The error log just says:

Code: Select all

Script error, "Additional Characters.pk3:decorate/weapons/dari/hatchet" line 1:
Parent type 'Hatchet' not found in DariHatchet
Script error, "Additional Characters.pk3:decorate/weapons/dari/hatchet" line 3:
'inventory.forbiddento' requires an actor of type 'Inventory'


Execution could not continue.
Script error, "Additional Characters.pk3:decorate/weapons/dari/hatchet" line 3:
Unexpected '' in definition of 'DariHatchet'
Hatchet is a defined class, in the base file. And every time I've tested it, I've made sure that the base file is loaded before the extra character file. And the definition of DariHatchet is the exact same as all the other character Hatchet definitions (except with his sprites, and a different name obviously), and those all work, but they're in the base file.
Is it just... not possible to inherit from Decorate actors in earlier files? Does Decorate have some weird file load order that I'll have to adjust my entire mod to compensate for? Is there a mysterious, third option that I didn't think of happening?
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Decorate Inheritance from File

Post by ramon.dexter »

Noone is able to help you without inspecting your source file first...
JossTheFox
Posts: 30
Joined: Sat Jun 19, 2021 6:35 am
Preferred Pronouns: She/Her

Re: Decorate Inheritance from File

Post by JossTheFox »

I didn't think showing the Decorate files would be super important, since the issue is (at least, seems like it is) just that GZDoom can't find the class to inherit from, even though it should be (and is) there.
I was about to go to sleep, but I can send the code when I get up.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Decorate Inheritance from File

Post by ramon.dexter »

Yes, showing content of the files is important, as the bug could be somewhere else...
You know, I wont ask you for the files, if the files were not important.
JossTheFox
Posts: 30
Joined: Sat Jun 19, 2021 6:35 am
Preferred Pronouns: She/Her

Re: Decorate Inheritance from File

Post by JossTheFox »

Sorry if I came off as defensive. I was really tired last night.
And sorry for taking so long, I had some things I needed to take care of.

Here's the code for the base hatchet class. It's not mine, it came from a Realm667 mod and I might've edited it a bit, I can't remember:

Code: Select all

ACTOR Hatchet : DoomWeapon
{
	+WEAPON.MELEEWEAPON
	+WEAPON.WIMPY_WEAPON
	Inventory.Icon "AXEPA0"
	Inventory.PickupMessage "$GOTAXE"
	Weapon.SlotNumber 1
	Weapon.SlotPriority 1
	Weapon.SelectionOrder 3700
	Tag "$TAG_AXE"
	Obituary "$OB_HATCHET"
	Inventory.ForbiddenTo "JossPlayer", "RosePlayer", "MidnightPlayer", "PrismPlayer", "ButterflyPlayer", "PinkyPlayer", "ApplePlayer", "RarePlayer", "DitzyPlayer"
	States
	{
	Spawn:
		AXEP A -1
		Stop
	Select:
		AXEG AAAAAAAAAA 0 A_Raise //To get it to raise
		TNT1 A 6
		AXEG EDCBA 2
		Goto Ready
	Deselect:
		AXEG ABCDE 2
		TNT1 A 6
		AXEG A 0 A_Lower
		Wait
	Ready:
		AXEG A 1 A_WeaponReady
		loop
	Fire:
		AXEG ABCDE 1
		TNT1 A 6 A_JumpIfInventory("PowerStrength", 1, "Berserk")
		AXEG F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXEG G 1 A_CustomPunch(20+random(0, 16), 1, 0, "AxeHitPuff")
		AXEG H 2
		TNT1 A 6 
		AXEG EDCBA 2 A_Refire
		AXEG A 6 
		Goto Ready
	Hold:
		TNT1 A 6 A_JumpIfInventory("PowerStrength", 1, "BerserkHold")
		AXEG D 1
		AXEG F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXEG A 1
		AXEG G 1 A_CustomPunch(20+random(0, 16), 1, 0, "AxeHitPuff")
		AXEG H 2
		TNT1 A 6 
		AXEG EDCBA 2 A_Refire
		AXEG A 6 
		Goto Ready
	Berserk:
		TNT1 A 4
		AXEG F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXEG G 1 A_CustomPunch((20+random(0, 16)) * 10, 1, 0, "AxeHitPuff")
		AXEG H 1
		TNT1 A 4
		AXEG EDCBA 1 A_Refire
		AXEG A 4
		Goto Ready
	BerserkHold:
		TNT1 A 4
		AXEG D 1
		AXEG F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXEG A 1
		AXEG G 1 A_CustomPunch((20+random(0, 16)) * 10, 1, 0, "AxeHitPuff")
		AXEG H 1
		TNT1 A 4
		AXEG EDCBA 1 A_Refire
		AXEG A 4
		Goto Ready
	}
}
And the code for the DariHatchet basically just redefines the states.

Code: Select all

ACTOR DariHatchet : Hatchet
{
	Inventory.ForbiddenTo ""
	Inventory.RestrictedTo "DariPlayer"
	States
	{
	Spawn:
		AXEP A -1
		Stop
	Select:
		AXER AAAAAAAAAA 0 A_Raise //To get it to raise
		TNT1 A 6
		AXER EDCBA 2
		Goto Ready
	Deselect:
		AXER ABCDE 2
		TNT1 A 6
		AXER A 0 A_Lower
		Wait
	Ready:
		AXER A 1 A_WeaponReady
		loop
	Fire:
		AXER ABCDE 1
		TNT1 A 6 A_JumpIfInventory("PowerStrength", 1, "Berserk")
		AXER F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXER G 1 A_CustomPunch(20+random(0, 16), 1, 0, "AxeHitPuff")
		AXER H 2
		TNT1 A 6 
		AXER EDCBA 2 A_Refire
		AXER A 6 
		Goto Ready
	Hold:
		TNT1 A 6 A_JumpIfInventory("PowerStrength", 1, "BerserkHold")
		AXER D 1
		AXER F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXER A 1
		AXER G 1 A_CustomPunch(20+random(0, 16), 1, 0, "AxeHitPuff")
		AXER H 2
		TNT1 A 6 
		AXER EDCBA 2 A_Refire
		AXER A 6 
		Goto Ready
	Berserk:
		TNT1 A 4
		AXER F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXER G 1 A_CustomPunch((20+random(0, 16)) * 10, 1, 0, "AxeHitPuff")
		AXER H 1
		TNT1 A 4 
		AXER EDCBA 1 A_Refire
		AXER A 4
		Goto Ready
	BerserkHold:
		TNT1 A 4
		AXER D 1
		AXER F 1 A_PlaySound("weapons/axeswing", CHAN_WEAPON)
		AXER A 1
		AXER G 1 A_CustomPunch((20+random(0, 16)) * 10, 1, 0, "AxeHitPuff")
		AXER H 1
		TNT1 A 4
		AXER EDCBA 1 A_Refire
		AXER A 4
		Goto Ready
	}
}
JossTheFox
Posts: 30
Joined: Sat Jun 19, 2021 6:35 am
Preferred Pronouns: She/Her

Re: Decorate Inheritance from File

Post by JossTheFox »

Of course, the moment I reply...
I did some more testing, and I think I've fixed it!
I had to "nest" the files a layer deeper in the .pk3. I genuinely didn't think that could be a problem until now, but sorry for not mentioning it. All I did was add an extra folder and have all the decorate files in that, and use #includes to make sure the game still finds them. I already had the files sorted in folders, so I just had to add an extra folder in the decorate folder in the extra file, and move all of the other decorate folders into that.
Sorry for the waste of time...
Post Reply

Return to “Scripting”