How to deal a specific element damage without triggering spell?

FarAwaY

TH.net Regular
Reaction score
9
Okay here's my problem:

I want to make a kind of system that deals Fire/Ice/Lightning, etc damage to my targets whenever I cast a spell.

The thing is, I don't want to be triggering every single spell (imagine 60-100 spells and I have to trigger...). I also dont want to be triggering a simple spell like chain lightning or shockwave when you already have that spell in the Object Editor.

So my question is, how do I deal a specific element damage for any spell without having to trigger the entire spell itself? I've looked through a few systems, but with my low understanding of JASS, I cant really use them.

Please help! +rep
 

canons200

New Member
Reaction score
50
use pierce, normal and magic attack to replace fire, ice amd lightning? at such you only need to change to armor rate, simple and easy
 

FarAwaY

TH.net Regular
Reaction score
9
I know.

But still, you have to trigger them. Imagine casting a chain lightning with 0 damage. How do you trigger every single unit being hit accurately...and dealing the elemental damage to them?
 

tommerbob

Minecraft. :D
Reaction score
110
you would likely need a damage detection system. Weep's GDD is the best if you want to use GUI. Then, whenever a spell is cast, place the spell caster in a unit group, and detect whenever damage is dealt. If the damage dealer is in the unit group, deal the appropriate damage/damage type. I think that would probably work. I don't think there's any way you can do this without triggering your spell damage.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Use a dummy to cast the spell, associate the caster with the dummy with a hashtable, and use damage detection to trigger the caster dealing the real damage when it detects the dummy's 0 damage.
 

FarAwaY

TH.net Regular
Reaction score
9
Use a dummy to cast the spell, associate the caster with the dummy with a hashtable, and use damage detection to trigger the caster dealing the real damage when it detects the dummy's 0 damage.

Mind explaining in detail or showing the code?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Mind explaining in detail or showing the code?
This assumes you're familiar with dummy units (which you can learn from other threads) and that you're using GDD for damage detection.

Here's an example for Chain Lightning, where the ability HeroChainLightning is a fake ability which does nothing but target a unit, and DummyChainLightning is a chain lightning spell dealing 0 damage:

Trigger:
  • Hashtable Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set DummyHash = (Last created hashtable)

Trigger:
  • CastSpell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to HeroChainLightning
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Last created unit)) in DummyHash
      • -------- The following is needed if the dummy is a ground unit, or it may be slightly askew --------
      • Custom script: call SetUnitX(bj_lastCreatedUnit, GetLocationX(udg_TempPoint))
      • Custom script: call SetUnitY(bj_lastCreatedUnit, GetLocationY(udg_TempPoint))
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Unit - Add DummyChainLightning to (Last created unit)
      • Unit - Set level of DummyChainLightning for (Last created unit) to (Level of HeroChainLightning for (Triggering unit))
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Target unit of ability being cast)
      • Custom script: call RemoveLocation(udg_TempPoint)

Trigger:
  • Detect Hits
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Level of DummyChainLightning for GDD_DamageSource) Greater than 0
    • Actions
      • -------- This is to overcome a World Editor shortcoming where you can't use custom variables in Hashtable recall --------
      • Custom script: set bj_lastReplacedUnit = udg_GDD_DamageSource
      • Unit - Cause (Load 0 of (Key (Last replaced unit)) in DummyHash) to damage GDD_DamagedUnit, dealing (100.00 + (25.00 x (Real((Level of DummyChainLightning for GDD_DamageSource))))) damage of attack type Siege and damage type Normal


The hashtable is used to associate the hero with the dummy unit, so you can deal the damage from the actual hero, which will cause proper aggro from units it hits; if you just have the dummy unit as the source, targets will flee since the dummy is invulnerable.

Missile spells can be even simpler, using no dummy units and detecting when a unit takes damage in the presence of a buff placed by the missile spell, removing the buff and then dealing the actual damage. Damage over time would be more complicated, needing to be dealt with a periodic trigger.

There's no avoiding triggering damage for each spell that you want to deal non-spell type damage, but it can be easier than having to trigger the entire spell's effects.
 

FarAwaY

TH.net Regular
Reaction score
9
Thanks weep. However, if we have to trigger every single spell...that would mean 200-400+ triggers. Thats not very efficient.

Hence, I'll give u +rep for trying to help, though it also means anyone trying to do this on a large scale must be either insane, or insanely motivated. I am neither, so I think I'll pass on such a system.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
weeps solution is the best of all i could imagine. still, the triggers you need for every spell are not very big, you only need to create dummy units and give them the right abilities.
 

Bird

Ultra Cool Member
Reaction score
29
Okay here's my problem:

I want to make a kind of system that deals Fire/Ice/Lightning...

The thing is, I don't want to be triggering every single spell...
I'm afraid your wishes are non-congruous.

I presume you have Abilities/Items that add Fire/Ice/Lightning Resistance? Without them, what is the point of wanting to do Elemental damage? WC3, in and of itself, does not make use of Elements like Diablo 2 does (huge glaring oversight, IMO). So you cannot make use of Elemental Damage/Resistance without triggering it.

You have to make a formulas that first calculate the Damage, then make conditionals for each type of Resistance (does the Target have Fire Resistance Item, etc etc), THEN deal the damage.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top