• 🏆 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] Semi Auto Cast Spell

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2015
Messages
171
I want unit with 3 spells to cast spell 1 of 3 spell while being attacked or attacking without casting 3 spells at the same time..is it possible? (the unit learn this spell with trigger and cooldown are based on trigger disable for certain time)

  • Trigger Impale
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Crypt Lord
    • Actions
      • Set Chance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 5
        • Then - Actions
          • Unit - Add Impale to (Triggering unit)
          • Set Temp_Location = (Position of (Triggering unit))
          • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
          • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
            • Loop - Actions
              • Custom script: call RemoveLocation(udg_Temp_Location)
              • Set Temp_Location = (Position of (Picked unit))
              • Unit - Order (Triggering unit) to Undead Crypt Lord - Impale Temp_Location
          • Custom script: call DestroyGroup(udg_Temp_Group)
          • Custom script: call RemoveLocation(udg_Temp_Location)
          • Wait 3.20 seconds
          • Unit - Remove Landslide from (Triggering unit)
        • Else - Actions
          • Do nothing
  • Trigger War Stomp
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Crypt Lord
    • Actions
      • Set Chance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 15
        • Then - Actions
          • Unit - Add War Stomp to (Attacking unit)
          • Unit - Order (Attacking unit) to Orc Tauren Chieftain - War Stomp
          • Wait 1.00 seconds
          • Unit - Remove War Stomp from (Attacking unit)
        • Else - Actions
          • Do nothing
  • Trigger Storm Bolt
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Crypt Lord
    • Actions
      • Set Chance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chance Less than or equal to 1
        • Then - Actions
          • Unit - Add Storm Bolt to (Triggering unit)
          • Set Temp_Location = (Position of (Triggering unit))
          • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
          • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
            • Loop - Actions
              • Custom script: call RemoveLocation(udg_Temp_Location)
              • Set Temp_Location = (Position of (Picked unit))
              • Unit - Order (Triggering unit) to Human Mountain King - Storm Bolt (Picked unit)
          • Custom script: call DestroyGroup(udg_Temp_Group)
          • Custom script: call RemoveLocation(udg_Temp_Location)
          • Wait 3.00 seconds
          • Unit - Remove Storm Bolt from (Triggering unit)
        • Else - Actions
          • Do nothing
  • stomp
    • Events
      • Unit - A unit starts effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Trigger - Turn off Trigger War Stomp <gen>
      • Wait 8.00 seconds
      • Trigger - Turn on Trigger War Stomp <gen>
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
The reason that they're all casting at once is because they are all meeting the conditions. Let's say that when the unit is attacked, Chance = 1. Since Chance = 1, that means it meets the conditions for Impale (1 is less than or equal to 5), it meets the condition for War Stomp, (1 is less than or equal to 15), and it meets the condition for Storm bolt (1 is less than or equal to 1).

Off the top of my head, I have an easy fix. However, the problem with is it that all 3 passives will need to have the same percent chance of happening. If you don't mind, then this is all you have to do

  • Events
    • Unit - A unit Is attacked
  • Conditions
  • Actions
    • Set Percent Chance = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Less than or equal to 15
      • Then - Actions
        • Set Spell = (Random integer number between 1 and 3)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 1
          • Then - Actions
            • Unit - Order (unit) to Undead Crypt Lord - Impale
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 2
          • Then - Actions
            • Unit - Order (unit) to Orc Tauren Chieftain - War Stomp
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 3
          • Then - Actions
            • Unit - Order (unit) to Human Mountain King - Storm Bolt
          • Else - Actions
      • Else - Actions
If this bugs you, I know this other really lame fix ... you can make the conditions more specific like:
  • Actions
    • Set Percent Chance = (Random integer number between 1 and 100)
    • -------- -------- --------
    • -------- IMPALE --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 1 and Less than or equal to 15
      • Then - Actions
        • Unit - Order (unit) to Undead Crypt Lord - Impale
      • Else - Actions
    • -------- -------------- --------
    • -------- WAR STOMP --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 16 and Less than or equal to 30
      • Then - Actions
        • Unit - Order (unit) to Orc Tauren Chieften - War Stomp
      • Else - Actions
    • -------- -------------- --------
    • -------- STORM BOLT --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 31 and Less than or equal to 45
      • Then - Actions
        • Unit - Order (unit) to Human Mountain King - Storm Bolt
      • Else - Actions
