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

Triggered Spells that deal damage Problem

Status
Not open for further replies.
Level 5
Joined
Dec 11, 2010
Messages
101
I'll try to keep it simple, what I have here is a trigger that deals damage to a target.

  • Stat Based Spell Template
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to My Ability
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((Real((Strength of (Triggering unit) (Include bonuses)))) + 1.00) damage of attack type Spells and damage type Normal
NOTE: This action is one that uses my Attributes to deal bonus damage, but this relates to any "Unit - Cause (Triggering unit) to damage (Target unit of ability being cast)" type of trigger.

What my problem is, is that when i go to cast a spell it deals the damage on two occasions. In this case, my spell does 60 damage once the missile hits. The problem is, the triggered action goes off instantly.

(Example Problem: I can go to cast a spell and cancel it instantly, and they will still take the trigger-damage. This means i can cast-cancel infinite times without actually doing the ability and still deal trigger damage.)

Is there a fix for this, a way to make the trigger damage happen once the spell missile hits?
 
Level 2
Joined
Jan 2, 2013
Messages
16
The problem is that Finishes casting an ability doesn't have a target unit(i think).
You can use 2 triggers:
  • Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Set targeted = (Target unit of ability being cast)
  • Untitled Trigger 001
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit - Cause (Casting unit) to damage targeted, dealing 500.00 damage of attack type Spells and damage type Normal
 
Well the best way is to trigger the whole thing.
By using a dummy unit as missile and a periodic trigger to move the missile + checking if a unit is in range or the missile has reached it's max range.

If you use "Finishes casting an ability" you will lose a whole lot of data which cannot be used to calculate damage among other things.

In the case of "Finishes casting an ability" you will need a second trigger which checks for "Starts the effect of an ability" or "Begins casting an ability".

Triggering the whole thing is the best way to do it. But also a bit harder. Especially if it needs to be mui.
 
Level 5
Joined
Jan 23, 2014
Messages
152
Oh, I probably shouldn't go that far into that stuff. I guess ill just have to deal with it for the time being :3

Dont give up! It's really hard at first, but once you get the hang of it, it'll be like adding 1 + 1.

You can use a timer for that. Just count how many seconds it is for the missile to reach the target and then.
Add this in your actions.
Action
Countdown timer - start MyTimer as a one-shot timer for 1 second(for example)

And then create another trigger.
Event
MyTimer expires
Condition
Actions
Countdown Timer - pause MyTimer (you should always pause a timer after it expires)
Unit - cause (casting unit) to deal damage to ..........

See? Its just simple. Btw put the units in a variable.
 
Level 8
Joined
Jan 8, 2013
Messages
348
well elm0 thats not a good idea. what if the enemy ports away or dashes away? then the missile needs more then the time he counted before. its even if hes far away from the target or not.

my solution: if i get it right, you have a normal wc3 base spell with a missile. and if the missile hits the target should get bonus damage based on the attribut.

first: you trigger the whole spell.(best thing) thats sooo easy to trigger a missile spell dude :)

second: you make a new trigger which checks if the target gets damage.

like:
a unit starts the effetc of a ability
blabla
set Caster = triggering Unit
set Target = Target unit of ability beeing cast
add to dmg take the event - target gets damage.
turn onn second trigger


second trigger: (disabled)
target gets damage

Condition: Caster = damage source(but with this you can activate this trigger with normal hit or other spells thats why i should take solution one)

Action:
turn off trigger(becasue of infinite loop shit)
order Caster to damage Target


so with this he will get damage when the missile hits BUT you can also activate the dmg take trigger with normal hits or spells. or even items. so just trigger the missile :)
 
Level 5
Joined
Jan 23, 2014
Messages
152
That was just an example. But you got a point though. At least he has an idea now
 
Level 8
Joined
Jan 8, 2013
Messages
348
yeah but his idea is bad for gameplay. im no fan of timers in spells :D
just trigger it in loops. thats all ^-^
 
Status
Not open for further replies.
Top