• 🏆 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] Automatic Spell Casting

Status
Not open for further replies.
Level 5
Joined
Jul 17, 2010
Messages
140
I want the hero to cast this spell every x second when he have the buff on.
any idea´s on how to make this smooth and working?

  • Mage Spell Hydra
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • ((Triggering unit) has buff |cff00ff00Set: Serpent Sparker|r (1)) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Human Archmage - Summon Water Elemental
 
Level 5
Joined
Jul 17, 2010
Messages
140
How many different Units shall use this?
MPI, MUI, Single one.

Edit: (Any one as often as possible) , Once a Player, Once at all.
Edit: What is the Source of the buff? Aura/Passiv, Timed-Buff?
Seems to be an item - assuming from its name​

MUI.

Every X second a hero.

the source is a Passive/Aura, just added a an item id fast to show it.
 

Init Hashtable and set its buff
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Hashtabelle - Create a hashtable
      • Set Mages_Hash = (Last created hashtable)
      • Set Mage_Buff = Set
Check if Unit has all Set parts.
  • Enter
    • Ereignisse
      • Unit - A unit Gains an Item
    • Bedingungen
      • And - All (Conditions) are true
        • Bedingungen
          • ((Triggering unit) has an item of type Mantel der Intelligenz +3) Equal True
          • ((Triggering unit) has an item of type Robe der Weisen +6) Equal True
      • ((Triggering unit) is in Mages) Equal False
    • Aktionen
      • -------- If your set is only one item you can put the aura skill into it --------
      • Unit - Add Has Set (Neutral feindlich) to (Triggering unit)
      • Einheitengruppe - Add (Triggering unit) to Mages
      • Custom script: set udg_Timer = CreateTimer()
      • Hashtabelle - Save Handle OfTimer as 0 of (Key (Triggering unit)) in Mages_Hash
      • Trigger - Turn on Loop <gen>
Check if a Hero is ready to summon
  • Loop
    • Ereignisse
      • Zeit - Every 0.20 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in Mages and do (Actions)
        • Schleifen - Aktionen
          • Set Timer = (Load 0 of (Key (Picked unit)) in Mages_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Mage_Buff) Equal True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Remaining time for Timer) Equal 0.00
                • Then - Actions
                  • Unit - Order (Picked unit) to Menschen-Erzmagier - 'Wasser-Elementargeist' beschwören
                  • Countdown-Timer - Start Timer as a Einmalig timer that will expire in 5.00 seconds
                • Else - Actions
            • Else - Actions
              • -------- Clean Up --------
              • Countdown-Timer - Pause Timer
              • Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in Mages_Hash
              • Custom script: call DestroyTimer(udg_Timer)
              • Einheitengruppe - Remove (Picked unit) from Mages
Needed if this Item is not Unique and you can have more than one of it.
  • Leave
    • Ereignisse
      • Unit - A unit Loses an item
    • Bedingungen
      • ((Triggering unit) is in Mages) Equal True
      • Or - Any (Conditions) are true
        • Bedingungen
          • (Item-type of (Item being manipulated)) Equal Mantel der Intelligenz +3
          • (Item-type of (Item being manipulated)) Equal Robe der Weisen +6
    • Aktionen
      • -------- If you Set item is only one and unique which contains the Aura skill you can leave this Trigger out --------
      • -------- Here the Hero has still the Item. --------
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Bedingungen
              • ((Triggering unit) has an item of type Mantel der Intelligenz +3) Equal True
              • ((Triggering unit) has an item of type Robe der Weisen +6) Equal True
        • Then - Actions
        • Else - Actions
          • Unit - Remove Has Set (Neutral feindlich) from (Triggering unit)


Another solution if you don't need a Spellcasting you could add the Fabric Skill (ANfy) to your Item, has some side effect: Fabric Units are excluded in Multiselection Drag-Rect.
 

Attachments

  • Frequently Cast Spell.w3x
    19.5 KB · Views: 35
