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

Error with auto-summons spell

Status
Not open for further replies.
Level 3
Joined
Jun 17, 2015
Messages
53
Hi guys, i have a problem with my spell that it wont work, tooltips:
Auto summons the spirit pandas that fight for you:

- Level 1: Storm: dissapear if your HP below 25%

-Level 2: Earth: dissapear if your HP below 50%

-Level 3: Fire: dissapear if your HP below 75%

How it work: when ur hp are greater than the "dissapear condition", your panda is summoned. At lvl3 you can summons 3 pandas at 100% HP

Problems: idk since i've checked and it wont appear at once, please help me cuz i cant find any error :goblin_cry:

  • Events
    • Time - Every 0.50 seconds of game time
  • Conditions
  • Actions
    • -------- CHECK AVAIABLE UNIT --------
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Level of Brother Spirits for (Matching unit)) Greater than (>) 0)) and do (Set Brother_Spirits_User = (Picked unit))
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 1
        • Then - Actions
          • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Storm))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroup) Equal to (==) 0
                • Then - Actions
                  • Set AALoc1 = (Position of Brother_Spirits_User)
                  • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                  • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                  • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_AALoc1)
                • Else - Actions
                  • -------- IF UNIT ALREADY APPEAR --------
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • ((Number of units in TempGroup) Equal to (==) 1) or ((Life of Brother_Spirits_User) Less than (<) (0.25 x (Max life of Brother_Spirits_User)))
                      • Then - Actions
                        • Do nothing
                      • Else - Actions
          • Custom script: call DestroyGroup (udg_Temp_Group)
        • Else - Actions
          • -------- CHECK THE MAP TO SAVE THE TYPE OF PANDAS --------
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 2
              • Then - Actions
                • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to (==) Storm) and ((Unit-type of (Matching unit)) Equal to (==) Earth)))
                • Unit Group - Pick every unit in Temp_Group and do (Actions)
                  • Loop - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of units in TempGroup) Less than (<) 2
                      • Then - Actions
                        • Set AALoc1 = (Position of Brother_Spirits_User)
                        • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                        • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                        • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Unit - Create 1 Earth for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                        • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                        • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Custom script: call RemoveLocation(udg_AALoc1)
                      • Else - Actions
                        • -------- IF UNITS ALREADY APPEAR --------
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Number of units in TempGroup) Equal to (==) 2) or ((Life of Brother_Spirits_User) Less than (<) (0.50 x (Max life of Brother_Spirits_User)))
                            • Then - Actions
                              • Do nothing
                            • Else - Actions
                • Custom script: call DestroyGroup (udg_Temp_Group)
              • Else - Actions
                • -------- CHECK THE MAP TO SAVE THE TYPE OF PANDAS --------
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 3
                    • Then - Actions
                      • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to (==) Storm) and ((Unit-type of (Matching unit)) Equal to (==) Earth)))
                      • Unit Group - Pick every unit in Temp_Group and do (Actions)
                        • Loop - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup) Less than (<) 3
                            • Then - Actions
                              • Set AALoc1 = (Position of Brother_Spirits_User)
                              • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Unit - Create 1 Earth for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Unit - Create 1 Fire for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Custom script: call RemoveLocation(udg_AALoc1)
                            • Else - Actions
                              • -------- IF UNITS ALREADY APPEAR --------
                                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • ((Number of units in TempGroup) Equal to (==) 3) or ((Life of Brother_Spirits_User) Less than (<) (0.75 x (Max life of Brother_Spirits_User)))
                                  • Then - Actions
                                    • Do nothing
                                  • Else - Actions
                      • Custom script: call DestroyGroup (udg_Temp_Group)
                    • Else - Actions
    • -------- CHECK HP OF OWNER --------
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Life of Brother_Spirits_User) Less than (<) (0.25 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
        • Then - Actions
          • -------- REMOVE STORM IF LIFE BELOW 25% --------
          • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Storm))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Custom script: call DestroyGroup (udg_Temp_Group)
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Life of Brother_Spirits_User) Less than (<) (0.50 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
            • Then - Actions
              • -------- REMOVE EARTH IF LIFE BELOW 50% --------
              • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Earth))
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
              • Custom script: call DestroyGroup (udg_Temp_Group)
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Life of Brother_Spirits_User) Less than (<) (0.75 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
                • Then - Actions
                  • -------- REMOVE FIRE IF LIFE BELOW 75% --------
                  • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Fire))
                  • Unit Group - Pick every unit in Temp_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Remove (Picked unit) from the game
                  • Custom script: call DestroyGroup (udg_Temp_Group)
                • Else - Actions
 
