Damage based on # of inventory item-X

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Damage based on # of inventory item-X

Post by Amuscaria »

I asked about this years ago, long before Doomscript/Zscript was added and was told to wait until the scripting implementation. Now that Zscript is in, I want a projectile or hitscan to do x-amount of damage based on a certain inventory item. Say, something like:

Code: Select all

Damage (#DamageIncrease)*10
or something. Is this possible now? If so, what's the best way to do this?
User avatar
Raziel236
Posts: 313
Joined: Tue Jul 02, 2013 7:26 pm
Contact:

Re: Damage based on # of inventory item-X

Post by Raziel236 »

What's your idea with this?
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Damage based on # of inventory item-X

Post by Ryan Cordell »

You could probably plop in CountInv if you want it to be based off inventory item quantity.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Damage based on # of inventory item-X

Post by Amuscaria »

Ryan Cordell wrote:You could probably plop in CountInv if you want it to be based off inventory item quantity.
So I didn't need Zscript for this, and could have done this directly from decorate?
Raziel236 wrote:What's your idea with this?
I have a weapon that increases the the the player's inventory by 1 "DamageMult" item every time you hit something. The idea is to have the weapon do more damage the more hits you make, but you lose all of this charge when you take damage.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Damage based on # of inventory item-X

Post by Ryan Cordell »

Amuscaria wrote:So I didn't need Zscript for this, and could have done this directly from decorate?
If pre-zscript Damage (/DamageFunction) could support using CountInv, then sure. Otherwise..
jdagenet
Posts: 77
Joined: Tue Aug 09, 2011 10:26 pm

Re: Damage based on # of inventory item-X

Post by jdagenet »

Ryan Cordell wrote:
Amuscaria wrote:So I didn't need Zscript for this, and could have done this directly from decorate?
If pre-zscript Damage (/DamageFunction) could support using CountInv, then sure. Otherwise..
You actually can do this in DECORATE by performing inventory state jumps that go to different damage functions.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Damage based on # of inventory item-X

Post by Amuscaria »

jdagenet wrote:
Ryan Cordell wrote:
Amuscaria wrote:So I didn't need Zscript for this, and could have done this directly from decorate?
If pre-zscript Damage (/DamageFunction) could support using CountInv, then sure. Otherwise..
You actually can do this in DECORATE by performing inventory state jumps that go to different damage functions.
This is how I'm currently doing it, but its impractical if I do it for more than a few states. I'm looking for something that is more dynamic that won't require me to redo the entire set of states each time I change the weapon's behavior.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Damage based on # of inventory item-X

Post by Ryan Cordell »

jdagenet wrote:You actually can do this in DECORATE by performing inventory state jumps that go to different damage functions.
That stupid, pointless amount of code bloating is exactly what he's trying to avoid. :P
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Damage based on # of inventory item-X

Post by Matt »

in Decorate, I would add a user_dmg uservar, define damage as damage(user_dmg), and add the countinv to the user_dmg before it's needed.

if the actor is a hitscan coming from a shooter, just add countinv to the damage parameter in whatever you're using to call the hitscan attack.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Damage based on # of inventory item-X

Post by Amuscaria »

Vaecrius wrote:in Decorate, I would add a user_dmg uservar, define damage as damage(user_dmg), and add the countinv to the user_dmg before it's needed.

if the actor is a hitscan coming from a shooter, just add countinv to the damage parameter in whatever you're using to call the hitscan attack.
Neat! I'll give this a try. Much thanks! :D
Locked

Return to “Editing (Archive)”