• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Resist specified attack type spell

Status
Not open for further replies.
Level 2
Joined
Feb 17, 2017
Messages
26
Hello everyone,

I'm new to the forum but I have quite some experience to the WE already.
Basically what I'm trying to do is create an aura spell that can absorb a specified attack type, eventually with help of triggers. Please note I am not looking for ANY kind of attack reduction like berserk or hardened skin.

Basically this is the context:

I created a hero who can cast a spell named "wrath of fire", which is basically a copy of the mountain king's thunder clap, with the difference being that it deals damage of type SPELL => FIRE to any nearby units (including ally) and of course without the thunder clap's buff and effect. I did fine with the triggers so far.

The reason I changed the targets to enemy AND ally is for balance reasons, and also because I wanted to include another aura spell that will reduce fire damage taken to allies, protecting them from the fiery blast.
Let me be clear, "just change the targets to enemy only" is not an answer I will accept, this is the way I want it.

I managed to create a dummy aura around the hero giving a dummy buff to him and his nearby allies with all the animations and other artistic stuff I need. The concerned units really look like they have the effect of that buff.
But what's missing is the actual effect of that buff. And I can't find a way to simulate it with triggers.

So far I think that the trigger code should look something like this:

Event:
A Unit is attacked

Condition:
Attack type is equal to Spell => Fire

Action:
Pick all units of the playable map area
If picked unit has "specific buff", then reduce damage taken by xx%, else Do nothing


Here's my main problem: I don't know if there are a condition and an action that can do this in the WE. I mean I didn't find any sort of "attack type" in the boolean condition neither have I found an action that reduces a picked unit's taken damage.
It's just frustrating to see how close I am to achieve what I want...

Anyway,
Thank you in advance for your support
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
First of all as far is I know spells like thunderclap and warstomp can never target allies. This is hardcoded.
The event unit is attacked only fires when the attacking unit starts the attacking animation. This event has nothing to do with the actual effect of an attack.
You need the event unit - takes damage. This event only exists for specific unit event.
However there are plenty of Damage Detection Systems (DDS) on Hive which allow you to have a unit takes damage event for any unit.

There is no possibility to check which attack type a spell has. There are some DDSs that can distinguish between physical and magic damage though.
If you really want to use different attack types for spell damage, you need to manually define the attack type of a spell before using the damage target action.
This means that you need to trigger the damage of all spells you want to have attack types.

Before dealing damage set a variable to a value. In this example attacktype 4 = fire
  • Deal Damage
    • Events
    • Conditions
    • Actions
      • Set AttackType = 4
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
You make a trigger that modifies the damage, if attack type = fire and the unit has the buff.
  • Damage Event
    • Events
      • -------- For this event you need a DDS --------
      • Unit - A takes damage
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamagedUnit has buff FireShield) Equal to True
          • AttackType Equal to 4
        • Then - Actions
          • -------- reduce fire damage --------
        • Else - Actions
For the DDS I would highly recommend to use GUI Damage Engine v3.6.0.1 , because it is easy to use, can distinguish between physical and magic damage and can easily modify/block damage.
 
Level 2
Joined
Feb 17, 2017
Messages
26
Thank you for your support, I think I see where you want to go.

So there is really no way to detect a specific spell type damage without having to use a dds? If I understand well, there is a possibility to give spell resistance in general (I think I may figure that one out, perhaps with the banshee spell) but not specific. This would mean that your way of dealing with it would make units with this buff only resistant to the spells I specified to deal fire damage.
Oh well, I make up for it, units almost immune to the archimage's basic attack and flame spell would be really too overpowered after all:) Hardcode multiplayer people know what I mean :D
In this case it might also come in handy for this buff effect to only affect the wrath of fire spell don't you think?

Anyway let's keep at it and do the method with fire damage, I still need a bit of practice
So basically, if I understood correctly, I first create a trigger, that will give a value to the variable attacktype in the situation where the hero casts his fiery explosion, but are you sure I need no specified start event for it?
After this is done, I create another trigger that will verify if both conditions are true (buff and attacktype value) and create an if/then/else action in the event where a unit takes spell damage
Looks fine to me, I'll try and keep you updated if it worked for me

Just about the WE coding, I only found the If/then/else action that displays in one line and stops me from doing more than just one action to a set condition. Where can I find the If/then/else action you just showed in your screenshot?

About thunderclap only concerning enemy, you're right. But what I did was using the object editor to copy the spell and change the concerned targets and damage and damge type dealt, and deleted the buff and effect it gives (speed and cooldown reduction set to 0% and duration set to 0 seconds).
Though I wonder if it wouldn't be better to create a dummy spell with no ingame effect and add those with triggers instead. But in this case I don't have any idea how to create a dummy spell, when I try to I have to chose a base spell. Is there no way around?


Well... that's a ton of questions that came up^^
Thank you in advance.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
So there is really no way to detect a specific spell type damage without having to use a dds?
The dds allows you to detect damage at all, so you need it to even know if a unit takes damage.

but are you sure I need no specified start event for it?
Of course you need a event to start this trigger. I just showed an example how to use it. Your event would be "starts the effect of an ability", if the damage comes from a spell.

The detection of specific spell types is not possible at all. What I suggested was an abstract definition of your own spell damage types before using the trigger to damage a target. When a unit takes damage you make different things depending on the spell damage type.

About thunderclap only concerning enemy, you're right. But what I did was using the object editor to copy the spell and change the concerned targets and damage and damge type dealt, and deleted the buff and effect it gives (speed and cooldown reduction set to 0% and duration set to 0 seconds).

Yes it is possible to change the targets allowed to allies/friends, but it won't have an effect. As I said it is hardcoded that thunderclap cannot target allies/friends.

I have attached a map with the wrath of fire spell and a fire protection aura. I am using the Bribe's GUI engine, I recommended above. This system has already implented the option to define your own damage types. I used the thunderclap as base spell, set targets allowed to none and triggered the damage.
 

Attachments

  • FireProtection.w3x
    33.9 KB · Views: 77
Status
Not open for further replies.
Top