Level 12
Joined
May 22, 2015
Messages
1,051
Can this ability be learned by more than one unit? It would be a lot easier to manage just one unit, but if it has to be more than one, I can try to work with it, anyway.

Just note that the first line will leak a group every time, and it is running every 0.5 seconds. It also won't work properly with more than one unit with the ability, since it is setting a single unit variable to the unit it finds. That's kind of why I asked about it working for multiple units or not.

It is a ton of work to check every unit in the game just to find one single unit. Your better off having the units that learn the ability be added to a group and then loop over just that group. The pandas would probably also be better off in groups since you loop over all units for each of those as well.

Here is an error I found. When you select all the pandas, you loop over them and check if there are none in the group. Don't bother doing the loop. If the group is empty, it will never hit the if statement in the loop. The if statement in the loop checks if there are 0 units in the group and otherwise does nothing. The only time there are no units in the group is when the loop will be skipped entirely (since it is empty), so it always does nothing. I wrote some stuff for where I am talking about.

  • Events
    • Time - Every 0.50 seconds of game time
  • Conditions
  • Actions
    • -------- CHECK AVAIABLE UNIT --------
    • // This will only ever grab one random unit with the ability
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Level of Brother Spirits for (Matching unit)) Greater than (>) 0)) and do (Set Brother_Spirits_User = (Picked unit))
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 1
        • Then - Actions
          • // If there are no storm pandas, this group is empty.
          • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Storm))
          • // If there are no storm pandas, this loops does nothing.
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • // This is checking if the group is empty. It can't happen if the group is empty since it is checking in this loop.
                  • (Number of units in TempGroup) Equal to (==) 0
                • Then - Actions
                  • Set AALoc1 = (Position of Brother_Spirits_User)
                  • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                  • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                  • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_AALoc1)
                • Else - Actions
                  • // All the code in this else does nothing. It does a check and if it's true, it calls Do nothing. Otherwise, it actually just does nothing.
                  • -------- IF UNIT ALREADY APPEAR --------
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • ((Number of units in TempGroup) Equal to (==) 1) or ((Life of Brother_Spirits_User) Less than (<) (0.25 x (Max life of Brother_Spirits_User)))
                      • Then - Actions
                        • Do nothing
                      • Else - Actions
          • Custom script: call DestroyGroup (udg_Temp_Group)
        • Else - Actions
          • -------- CHECK THE MAP TO SAVE THE TYPE OF PANDAS --------
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 2
              • Then - Actions
                • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to (==) Storm) and ((Unit-type of (Matching unit)) Equal to (==) Earth)))
                • Unit Group - Pick every unit in Temp_Group and do (Actions)
                  • Loop - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of units in TempGroup) Less than (<) 2
                      • Then - Actions
                        • Set AALoc1 = (Position of Brother_Spirits_User)
                        • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                        • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                        • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Unit - Create 1 Earth for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                        • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                        • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Custom script: call RemoveLocation(udg_AALoc1)
                      • Else - Actions
                        • -------- IF UNITS ALREADY APPEAR --------
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Number of units in TempGroup) Equal to (==) 2) or ((Life of Brother_Spirits_User) Less than (<) (0.50 x (Max life of Brother_Spirits_User)))
                            • Then - Actions
                              • Do nothing
                            • Else - Actions
                • Custom script: call DestroyGroup (udg_Temp_Group)
              • Else - Actions
                • -------- CHECK THE MAP TO SAVE THE TYPE OF PANDAS --------
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Brother Spirits for Brother_Spirits_User) Equal to (==) 3
                    • Then - Actions
                      • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to (==) Storm) and ((Unit-type of (Matching unit)) Equal to (==) Earth)))
                      • Unit Group - Pick every unit in Temp_Group and do (Actions)
                        • Loop - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup) Less than (<) 3
                            • Then - Actions
                              • Set AALoc1 = (Position of Brother_Spirits_User)
                              • Unit - Create 1 Storm for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Unit - Create 1 Earth for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Unit - Create 1 Fire for (Owner of Brother_Spirits_User) at AALoc1 facing Default building facing (270.0) degrees
                              • Unit - Order (Last created unit) to Follow Brother_Spirits_User
                              • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Custom script: call RemoveLocation(udg_AALoc1)
                            • Else - Actions
                              • -------- IF UNITS ALREADY APPEAR --------
                                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • ((Number of units in TempGroup) Equal to (==) 3) or ((Life of Brother_Spirits_User) Less than (<) (0.75 x (Max life of Brother_Spirits_User)))
                                  • Then - Actions
                                    • Do nothing
                                  • Else - Actions
                      • Custom script: call DestroyGroup (udg_Temp_Group)
                    • Else - Actions
    • -------- CHECK HP OF OWNER --------
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Life of Brother_Spirits_User) Less than (<) (0.25 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
        • Then - Actions
          • -------- REMOVE STORM IF LIFE BELOW 25% --------
          • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Storm))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Custom script: call DestroyGroup (udg_Temp_Group)
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Life of Brother_Spirits_User) Less than (<) (0.50 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
            • Then - Actions
              • -------- REMOVE EARTH IF LIFE BELOW 50% --------
              • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Earth))
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • Unit - Remove (Picked unit) from the game
              • Custom script: call DestroyGroup (udg_Temp_Group)
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Life of Brother_Spirits_User) Less than (<) (0.75 x (Max life of Brother_Spirits_User))) and ((Level of Brother Spirits for Brother_Spirits_User) Greater than (>) 0)
                • Then - Actions
                  • -------- REMOVE FIRE IF LIFE BELOW 75% --------
                  • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to (==) Fire))
                  • Unit Group - Pick every unit in Temp_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Remove (Picked unit) from the game
                  • Custom script: call DestroyGroup (udg_Temp_Group)
                • Else - Actions

