Jump to content

Custom Damage Types [SOVLED]


VoidEater

Recommended Posts

I've been looking into custom damage types for a mod a friend and I are working on and we're trying to figure a way to add something akin to sanity. We had two ideas, just add in a new meter for it and slap it on the HUD or replace armour with sanity. At the moment we're playing around with replacing armour however that would require making armour unaffected by normal attacks and making certain attacks that only affect armour and not health. My idea was to initially try making armour work similar to how it works in modern Doom games but I can't find any sources for that kind of info. Is there a way to do this at all or should we just stick to creating sanity from scratch and just adding it to the HUD?

Share this post


Link to post

If you want to do it with replacing armor, it wouldn't be too hard with a DECORATE script.

You can use a +PIERCEARMOR flag for "normal" attacks to get them to bypass armor.  Then if you have "Sanity" as a custom damage type, you just build you custom armor as absorbing 100% of damage while applying a 0.0 damage factor - that would have armor take 100% damage while passing 0% of the damage to the player.

 

https://zdoom.org/wiki/Actor_flags#Projectile

https://zdoom.org/wiki/Actor_properties#DamageFactor

 

That should do the trick.  You can also keep an "armor" system by applying the damage factor to "Normal" damage at the player level, and controlling it with with a custom inventory item.

Share this post


Link to post
1 hour ago, Burgish_Nilwert said:

If you want to do it with replacing armor, it wouldn't be too hard with a DECORATE script.

You can use a +PIERCEARMOR flag for "normal" attacks to get them to bypass armor.  Then if you have "Sanity" as a custom damage type, you just build you custom armor as absorbing 100% of damage while applying a 0.0 damage factor - that would have armor take 100% damage while passing 0% of the damage to the player.

 

https://zdoom.org/wiki/Actor_flags#Projectile

https://zdoom.org/wiki/Actor_properties#DamageFactor

 

That should do the trick.  You can also keep an "armor" system by applying the damage factor to "Normal" damage at the player level, and controlling it with with a custom inventory item.

Thanks a whole lot dude! This worked. For now we've just done a basic "replacing armour with sanity" type deal and at another time we're gonna have a little play around with creating a sanity system so we can keep armour and just add a value to the HUD. Thanks so much.

Share this post


Link to post
  • 2 weeks later...

I ended up solving this issue after doing some digging in some other mods. So thanks a bunch to the dev for Golden Souls 2, your coins helped me solve this.

 

I started by creating an ACTOR that inherited directly from the Inventory and couldn't go above 100:

Spoiler

Actor Sanity : Inventory 
{
	Tag "Sanity"
	Inventory.Amount 1 // Sets the amount of inventory items given by this item
	Inventory.MaxAmount 100 // Sets the max amount that can be held in the inventory
}

 

 

I then created an actual ACTOR that acted as an item pickup to add to the inventory item I had just created and had it inherit from CustomInventory:

Spoiler

ACTOR SanityBonus : CustomInventory 31000
{
	//$Title "Sanity Pill"
	//$Category Health and Armor
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.FANCYPICKUPSOUND
	+INVENTORY.NEVERRESPAWN
	+INVENTORY.KEEPDEPLETED
	Inventory.PickupSound ""
	Inventory.PickupMessage "Picked up a sanity pill."
	Inventory.MaxAmount 0
	States
	{
	Spawn:
		SAN2 ABCDCB 9
		Loop
	Use: 
		TNT1 A 0 A_JumpIfInventory("Sanity",0, 0) 
		TNT1 A 0 A_GiveInventory("Sanity",2) 	    
		TNT1 A 0
		Stop
	Pickup:
		TNT1 A 0 A_SetBlend(Blue, 0.35, 5, 0)
	}
}

 

 

Finally, I simply added it to the HUD. In my instance I simply replaced DOOM's ammo counter on the OG HUD (I had designed a custom HUD in photoshop for this):

Spoiler

// Armor
drawnumber 3, HUDFONT_DOOM, untranslated, armor, 221, 171;
// Health
drawnumber 3, HUDFONT_DOOM, untranslated, health, 90, 171;
// Sanity
drawnumber 3, HUDFONT_DOOM, untranslated, Sanity, 44, 171;

 

 

Lo and behold, it works! Increases, decreases and I've even now programmed the player to die when Sanity reaches zero thanks to help I received over here.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...