• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Spell] Absorption shield

Status
Not open for further replies.
Level 11
Joined
Jan 2, 2016
Messages
472
I hope you guys could give me some tips on how i could make this.

What should this spell do ?
Caster casts a shield on another target ,lasting `N` seconds and delaying all damage took by the target , when the shield expires all the damage the target took goes onto the caster.

Do i need DDS or could it be done without it , since somehow i need to register the damage taken ?
 
Level 12
Joined
May 22, 2015
Messages
1,051
You should probably go with a DDS since it will just open up so many possibilities. However, you could scrape together some bits of a DDS to make your own custom thing here.

The premise of a DDS is this:
There is a "unit takes damage" event, but it can only be fired for specific units (as opposed to something like "unit is attacked" where you can make it check all units in the game easily).
The solution to this problem is that you can actually add events to triggers whenever you want to. The basic DDS starts with this trigger:
  • DDS Setup
  • Events
    • Unit - A unit enters <Playable Map Area>
  • Conditions
  • Actions
    • Trigger - Add (Triggering unit takes damage) as an event for (DDS Run)
  • DDS Run
  • Events
  • Conditions
  • Actions
    • Do Nothing()
All you'd have to do is change the "setup" part to only add the target of your spell to some custom trigger that handles collecting the damage and also preventing the unit from taking damage.
 
Level 11
Joined
Jan 2, 2016
Messages
472
  • DDS Setup
  • Events - A unit starts the effect on an ability
  • Conditions - Ability being cast equal to Shield
  • Actions
  • set TargetUnit = Target Unit of ability being cast
  • set CastingUnit = Casting Unit
  • Trigger - Add ( TargetUnit unit takes damage ) as an event for DDS Run
  • DDS Run
  • Events
  • Conditions
  • Actions
  • Trigger - Run CollectDamageTrig
  • Wait until ( duration of shield ends ) checking every X seconds
  • Unit - cause ( someunit ) to damage ( CastingUnit ) dealing DMG
Something like this ? All i'm missing is damage collection which i would then put into `DMG` .
When it comes to preventing dmg i would probably add 100% magic and physical resistance to the targeted unit , although don't know how well that would pan out.
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
Almost got it! You just have to put the "wait until" and damage parts into the DDS Setup trigger. The DDS Run trigger will fire every time the unit takes damage.

Note that this setup will not allow for the spell to work on more than one unit at a time. If this is not a problem, then you can continue with this.

To finish off the trigger, instead of the "Trigger - Run CollectDamageTrig", you can just collect the damage there. DDS Run in this case is the CollectDamageTrig. It'll look like this:
  • DDS Setup
  • Events
    • Unit - A unit starts the effect on an ability
  • Conditions
    • Ability being cast equal to Shield
  • Actions
    • set TargetUnit = Target Unit of ability being cast
    • set CastingUnit = Casting Unit
    • Trigger - Add ( TargetUnit unit takes damage ) as an event for DDS Run
    • Wait until ( duration of shield ends ) checking every X seconds
    • Unit - cause ( someunit ) to damage ( CastingUnit ) dealing absorbedDamage
  • DDS Run
  • Events
  • Conditions
  • Actions
    • set absorbedDamage = absorbedDamage + (Event Response - Damage)

Though there is still a potential problem with it. I think you also need to add the target unit to a unit group so that you don't add it again. If you add the same event twice, it will double the damage the second time, and triple it the third time. You also need to make sure it is not counting the damage for the unit when the shield is gone. I recommend using some kind of a buff to check before adding the damage - I like to use tornado aura for these since they don't create an icon.

So it's getting a little more messy, but here's a rough draft of what it would look like:
  • DDS Setup
  • Events
    • Unit - A unit starts the effect on an ability
  • Conditions
    • Ability being cast equal to Shield
  • Actions
    • set TargetUnit = Target Unit of ability being cast
    • set CastingUnit = Casting Unit
    • if (not TargetUnit in ShieldUnitGroup)
      • Unit Group - Add TargetUnit to ShieldUnitGroup
      • Trigger - Add ( TargetUnit unit takes damage ) as an event for DDS Run
    • Unit - Add ability (custom tornado aura) to TargetUnit
    • Wait until ( duration of shield ends ) checking every X seconds
    • Unit - cause ( someunit ) to damage ( CastingUnit ) dealing absorbedDamage
    • Unit - Remove ability (custom tornado aura) from TargetUnit
  • DDS Run
  • Events
  • Conditions
  • Actions
    • if (level of custom tornado aura for Triggering Unit equal to 1)
      • set absorbedDamage = absorbedDamage + (Event Response - Damage)

I guess this is why you should try to get into a DDS sooner than later haha. Hopefully this is still helpful.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Thanks i get it now. So if i wanted to split this spell into two as in absorbing pysical and magical damage i would need DDS ?
Yes it gets insanely complex to differentiate physical and magical damage. I know because I was dumb enough to make my own DDS complete with minor bugs I'm still working out haha. I learned a ton doing it, though, so it was worth it.

The gist of detecting magic damage is that you give every unit 200% magic resistance. They then take negative damage equal to what they should have taken. In the DDS, if it sees the damage dealt is negative, it knows that it is magic damage. The complicated part is flipping it back to positive damage without blowing up you map lol.
 
Status
Not open for further replies.
Top