• 🏆 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!

[Trigger] Spells with attribute based damage

Status
Not open for further replies.
Level 3
Joined
Jun 19, 2014
Messages
26
So, as the new Editor (1.31) allows to change any object field value with triggers, I was wondering which event should I use to make a base spell whose damage increases with its level and an attribute value? For example, a Carrion Swarm spell:

Damage: 100 x Spell Lvl + 1 x Intelligence

With this formula the damage will increase every time the hero level ups the spell or gains any Intelligence, so my question is how I can make a trigger that updates this spell damage every time any of those conditions is filled?



PS: Sorry for any grammar mistakes, English isn't my native language (and it's 0:30 AM here, I'm sleepy)
 
Last edited:
who I can make a trigger that updates this spell damage every time any of those conditions is filled?

Hello Arkane. (*how is to be used in context with this question instead of who (how can I))

The events which you are looking for are a unit gains a level, or when a unit picks up an item. When the Hero learns the spell, start tracking his intelligence points. On these events, check if the some values changed and adapt accordingly by making the changes to the ability of the Hero.

Alternatively, if you can trace the damage type back to the spell, you can just alter the damage amount directly without having to worry about changes in the spell's level and the caster's Intelligence. For this option, copy the following custom script:

JASS:
call TriggerRegisterAnyUnitEventBJ(gg_trg_<TriggerNameHere>, EVENT_PLAYER_UNIT_DAMAGED)

On map initialization, in a separate trigger, call that function. This will allow your trigger to listen to damage events. To manipulate damage, you can use BlzSetEventDamage via Custom Script.
 
This depends, if you need the damage value beeing correct ouside of the casting you need to do what mypad said, Update Damage on Levelup and everytime your attributes change.
If you only want your spell to deal damage increased by int then you can use one of the Channels/Begins casting or Starts the effect of an ability Event. In such an event you change the data you want to change and it affects the current casting. Also important is that you have to change/read units ability Level - 1.

Damage should be RealLevelField. You also need to know the raw code value names for the fields you want to read from/write onto (even in gui). Cause they are named like that "Damage ('Hbz1')" or "Damage ('Htc1')".

To change the ass-swarm spells damage one would need to change the realFields 'Ucs1' (damage) and 'Ucs2' (Max Damage)
 
Last edited:
Level 3
Joined
Jun 19, 2014
Messages
26
Thanks for the help guys, I did it, my intention was to change the damage dynamically because I wanted to update the tooltip too, so the player would know exactly how much damage the spell will do.

Also important is that you have to change/read units ability Level - 1.
Tested and no, level 1 index is 0.

By the way, how can I call the native damage detection now? MyPad already told one, but the others, like changing damage after armor reduction or even the damage type?
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
Level 24
Joined
Feb 9, 2009
Messages
1,787
Also, I forgot you wanted it to use carrion swarm!
To get around this, create a dummy unit and store your caster on it, detect the damage and see if it's dealt by "Carrion Dummy" and then set the damage to "0.00" while causing your caster to deal attribute based damage.

Which reminds me I have a more updated version of that map I posted with Fan of knives being used, same method I just mentioned above, I think this one uses unit indexer made by bribe, but in the newer version of damage engine it's no longer required!

And lastly there's this option Shockwave/Carrion Swarm System v1.1

 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The best spell base for a line spell and damage detection is breath of frost ('ACbf'), it places a buff which can on damage be checked & removed without any sideeffects except for droping the dot part.
Actually, with damage type detection in Damage Engine, you can often differentiate between different spells cast by heroes by observing the different damage types.

If a hero is pure elemental, like the Fire Lord or Lich, it won't work. But mixed spell heroes you can do it, like Alchemist or Naga Sea Witch.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Level 24
Joined
Feb 9, 2009
Messages
1,787
@Bribe
I recall posing this question to you in the past regarding spell detection, I think it was damage level? (I.e. enhanced attack / black arrow) but is there a simpler method to adding attribute damage to the method I posted?

Ex:
EVENT: detect 0 damage event
CON: source with lv1 custom fireball,
ACTION: remove custom buff_statbasedfireball deal X damage


Relying on buffs is rather fickle as if two over lap in rapid succession then the above method will be less accurate.

On another note, I noticed a strange interaction with attempting to make the carrion swarm stat based, the max damage seemed to limit the targets hit despite being 0 damage and default (300 Max damage), but i'm not sure if I was using 4.0.0.0 or earlier...
 
Status
Not open for further replies.
Top