Hopefully I made myself clear.
 
Level 3
Joined
Jun 17, 2015
Messages
53
First is the spell work for a single unit.
my points of this trigger:
-Check if Storm already have or not
-If no, then create storm
-If yes or main unit's HP below required HP, do nothing

but i dont understand the errors you showed me, especially the loop... why you say "If there are no storm pandas, this loops does nothing." @@
 
Level 12
Joined
May 22, 2015
Messages
1,051
Just take the if statement part out of the loop. The loop doesn't get run if it finds no storm pandas, and the only time the if statement does anything is if there are no storm pandas.
 
Level 3
Joined
Jun 17, 2015
Messages
53
I do this based on my spell that:
If you attack target is alone, next attack cause him move slow

in that spell that need to check around him, if there's 0 unit in a group, then cast slow and it works, dont know why the panda doesnt works... may i give you the sample map maybe you can edit something because i cant find the wrongs here @@
 
Level 12
Joined
May 22, 2015
Messages
1,051
Okay I sort of redid the trigger, but hopefully it is clear what it is doing. I attached the map here with my new triggers. It only works with one hero with the ability, but it would have only worked with one hero with how you were doing it. If you want it to work with more, it will get a little more complicated.

Note: I added one extra variable to store the spirit pandas and there is an extra, separate trigger for when someone learns the ability. This is so you don't have to check all the units in the game each time to figure out who has the ability.

Some other things about it are:
- If a spirit panda dies, it will be recreated within 0.5 seconds. This might be too powerful.
- Spirit pandas have no death animation, so they just stand there for a long time after they die lol.

Let me know if you have any questions or concerns :)
 

Attachments

  • elemental_spirits.w3x
    43.8 KB · Views: 59
Level 3
Joined
Jun 17, 2015
Messages
53
oh i see now, the points are set Storm, Earth, Fire into different variable(s).

So every 0.5s if unit [0] is ded then create panda, else leave it alone i see now.

Thanks for cleared my mind sir
 
Status
Not open for further replies.
Top