Bonus Triggered Spell Damage Help

MorbazanRhot

New Member
Reaction score
7
So I'm working with enhancing my spell damage by scaling it with the casters intelligence, but I've run into a problem: timing the damage to when the spell hits. This isn't as much of a problem with aoe spells because you can set the damage to happen after a certain amount of time, but for single target spells I've had to live with just using waits and hoping for the best (never a good thing). Let me give an example:

Firebolt Bonus
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Firebolt yes
Actions
Wait 0.30 seconds
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (0.50 x (Real(WizardSpellDamage))) damage of attack type Spells and damage type Fire

Now the first problem is that based on the distance from the target it may hit at a different time than projected making the damage look even more off. An even bigger problem is that if you issue another order (most usually move) before the wait time is up, the bonus damage wont even resolve. So that leads me to my question: Is there a way to make the trigger occur when a unit takes damage from or is affected by a spell as opposed to when the spell is cast/resolves? Or if there's no answer for that, is there atleast a better way of timing the damage so that it's not so buggy? Thanks a lot in advance, and of course, easy +rep for anyone who can help :).
 

THE_X

New Member
Reaction score
49
Code:
Firebolt Bonus
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Firebolt yes
Actions
Set (firebolttarget) equal to target of ablity being cast
Unit - Cause (Casting unit) to damage (firebolttarget), dealing (0.50 x (Real(WizardSpellDamage))) damage of attack type Spells and damage type Fire

you need to set the unit that it is casted upon into a variable
 

MorbazanRhot

New Member
Reaction score
7
Ah, that's a good call, that would fix the bug with not dealing the damage after a wait time, thanks. However, if possible I'd still like an answer to either (or both if possible) of my questions: how to make a trigger go off when a unit is affected by a spell and how to better time the damage of the spell to when the unit gets hit (without having instant or incredibly high-speed spells).
 

THE_X

New Member
Reaction score
49
if the unit has a buff then just use the wait for condition (wait until (firebolttarget) has the buff of (then the buff it has) waiting every ... seconds.

that way it will wait untill its effected checking the time u have but that is still a wait trigger but better fitted to have your wants
 

MorbazanRhot

New Member
Reaction score
7
Well that works, kind of. In firebolts's case, the buff would be a .1 sec stun, so that's not very likely to be detected, or atleast consistently. I could make it checked every .05 seconds, but I'm afraid of having enough of those going at the same time might cause some lag. And even if I decided to give it a buff that lasted, there aren't enough different base buffs in the game to give them to all the different spells. So while that is a good idea for handling some spells I have, it wont really solve the bulk of my problems. Any more ideas?
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
Use "Unit - A unit takes damage"

It's a specific unit event, so you'll have to dynamically add the event using Trigger - Add Event.
 

MorbazanRhot

New Member
Reaction score
7
I'm afraid I'm not sure quite what you mean... I'm aware of the event that occurs when a unit takes damage, and I know that upon casting the spell I could set the targetted unit to a variable and then have the unit takes damage trigger when that specific unit takes damage, which would work for when the spell hits, unforunately that still doesn't work. The unit could very easily take damage from another source before the spell hits, thereby triggering the event even though it shouldn't go off. So if that's what you meant, thanks anyway for the effort, or if it's not I could use a little clarification please. That or if anyone else wants to answer the question(s) for me, that would be great too. Pretty please? :)
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
Use the unit takes damage and, every time it happens, check if the unit has the buff.

You could also check if the damage source is your unit, although that wouldn't be MUI with just GUI.
 

MorbazanRhot

New Member
Reaction score
7
Well, I appreciate the idea because it would work if it weren't for the buff problem I mentioned above. There aren't enough base buffs in the game to assign one for each single-target spell, and then if different spells/abilities have the same buff then once again the damage could still trigger off of an incorrect source. Anyone/anything else? Please?
 

darth-yoda

New Member
Reaction score
15
If you want the damage to be timed more closely with the projectiles impact you could use...

Code:
Wait ((Distance between Caster_L and Target_L) / 1000.00) seconds

Just divide the distance by the projectiles speed to get a more accurate timing. However if the projectile is slow and the target moves the timing could end up pretty far off. But if the projectile is fast and the cast distance isn't like 2000 you proly wont notice the difference. Anyway thats what I'm using in my map for a similar spell.
 

MorbazanRhot

New Member
Reaction score
7
Wow, thanks, I had thought there must be some way to do something like that but really had no clue quite how. That should work very well and pretty much entirely solves my problems. Thanks again :). However, if anyone can answer my other question (how, if there is a way, to make a trigger occur when a unit gets affect by a spell rather than when a unit casts the spell) that would be awesome. Again I'm not sure it's even possible, so I'm just throwing this out there. Thanks again to everyone who has helped!
 

Korolen

New User (Why do I keep getting those red bars?)
Reaction score
69
However, if anyone can answer my other question (how, if there is a way, to make a trigger occur when a unit gets affect by a spell rather than when a unit casts the spell) that would be awesome. Again I'm not sure it's even possible, so I'm just throwing this out there.
As I said, register Unit - Takes Damage. Then, either check if the unit has the buff (you can make as many custom buffs as you want), or check if the damage source was the caster, by use of a variable. Or check if the damage source's current order is your ability, if it has a reasonable follow-through time.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top