EDIT: After some thinking, I came up with this... Not the most efficient, but I think it will work until a more experienced user can give you a better alternative. I just typed this all out with testing it. Let me know what happens!

  • Events
    • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Percent Chance = (Random integer number between 1 and 100)
      • Set Spell = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spell Equal to 1
        • Then - Actions
          • Trigger - Run Impale Trigger (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spell Equal to 2
        • Then - Actions
          • Trigger - Run War Stomp Trigger (checking conditions)
        • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 3
          • Then - Actions
            • Trigger - Trigger - Run Storm Bolt Trigger (checking conditions) <gen>
          • Else - Actions
        • Else - Actions
  • Events
  • Conditions
    • Percent Chance is less than or equal to 5
  • Actions
    • Unit - Order (unit) to Undead Crypt Lord - Impale
 
Last edited:
Level 6
Joined
Jan 2, 2015
Messages
171
The reason that they're all casting at once is because they are all meeting the conditions. Let's say that when the unit is attacked, Chance = 1. Since Chance = 1, that means it meets the conditions for Impale (1 is less than or equal to 5), it meets the condition for War Stomp, (1 is less than or equal to 15), and it meets the condition for Storm bolt (1 is less than or equal to 1).

Off the top of my head, I have an easy fix. However, the problem with is it that all 3 passives will need to have the same percent chance of happening. If you don't mind, then this is all you have to do

  • Events
    • Unit - A unit Is attacked
  • Conditions
  • Actions
    • Set Percent Chance = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Less than or equal to 15
      • Then - Actions
        • Set Spell = (Random integer number between 1 and 3)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 1
          • Then - Actions
            • Unit - Order (unit) to Undead Crypt Lord - Impale
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 2
          • Then - Actions
            • Unit - Order (unit) to Orc Tauren Chieftain - War Stomp
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 3
          • Then - Actions
            • Unit - Order (unit) to Human Mountain King - Storm Bolt
          • Else - Actions
      • Else - Actions
If this bugs you, I know this other really lame fix ... you can make the conditions more specific like:
  • Actions
    • Set Percent Chance = (Random integer number between 1 and 100)
    • -------- -------- --------
    • -------- IMPALE --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 1 and Less than or equal to 15
      • Then - Actions
        • Unit - Order (unit) to Undead Crypt Lord - Impale
      • Else - Actions
    • -------- -------------- --------
    • -------- WAR STOMP --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 16 and Less than or equal to 30
      • Then - Actions
        • Unit - Order (unit) to Orc Tauren Chieften - War Stomp
      • Else - Actions
    • -------- -------------- --------
    • -------- STORM BOLT --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Percent Chance Greater than or equal to 31 and Less than or equal to 45
      • Then - Actions
        • Unit - Order (unit) to Human Mountain King - Storm Bolt
      • Else - Actions
EDIT: After some thinking, I came up with this... Not the most efficient, but I think it will work until a more experienced user can give you a better alternative. I just typed this all out with testing it. Let me know what happens!

  • Events
    • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Percent Chance = (Random integer number between 1 and 100)
      • Set Spell = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spell Equal to 1
        • Then - Actions
          • Trigger - Run Impale Trigger (checking conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spell Equal to 2
        • Then - Actions
          • Trigger - Run War Stomp Trigger (checking conditions)
        • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Spell Equal to 3
          • Then - Actions
            • Trigger - Trigger - Run Storm Bolt Trigger (checking conditions) <gen>
          • Else - Actions
        • Else - Actions
  • Events
  • Conditions
    • Percent Chance is less than or equal to 5
  • Actions
    • Unit - Order (unit) to Undead Crypt Lord - Impale

Problem Solved. +rep for you
 
Status
Not open for further replies.
Top