Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Question

My goal, using GZDoom, is to have ammo, health, and armor bonuses pop out of an enemy when they are gibbed.

 

From what I've read of DECORATE I would need to make the ammo, health, and armor bonus items and graphics (the ammo would be a small count of each ammo type).

 

If someone could show me how to create the ammo item (using a custom graphic), and show how to trigger the item popping upon enemy gibbing, the help would be greatly appreciated!

 

Share this post


Link to post

10 answers to this question

Recommended Posts

  • 0

This was the final step in my mod, it's like an early day version of 2016 (with no glory kills, just gibs).

This bit was answered by the zdoom forums, thought I'd share it here for others.

 

ACTOR Chainsaw2 : Chainsaw replaces Chainsaw
{
  Weapon.SlotNumber 1
  States
  {
  Fire:
    SAWG AB 4 A_Saw("weapons/sawfull","weapons/sawhit",0,"ChainsawPuff")
    SAWG B 0 A_ReFire
    Goto Ready
  }
}
ACTOR ChainsawPuff : BulletPuff {DamageType Chainsaw}
ACTOR DoomImp2 : DoomImp replaces DoomImp
{
  States
  {
  Death.Chainsaw:
    TROO I 8
    TROO J 8 A_Scream
    TROO KKKKKK 1 A_DropItem("Clip")
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  }

 

Share this post


Link to post
  • 0

Creating ammo items is relatively simple: inherit from the kind of ammo you want to give. For example, for a shell pickup, you'll have to use something like "actor ShellPickup : Shell" (in DECORATE syntax) or "class ShellPickup : Shell" (in ZScript syntax). Likewise for health and armor bonuses, you can inherit from the existing health and armor bonus classes and just change the states so they use different sprites.

 

For spawning these items when an enemy is gibbed, you have two different approaches you can try. The DECORATE-compatible one is to replace all monsters by modified variants that include code for spawning the bonus items when they're gibbed. Another approach, using ZScript, is to use events handlers to detect the WorldThingDied event, check that the health of the dead thing is below its negative gibhealth (so it was gibbed), and then spawn stuff at its location. The advantage of this approach is that it's universal (it'll work with any monster, including custom ones) and you don't have to modify all the standard actors; the drawback is that it's a bit more advanced programming.

Share this post


Link to post
  • 0
7 hours ago, Gez said:

Creating ammo items is relatively simple: inherit from the kind of ammo you want to give. For example, for a shell pickup, you'll have to use something like "actor ShellPickup : Shell" (in DECORATE syntax) or "class ShellPickup : Shell" (in ZScript syntax). Likewise for health and armor bonuses, you can inherit from the existing health and armor bonus classes and just change the states so they use different sprites.

 

For spawning these items when an enemy is gibbed, you have two different approaches you can try. The DECORATE-compatible one is to replace all monsters by modified variants that include code for spawning the bonus items when they're gibbed. Another approach, using ZScript, is to use events handlers to detect the WorldThingDied event, check that the health of the dead thing is below its negative gibhealth (so it was gibbed), and then spawn stuff at its location. The advantage of this approach is that it's universal (it'll work with any monster, including custom ones) and you don't have to modify all the standard actors; the drawback is that it's a bit more advanced programming.

 

OK thanks, I'll look towards the ZScript option--I'm presuming that it'd work in both ZDoom and GZDoom then?

 

Share this post


Link to post
  • 0

If by "ZDoom" you mean something like @drfrag's updated fork, yes. Otherwise, no. ZDoom development ceased some years ago.

Share this post


Link to post
  • 0

ZDoom32? No, i forked right before the ZScript merge and the assembly removal.

Share this post


Link to post
  • 0

I don't want to just mimic Doom2016. Any ideas here? Maybe gib for health and armor and something else for ammo?

Maybe reverse the two? Gib for ammo and chainsaw for health?

 

EDIT

So I think I can see where I need to edit DECORATE to have the things defined.

Can anyone help with the Zscript to spawn the various items on death via chainsaw and death via gib?

Any help would be appreciated.

 

Item names are PowHealth, PowArmor, PowBullets, PowShells, PowRockets, PowPlasma.

 

Edited by 𝕲𝖗𝖊𝖊𝖓𝖙𝖎𝖌𝖊𝖗1

Share this post


Link to post
  • 0

 

Question 1:

OK, I can get the bosses to drop stuff when they die (Spider Mastermind, Cyberdemon), but the items pop and then disappear. Is there a setting I'm missing? Are they simply going into the floor? When I walk to grab the items I can still pick them up. I just can't see them.

Here's my DECORATE:

 

// Cyberdemon
actor Cyberdemon2 : Cyberdemon replaces Cyberdemon {
	Scale 0.75
	States {
		Death:
		CYBR H 10
		CYBR I 10 A_Scream
		CYBR JKL 10
		CYBR M 10 A_NoBlocking
		CYBR NO 10
		CYBR P 5
		CYBR P 0 A_SpawnItemEx("DropHealthBonus",0,0,8,random(-3,3),random(-3,3),random(2,6),random(0,360),SXF_NOCHECKPOSITION)
		CYBR P 0 A_SpawnItemEx("DropHealthBonus",0,0,8,random(-3,3),random(-3,3),random(2,6),random(0,360),SXF_NOCHECKPOSITION)
		CYBR P 0 A_SpawnItemEx("DropHealthBonus",0,0,8,random(-3,3),random(-3,3),random(2,6),random(0,360),SXF_NOCHECKPOSITION)
		CYBR P -1 A_BossDeath
		Stop
		}
	}
// HLTHA0
actor DropHealthBonus : Health {
	Inventory.Amount 3
	Inventory.MaxAmount 200
	Inventory.PickupMessage "Picked up some health."
	States {
		Spawn:
		HLTH A 3
		HLTH A 3 Bright
		Loop
		}
	}

Question 2:

I'm presuming that I'll need to use Zscript to do a check to see if a monster was killed by MOD_CHAINSAW or can this be done in DECORATE?

Like in the Death: state do a if(MOD_CHAINSAW) { ... } ?

 

Question 3:

Is the XDeath state the gib state? If I can do if statements in DECORATE this would solve my problems with my mod.

 

Thanks!

 

 

 

Share this post


Link to post
  • 0

I can get different enemies to drop different things. In the DECORATE file, I put this;

 

DropItem "Cell" 256

 

Then every time I kill the enemy, he drops a small cell pack every time. If I change it to '128' instead of '256' it reduces the drop rate to 50/50 so I then have 50% chance of the enemy dropping the item. '64' for 25% chance, '32' for 12.5% chance and so on.

 

Providing you're the right name for item in the DECORATE, it will drop.

 

I stick to the original names of items, ammo, weapons, ect though. I don't change them around. I'm still in the process of learning some things but I got a lot of things covered to do what I need to do for my mod for the time being.

 

Best thing to do is do what I did. Make a backup copy of your custom wad/mod and play around with the backup so you know if something goes wrong with the backup, you still got the original copy of your work safe. Then once you got everything sorted, you can put in your original copy via copy and paste. It's what I do.

Share this post


Link to post
  • 0

Ok, I've been able to figure that SLADE is going to save sprite offsets in the PNG files themselves (I couldn't get TEXTURES to work)--so now the items are actually showing up. And I've figured out how to get multiple items to drop.

 

// Former Human
actor ZombieMan2 : ZombieMan replaces ZombieMan {
	States {
		XDeath:
		POSS M 5 {
			A_SpawnItemEx("DropHealthBonus",8,0,random(30,40), 0,frandom(2,5),frandom(-3,3),frandom(0,360));
			A_SpawnItemEx("DropHealthBonus",8,0,random(30,40), 0,frandom(2,5),frandom(-3,3),frandom(0,360));
			A_SpawnItemEx("DropArmorBonus",8,0,random(30,40), 0,frandom(2,5),frandom(-3,3),frandom(0,360));
			A_SpawnItemEx("DropArmorBonus",8,0,random(30,40), 0,frandom(2,5),frandom(-3,3),frandom(0,360));
			}
		POSS N 5 A_XScream
		POSS O 5 A_NoBlocking
		POSS PQRST 5
		POSS U -1
		Stop
		}
	}

Now I just need to figure out how to get things to drop when a chainsaw is used.

Share this post


Link to post
  • 0

Textures have to be in a separate file in your custom wad/mod. Highlight all your textures that you added, right click on the highlighted textures, go down to graphic, then select 'Add to TEXTUREx' and it'll create a file for them. They don't go in the DECORATE file. 

 

To get gibbed enemies to drop items when the chainsaw is used on them... I've never tried that, so I don't know. When I added 'dropitem' to enemy files in DECORATE, they always drop the item, whether gibbed or not. You seem to be doing things differently from me. Maybe you're using a different Doom Builder to what I'm using or creating a mod for specific source ports so the coding has to be done differently for it to work??? 🤷🏻‍♂️

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×