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

Triggering Auto-cast ability

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2009
Messages
13
I could find anything, what helps me, so I post here.

Is it possible to make auto-cast ability triggered? Because I've got an annoying problem: I want to make sacrifice ability auto-cast, so whenever hero uses skill he looses hp and gets bonus damage.

Please halp!
 
You don't need an autocast for that; use a normal active one.
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Sacrifice
  • Actions
    • If (All conditions are true) then do (Actions)
      • If - Conditions
        • (Key(dummy) is stored as a Handle of (Key(Triggering unit)) in Hashtable) Equal to True
      • Then - Actions
        • Unit - Kill (Load (Key(dummy)) of (Key(Triggering unit)) from Hashtable
      • Else - Actions
    • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 50.00)
    • Set Point1 = (Position of (Triggering unit))
    • Unit - Create 1 dummy for (Owner of (Triggering unit)) at Point1 facing default building degrees
    • Hashtable - Save (Triggering unit) as (Key(caster)) of (Key(Last created unit)) in Hashtable
    • Hashtable - Save (Last created unit) as (Key(dummy)) of (Key(Triggering unit)) in Hashtable
    • Unit Group - Add (Last created unit) to (TempGroup)
    • Hashtable - Save 30.00 as (Key(timer)) of (Key(Last created unit)) in Hashtable
    • Unit - Add (Claws of Attack) to (Triggering unit)
    • Unit - Set level of ((Claws of Attack) for (Triggering unit)) to (Level of (Ability being cast) for (Triggering unit))
    • Custom script: call RemoveLocation (udg_Point1)
    • Trigger - Turn on Trigger 2 <gen>
  • Trigger2
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (TempGroup is empty) Equal to True
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
            • Set Time = (Load (Key(timer)) of (Key(Picked unit)) from Hashtable)
            • Hashtable - Save (Time - 1.00) as (Key(timer)) of (Key(Picked unit)) in Hashtable
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • (Time) Equal to 0
              • Then - Actions
                • Unit Group - Remove (Picked unit) from TempGroup
                • Unit - Remove (Claws of Attack) from (Load (Key(caster)) of (Key(Picked unit)) from Hashtable)
                • Unit - Kill (Picked unit)
                • Hashtable - Clear all child hashtables of (Key(Load (Key(caster)) of (Key(Picked unit)) from Hashtable) in Hashtable
                • Hashtable - Clear all child hashtables of (Key(Picked unit)) from Hashtable
Just create a Claws of Attack based ability and give it levels. You can also use Battle Roar and just trigger the life loss, it's up to you actually.

The action "Hashtable - Save 30.00 ..." is the timer action. Adjust that "30.00" value to be your wanted duration. For this example, it lasts 30 seconds.
Unless you want to make something like this, use Battle Roar instead.

If you really want to mess with Autocast abilities, you need the trigger I gave you, but, except for the Event "Unit - A unit starts the effect of an ability", you will need an additional trigger that detects the autocast on/off. I would base the ability off "Heal", since it's the only autocast ability that detects when life is threatened. Just set the healing amount to 0 and Targets Allowed to Self. You also need to detect the autocast, as I said, so use
  • Trig
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
    • (Issued order) Equal to (order(healon))
This is the autocast on, and the following the autocast off:

  • Trig2
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
    • (Issued order) Equal to (order(healoff))
You will additionally need another trigger, to check when the spell is actually used (by itself, when the "heal" occurs by itself), so use

  • Trig3
  • Events
    • Unit - A unit is issued an order targeting an object
  • Conditions
    • (Target unit of issued order) Equal to (Triggering unit)
    • (Issued order) Equal to (order(heal))
The above trigger will detect when you cast the spell, but, when your life gets lower; just add your action Unit - Set life (to make the life loss).
The event "Unit - A unit starts the effect of an ability" will be used when the user manually presses the Heal ability. Of course the heal ability tries by default to recover the amount of life, so, you will end up having a really low health. So, forget the auto-casting issue on this problem, cause it can't happen; when the auto-cast will take place? When you attack? If so, use "Searing Arrows" to make this happen, because the Heal (which detects the hp and not when the unit attacks) will get your life really low, because it is made to work that way.
Searing Arrows orders are
  • (Issued order) Equal to (order(flamingarrows))
The above is for autocast on and the following for the autocast off
  • (Issued order) Equal to (order(unflamingarrows))
So, you can now create a damage detection system to check when a unit takes damage and if your unit has Searing Arrows on (just add your unit in a Unit Group and make a Boolean comparison through the Conditions to check whether it is in a Unit Group or not), then add your Claws of Attack ability and create the dummy, exactly like I told you in the first trigger.

Fore more about hashtables:
[•] http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/
 
Level 2
Joined
Aug 15, 2009
Messages
13
You don't need an autocast for that; use a normal active one.
Buddy, I need autocast, bcoz it works like that:
- Hero uses ability on enemy
- he looses 3% of current HP and deals it as damage
The problem occurs when autocast is enabled, he attacks, but it has no effect!

I decided to try with giving 999 bonus damage to skill: it killed enemy, but didn't take hp, so I don't know the way to tell trigger to start when uses ability passively!
 
Then, you need Searing Arrows ability and the following triggers:
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Trigger 3 <gen> the event ((Picked unit) takes damage)
  • Trigger2
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
  • Actions
    • Trigger - Add to Trigger 3 <gen> the event ((Triggering unit) takes damage)
  • Trigger3
  • Events
  • Conditions
    • ((Damage source) is in AttackingGroup) Equal to True
    • (Life of (Damage source)) Greater than (0.03*(Max life of (Damage source)))
  • Actions
    • Unit - Cause (Triggering unit) to damage (Triggering unit) dealing (0.03*(Max life of (Damage source))) of Attack type Spells and Damage type Normal
    • Unit - Set life of (Damage source) to ((Life of (Damage source)) - (0.03*(Max life of (Damage Source))))
  • Trigger4
  • Events
    • Unit - A unit is issued an order with no target
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Issued order) Equal to (order(flamingarrows))
      • Then - Actions
        • Unit Group - Add (Triggering unit) to AttackingGroup
      • Else - Actions
        • Unit Group - Remove (Triggering unit) from AttackingGroup
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Sacrifice
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Life of (Triggering unit)) Greater than (0.03*(Max life of (Triggering unit)))
      • Then - Actions
        • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast) dealing (0.03*(Max life of (Triggering unit))) of Attack type Spells and Damage type Normal
        • Unit - Set life of (Triggering unit) to (((Life of (Triggering unit)) - (0.03*(Max life of (Triggering unit))))
        • Else - Actions
          • Game - Display to (Player Group(Owner of (Triggering unit))) the message "Not enough health."
 
Level 9
Joined
Jan 3, 2010
Messages
359
In reply to the previous two posts I will state that Immolation cannot be detected by triggers, and I wouldn't bet on Mana Flare but we'll see about that.

immolation can do it, but u have to change the turning off event to unit issued an order with no target and set the condition to issued order equal to unimmolation

I think manaflare can't do it, your hero will be paused when he casts manaflare.
 
Status
Not open for further replies.
Top