• 🏆 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] autocast triggering

Status
Not open for further replies.
Level 2
Joined
Jun 9, 2005
Messages
11
I want to make a trigger that triggers of an autocast spell, in this case frost/searing arrows. This works when the spell is casted manually but not trough autocasting. Is it possible to make this trigger go off when the spell is cast trough autocasting?
 
Level 2
Joined
Jun 9, 2005
Messages
11
But how does morphlings(dota) moprh abilities work then, since they change his stats while morphs autocast is active?
 
Level 2
Joined
Jun 9, 2005
Messages
11
From what I know morphlings stats gets changed eaven if he's stunned or dead, if autocast is active. Heal and inner fire cannot be cast under those conditions if I remember right. Is there a way to detect if autocast for an ability has been turned on/off?
 
Level 3
Joined
Oct 23, 2007
Messages
36
All autocast abilities have a command that is issued when autocast is turned on and off. Searing arrows is "unflamingarrows". Note that "on attack" autocast are different than cast autocast.

To detect "on attack" autocast, you must have one trigger that knows when the auto cast is turned on.
  • Searing Arrows OnOff
    • Events
      • Unit - A unit Is issued an 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 (Order(flamingarrows))
        • Then - Actions
          • Trigger - Turn on Searing Arrows Detection <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(unflamingarrows))
        • Then - Actions
          • Trigger - Turn off Searing Arrows Detection <gen>
        • Else - Actions
Then, a second trigger will create the effect every time the unit attacks.
  • Searing Arrows Detection
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Priestess of the Moon
    • Actions
      • -------- This number below in the condition corresponds to the mana cost of the ability --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Greater than or equal to 8.00
        • Then - Actions
          • -------- Insert "on attack" actions here --------
        • Else - Actions
This of course, is not MUI, and has the problems with using "on attack"
 
Level 2
Joined
Jun 9, 2005
Messages
11
I just managed to figure out what you just wrote, but thanks anyway ^^
Frost arrow doesn't have order strings for activate/deactivate but black and searing arrow has, but I guess that doesn't really matter. If you must use frost arrows I think you can add searing/black arrows activate/deactivate strings to frost arrow.
 
Level 2
Joined
Jun 9, 2005
Messages
11
There are coldarrow and uncoldarrow order strings, if those are added to the cold arrow abilitys use/turn on and turn off, cold arrow can also be used for this. I did so and managed to prevent this being bugged by pressing stop by using GUI.

  • frost arrows
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • fratog Equal to True
      • (Unit-type of (Attacking unit)) Equal to Lady Vashj
      • (Mana of (Attacking unit)) Greater than or equal to (39.00 + (Real((Level of Frost Arrows for (Attacking unit)))))
    • Actions
      • Set fraloc = (Position of (Attacking unit))
      • Set fratar = (Position of (Attacked unit))
      • Wait (((Distance between fraloc and fratar) / 1500.00) + 0.45) seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Cold Arrows (Stacking)) Equal to True
        • Then - Actions
          • Unit - Create 1 for (Owner of (Attacking unit)) at fraloc facing fraloc
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Frost Nova to (Last created unit)
          • Unit - Set level of Frost Nova for (Last created unit) to (Level of Frost Arrows for (Attacking unit))
          • Unit - Order (Last created unit) to Undead Lich - Frost Nova (Attacked unit)
        • Else - Actions
          • Game - Display to (Player group((Owner of (Attacking unit)))) the text: fail
      • Custom script: call RemoveLocation(udg_fraloc)
      • Custom script: call RemoveLocation(udg_fratar)
It seems as it takes about 0.45 seconds for the buff to become applied to the target after it's been hit.
 
Level 3
Joined
Oct 8, 2007
Messages
41
u can't detect frost/searing arrows auto-casts, but u can detect other auto-casts, like the Priests "Heal"

I had an auto cast spell, based off replenish and it was detected by my code as so: (but somehow it seems to have no target wheter autocasted or manually casted)
JASS:
function Mana_Conditions takes nothing returns boolean
 return GetSpellAbilityId() == 'A011' 
endfunction

function Trig_Mana_Actions takes nothing returns nothing
 local real mana = GetUnitState(GetSpellTargetUnit(),UNIT_STATE_MANA)
 call SetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA, (mana+200.0))
 call DisplayTextToPlayer(Player(0),0,0,"The Actions triggered")//to see if it triggered
endfunction

//===========================================================================
function InitTrig_Mana takes nothing returns nothing
    set gg_trg_Mana = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Mana,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Mana, Condition(function Mana_Conditions))
    call TriggerAddAction( gg_trg_Mana, function Trig_Mana_Actions )
endfunction
 
Status
Not open for further replies.
Top