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

Autocast Spell does not activate trigger

Status
Not open for further replies.
Level 3
Joined
Jan 13, 2011
Messages
33
Hi, I'm making a spell based on searing arrows that deals bonus magical damage equal to the caster's strenght at the target when activated. For this I simply used:
Event:
Unit Starts the Effect of an Ability
Condition:
Ability equal to Searing Arrows
Actions:
Set -Caster- = Triggering unit
Set -Target- = Target unit of ability being cast
Set -Damage- = Strenght of -Caster-
Cause -Caster- to deal -Damage- at -Target-

I feared this would't work and unfortunately it didn't. When I activate the spell manually it works finely, but when autocasted it doesn't. I do want the spell to be autocastable so I can't just change the spell type. Plus, I want the -Damage- to be bonus, which means I want normal attack damage to be applied as well. So what should I do?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
The problem occurs because while autocast in turned on, normal attacks do not cause event: 'Starts the effect of ability' therefore your trigger does not start.

Here is a tutorial which should help you do auto cast abilities by our own.

However, if your autocast abilities are instants and you need them for melee, you can use:
  • Events
    • Unit - Issue order with no target
  • Conditions
    • (Issued order) Equal to (flamingarrows)
  • Actions
    • Unit Group - Add Triggering unit to FAgroup
FAgroup represents units with bonus via attacks with autocast ability turned on.

Now, using any damage system like this one, we create trigger which checks if damage was done to trigger actions.
Trigger wrote with GDD system.
  • Events
    • Game - GDD_Damage becomes Equal to 0.00
  • Conditions
    • GDD_DamageSource is in FAgroup Equal to True
  • Actions
    • <stuff here>
For detecting when flaming autocast is turned off use: (see issed order string!)
  • Events
    • Unit - Issue order with no target
  • Conditions
    • (Issued order) Equal to (unflamingarrows)
  • Actions
    • Unit Group - Add Triggering unit to FAgroup
so unit will be removed from group, in which units get bonus via attacks.
However, as I said it works fine only for instant actions, like Melee attacks with auto-cast flaming arrows. Why? It works fine too for ranged, but:
Lets say you cast arrow, and immidiately turn off ability, your arrow will deal no bonus stuff since unit got removed immidiately from bonus effect group.

Remember to use proper Issed order strings, flaming arrows are only one of them.
 
Level 3
Joined
Jan 13, 2011
Messages
33
Hey thanks, I'll try it out soon enough. But couldn't I also try something like:
Event:
Unit - Issue order with no target
Conditons:
(Issued order) Equal to (flamingarrows)
Actions:
Set Dude=TriggeringUnit
Turn on [trigger2]

And in trigger2 (which would be initially off):

Events:
Unit is attacked
Conditions:
Attacking unit = Dude
Actions:
Order Dude to FlamingArrows AttackedUnit
Turn on [Trigger3]

Trigger3
Event:
Unit is issued order no point
Conditions:
Issued order = unflamingarrows
Actions:
Turn off trigger2

I have no idea if this could work... I just thought it could be easier... I think it sounds logical... You think it's worth trying?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Event:
Unit - Issue order with no target
Conditons:
(Issued order) Equal to (flamingarrows)
Actions:
Set Dude=TriggeringUnit
Turn on [trigger2]

And in trigger2 (which would be initially off):

Events:
Unit is attacked
Conditions:
Attacking unit = Dude
Actions:
Order Dude to FlamingArrows AttackedUnit
Turn on [Trigger3]

Trigger3
Event:
Unit is issued order no point
Conditions:
Issued order = unflamingarrows
Actions:
Turn off trigger2

Use trigger tags next time like: trigger (here paste triggers) /trigger. Keywords 'trigger' has to be between [] like:
  • .
  • Your trigger inst MUi, better add to unit group, so it will be MUI since actions are intant.
  • 'Turn on [trigger3]' in second trigger is useless. Let triggers that check is flaming is on/off be always turned on.
  • If you want to detect, if unit is attacked -> damaged better (since attacked fires even with just 'attack' animation) use GDD_Damaged unit is in FAgroup.
  • Now actions will fire when [U]damaged unit[/U] [I](not damage surce like last time)[/I] has autocast ability on.
 
Level 3
Joined
Jan 13, 2011
Messages
33
I don't need the spell to be MUI, only one Hero has this ability. As for the trigger tags I don't understand how to do that :S And I would like to know... If anyone could explain I'd be grateful (trigger (here paste triggers) /trigger. Keywords 'trigger' has to be between [] like:
  • , I tried but it didn't work?). Anyway, sorry for not using trigger tags but here's what I did:
  • Trigger (Slam Start)
  • - Events:
  • A Unit is issued an order with no target
  • - Conditions:
  • - Actions:
    • If Issued Order = flamingarrows
  • Then Set Dude=Triggering Unit
  • Turn on Slam Attack
    • If Issued Order = unflamingarrows
  • Turn off Slam Attack
  • Trigger (Slam Attack)
  • - Events:
  • A unit is attacked
  • - Conditions:
  • Attacking unit = Dude
  • - Actions:
  • Set DudeTarget = Attacked Unit
  • Turn on Slam Effect
  • Add to Slam Effect the event DudeTarget takes Damage
  • Trigger (Slam Effect):
  • - Events:
  • - Conditions:
  • - Actions:
  • Set SlamDamage = Strenght of Dude (include bonuses)
  • Cause Dude to deal damage = SlamDamage at DudeTarget
  • Turn off this trigger
  • This is what I did. Whenever i tried it (set flamingarrows to autocast, then attacked) the game crashed. After some searching, I found out that the Cause dude to deal damage trigger crashed it. I tried removing it and added a special effect to see if it worked and it did. What did I do wrong?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
^Exactly. I love times ages ago, when I though for sure this cant cause the crush, and I just kept doing so <was fun> :D

I will just make triggers for you.
Usee damage system I've linked already.
  • Events
    • Unit - A unit is issued order with no target
  • Conditions
    • Actions
      • If (All conditions are true) then do (Then actions else do (Else actions)
        • If - Conditions
          • (Issued order) Equal to (flamingarrows)
        • Then - Actions
          • Unit Group - Add (Triggering unit) to SlamGroup
          • Trigger - Turn on Trigger2
        • Else - Actions
      • If (All conditions are true) then do (Then actions else do (Else actions)
        • If - Conditions
          • (Issued order) Equal to (unflamingarrows)
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from SlamGroup
          • Trigger - Turn off Trigger2
        • Else - Actions
Second trigger: the actions.
  • Events
    • Game - GDD_Event becomes Equal to 0.00
  • Conditions
    • GDD_DamageSource is in SlamGroup
  • Actions
    • Set SlamDamage = Strenght of GDD_DamageSource (include bonuses)
    • Trigger - Turn off (this trigger)
    • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit dealing SlamDamage damage of attack type Magic and damage type Normal
    • Trigger - Turn on (this trigger)
If you want the damage be dealt only once, feel free to add 'Turn off' as the last action of second trigger.
What I've made, works like this:

-you turn on arrows, you deal bonus damage with each attack
-you turn off arrows, you no longer deal bonus damage on attacks

HERE COMES THE CHALLANGE


Write anything, ANYTHING with trigger tags.
You do it either by clicking TRIGGER tags on taskbar in message editor or writing
  • <- this word within '[' and ']', ending this with /trigger <- yes, the same word but with '/' at the front, and REMEMBER about '[' and ']
  • [h2]LAST TIP[/h2]
    • GO AND CLICK quote on any of mine posts, there are egzamples of using SUCH high technology, Enjoy! :D
 
Status
Not open for further replies.
Top