What code do I need? I already tried adding
Code: Select all
A_GiveInventory("BlueArmorForMegasphere", 1)Code: Select all
Armor.SavePercent 50
Armor.SaveAmount 200
But the former does nothing, and the latter isn't recognized for some reason?
Code: Select all
A_GiveInventory("BlueArmorForMegasphere", 1)Code: Select all
Armor.SavePercent 50
Armor.SaveAmount 200
Code: Select all
class ArmorShotgun : CustomInventory replaces Shotgun
{
States
{
Spawn:
SHOT A -1;
Stop;
Pickup:
TNT1 A 0 A_GiveInventory("Shotgun");
TNT1 A 0 A_GiveInventory("GreenArmor");
Stop;
}
}Thank you so much for answering! I will check out later!Average Raven Fan wrote: ↑Mon May 11, 2026 4:39 am Alright, let's start by going over why those two didn't work : A_GiveInventory is an action, it has to be associated with a state and can't be put into an actor's properties. Meanwhile, Armor.SavePercent and SaveAmount are properties, but they're Armor properties, so they're only available when used with items that inherit from Armor!
Try this instead :ZScript but easy enough to convert to DECORATE if you want. This replaces the Shotgun with a custom pickup that will give you a Shotgun and a Green Armor when you grab it. Replacing like this is not entirely recommended and it'd be better to manually place it in maps or spawn it from a RandomSpawner instead, or hijack the pickup virtual function if you're using ZScript, but it should work.Code: Select all
class ArmorShotgun : CustomInventory replaces Shotgun { States { Spawn: SHOT A -1; Stop; Pickup: TNT1 A 0 A_GiveInventory("Shotgun"); TNT1 A 0 A_GiveInventory("GreenArmor"); Stop; } }
Give it a go and see if it's what you wanted!
Average Raven Fan wrote: ↑Mon May 11, 2026 4:39 am Alright, let's start by going over why those two didn't work : A_GiveInventory is an action, it has to be associated with a state and can't be put into an actor's properties. Meanwhile, Armor.SavePercent and SaveAmount are properties, but they're Armor properties, so they're only available when used with items that inherit from Armor!
Try this instead :ZScript but easy enough to convert to DECORATE if you want. This replaces the Shotgun with a custom pickup that will give you a Shotgun and a Green Armor when you grab it. Replacing like this is not entirely recommended and it'd be better to manually place it in maps or spawn it from a RandomSpawner instead, or hijack the pickup virtual function if you're using ZScript, but it should work.Code: Select all
class ArmorShotgun : CustomInventory replaces Shotgun { States { Spawn: SHOT A -1; Stop; Pickup: TNT1 A 0 A_GiveInventory("Shotgun"); TNT1 A 0 A_GiveInventory("GreenArmor"); Stop; } }
Give it a go and see if it's what you wanted!