Level 5
Joined
Jul 17, 2010
Messages
140
okay ill try to explain it better this time.

I am using Bpower´s Equipment system.

And when the specific item is equip the Passive Hydra shown ability 2 (Based on Unholy Aura) is added to the hero.
When the Item is unequip the Passive is removed again.

now the thing im trying to is, when the passive if on the hero (When the item is equipt) It auto summons the hydra´s every X Second.

  • Init Copy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Mages_Hash = (Last created hashtable)
      • Set Mage_Buff = |cff00ff00Set: Serpent Sparker|r (1)
  • [trigger]
  • Loop
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Mages and do (Actions)
        • Loop - Actions
          • Set Timer = (Load 0 of (Key (Picked unit)) in Mages_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Mage_Buff) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Remaining time for Timer) Equal to 0.00
                • Then - Actions
                  • Unit - Order (Picked unit) to Human Archmage - Summon Water Elemental
                  • Countdown Timer - Start Timer as a One-shot timer that will expire in 5.00 seconds
                • Else - Actions
            • Else - Actions
              • -------- Clean Up --------
              • Countdown Timer - Pause Timer
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Mages_Hash
              • Custom script: call DestroyTimer(udg_Timer)
              • Unit Group - Remove (Picked unit) from Mages

  • Mage Spell Hydra
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Level of Hydra Shown Ability 2 for (Triggering unit)) Equal to 1
      • ((Triggering unit) is in Mages) Equal to False
    • Actions
      • Unit Group - Add (Triggering unit) to Mages
      • Custom script: set udg_Timer = CreateTimer()
      • Hashtable - Save Handle OfTimer as 0 of (Key (Triggering unit)) in Mages_Hash
      • Trigger - Turn on Loop <gen>
 
If you use this Equipment v2.5.2 than yes my Trigger won't work. Throught you have an simple Inventory.

We need to change the Enter and Leave Trigger:


From my first view:
Equip is using the Set Item in your Inventory, the Trigger i called Enter change its Event into "uses item" and its condition "used item = Set" the rest of this Trigger is fine.
Unequiping is more difficult their are 2 Options to do it ( hmm but the Equipment dummy Unit does both)
  1. the Unequip Spell inside the Inventory (Starts effect of ability, ) .
  2. Replacing the Set with an Item of the Same Categorie (Would be Use item again).
Edit: Testing s have shown that it reduces to Events:
  1. "uses Item"= Equip start
  2. If Uses before "Lose Item " = Equip
  3. If Equiped "Gain Item" = Unequip
Result after some Testing:
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Hashtabelle - Create a hashtable
      • Set Mages_Hash = (Last created hashtable)
      • Set Timer_Intervall = 5.00
  • Loop
    • Ereignisse
      • Zeit - Every 0.20 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in Mages and do (Actions)
        • Schleifen - Aktionen
          • Set Timer = (Load 0 of (Key (Picked unit)) in Mages_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Timer) Equal 0.00
            • Then - Actions
              • Unit - Order (Picked unit) to Menschen-Erzmagier - 'Wasser-Elementargeist' beschwören
              • Countdown-Timer - Start Timer as a Einmalig timer that will expire in Timer_Intervall seconds
              • -------- If you want Elementals without Spellcasting, else Remove further Lines --------
              • Set Loc = (Position of (Picked unit))
              • Einheit - Create 1 Wasser-Elementargeist (Stufe 1) for (Owner of (Picked unit)) at Loc facing Vorgabe für Gebäude-Ausrichtung degrees
              • Custom script: call RemoveLocation(udg_Loc)
            • Else - Actions
  • Uses
    • Ereignisse
      • Unit - A unit Uses an Item
    • Bedingungen
      • (Item-type of (Item being manipulated)) Equal Your Item
    • Aktionen
      • Spiel - Display to (All players) for 5.00 seconds the text: (Name of the current trigger)
      • Einheitengruppe - Add (Triggering unit) to Mages
  • Enter
    • Ereignisse
      • Unit - A unit Loses an Item
    • Bedingungen
      • ((Triggering unit) is in Mages) Equal True
      • (Item-type of (Item being manipulated)) Equal Your Item
    • Aktionen
      • Spiel - Display to (All players) for 5.00 seconds the text: (Name of the current trigger)
      • Einheitengruppe - Add (Triggering unit) to Mages
      • Custom script: set udg_Timer = CreateTimer()
      • Hashtabelle - Save Handle OfTimer as 0 of (Key (Triggering unit)) in Mages_Hash
      • Trigger - Turn on Loop <gen>
  • Loss
    • Ereignisse
      • Unit - A unit Gains an Item
    • Bedingungen
      • (Item-type of (Item being manipulated)) Equal Your Item
      • ((Triggering unit) is in Mages) Equal True
    • Aktionen
      • Spiel - Display to (All players) for 5.00 seconds the text: (Name of the current trigger)
      • -------- Clean Up --------
      • Set Timer = (Load 0 of (Key (Triggering unit)) in Mages_Hash)
      • Countdown-Timer - Pause Timer
      • Hashtabelle - Clear all child hashtables of child (Key (Triggering unit)) in Mages_Hash
      • Custom script: call DestroyTimer(udg_Timer)
      • Einheitengruppe - Remove (Triggering unit) from Mages
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Mages is empty) Gleich True
      • Then - Actions
        • Trigger - Turn off Loop <gen>
      • Else - Actions
 
