• 🏆 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] Hi, I need some help with a spell trigger

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
Hi, I was working on a spell called 'summon traitor' which lets you summon the last creature your hero killed. It has 20 levels, higher levels decrease cooldown and lets you summon more copies of the creature your hero killed.
My problem is that sometimes it works and sometimes it doesn't, so maybe somebody knows how to fix it :thumbs_up:?

The spell itself is based of 'summon misha'.

Here are the triggers;

  • The Traitor
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • ((Killing unit) is A Hero) Equal to (==) True
      • ((Dying unit) is Summoned) Equal to (==) False
      • ((Dying unit) is Mechanical) Equal to (==) False
      • ((Dying unit) is Magic Immune) Equal to (==) False
    • Actions
      • Set TheTraitor[1] = (Unit-type of (Dying unit))
  • Summon Traitor
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) |cff00ffffSummon Traitor|r
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 0 and 5)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 1 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 4 and 8)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 2 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 7 and 11)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 3 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 10 and 14)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 4 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 13 and 17)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 5 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) (Random integer number between 16 and 20)
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 6 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of |cff00ffffSummon Traitor|r for (Casting unit)) Equal to (==) 20
        • Then - Actions
          • Set TEMP_POINT = (Position of (Casting unit))
          • Unit - Create 7 TheTraitor[1] for (Owner of (Casting unit)) at TEMP_POINT facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Set TEMP_UNITGROUP = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to (==) TheTraitor[1]))
          • Wait 0.10 seconds
          • Unit Group - Pick every unit in TEMP_UNITGROUP and do (Actions)
            • Loop - Actions
              • Unit - Add Summoned to (Matching unit)
          • Custom script: call DestroyGroup (udg_TEMP_UNITGROUP)
        • Else - Actions
Thanks for taking the time, I appreciate it :D
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
I think it's because of the conditions in your if then else. You did it with Random number, so your trigger asks, if your hero's level is a random number.
Example: Your hero is lvl 2.
Now you cast spell, the random number which is generate is 3. => if/then/else = false
, I think you're right, will change and see if it works. Thanks for the comments.

EDIT

Yeah Amigurumi, it works perfect now, thanks! And thanks Bu113t for trying!
 
Status
Not open for further replies.
Top