Last edited:
Level 5
Joined
Jul 17, 2010
Messages
140
For now i have it working when attacking, now i just need it to cast automatic out of combat.

  • Hydra Combat Trigger Copy
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Unit-type of GDD_DamageSource) Equal to Human |cFF80FFFFMage|r
      • (Level of Passive Hydra Ability for GDD_DamageSource) Equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Hydra units owned by (Owner of GDD_DamageSource)) Equal to 0
        • Then - Actions
          • Unit Group - Add GDD_DamageSource to Mages
          • Unit Group - Pick every unit in (Units owned by (Owner of GDD_DamageSource) of type Human |cFF80FFFFMage|r) and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Hydra for (Owner of GDD_DamageSource) at ((Position of GDD_DamageSource) offset by 150.00 towards 45.00 degrees) facing (1.00 + 1.00) degrees
              • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
              • (Number of living Hydra units owned by (Owner of GDD_DamageSource)) Equal to 1
              • (Level of Passive Hydra Ability for GDD_DamageSource) Equal to 0
            • Then - Actions
              • Do nothing
            • Else - Actions
 
Level 5
Joined
Jul 17, 2010
Messages
140
Just if your interested i got it to work with this trigger.

EDIT: Only works for 1 player so far.

  • Loop Copy 2
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Mages and do (Actions)
        • Loop - Actions
          • Set Timer = (Load 0 of (Key (Picked unit)) in Mages_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Mage_Buff) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Hydra Dummy - (None) units owned by (Owner of (Picked unit))) Equal to 0
                  • (Remaining time for Timer) Equal to 0.00
                • Then - Actions
                  • Unit - Create 1 Hydra Dummy - (None) for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Unit - Order (Last created unit) to Human Archmage - Summon Water Elemental
                  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                  • Countdown Timer - Start Timer as a One-shot timer that will expire in 10.00 seconds
                  • Floating Text - Create floating text that reads Serpent Hydra above (Last created unit) with Z offset 0.00, using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 10.00 seconds
                  • Floating Text - Change the lifespan of (Last created floating text) to 10.00 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Mage_Buff) Equal to False
                      • (Number of living Hydra Dummy - (None) units owned by (Owner of (Picked unit))) Equal to 1
                    • Then - Actions
                      • Do nothing
                    • Else - Actions
            • Else - Actions
              • -------- Clean Up --------
              • Countdown Timer - Pause Timer
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Mages_Hash
              • Custom script: call DestroyTimer(udg_Timer)
 
Status
Not open for further replies.
Top