• 🏆 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] Ability Trigger Has Some Bugs

Status
Not open for further replies.
Level 6
Joined
Aug 19, 2007
Messages
109
Here is an ability i'm working on:
  • Scatter Arrows
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(clusterrockets))
      • (Ordered unit) Equal to EC
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
              • Set Temp_Point2 = ((Target point of issued order) offset by (Random real number between 0.00 and 400.00) towards (Random angle) degrees)
              • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
              • Unit - Order (Last created unit) to Attack Ground Temp_Point2
              • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • Custom script: call RemoveLocation (udg_Temp_Point2)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 2
            • Then - Actions
              • For each (Integer A) from 1 to 12, do (Actions)
                • Loop - Actions
                  • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                  • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                  • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                  • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                  • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
                  • Custom script: call RemoveLocation (udg_Temp_Point2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 3
                • Then - Actions
                  • For each (Integer A) from 1 to 18, do (Actions)
                    • Loop - Actions
                      • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                      • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                      • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                      • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                      • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                      • Custom script: call RemoveLocation (udg_Temp_Point2)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 4
                    • Then - Actions
                      • For each (Integer A) from 1 to 24, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                          • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                          • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                          • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                          • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                          • Custom script: call RemoveLocation (udg_Temp_Point2)
                    • Else - Actions
                      • Do nothing
Note:
-There is no need for "Do nothing" at end but i like to put it there.. make me feel better.
-EC is a unit variable which is the same throughout the entire game.
-There only is 1 EC.
-the order clusterrockets is basically the same as saying "ability being cast is equal to Scatter Arrows"- as i put the order string to "clusterrockets"
-Archers have 2400 range, so they should never be out of range as ability has a casting range of 1750.

---Everthing works fine EXCEPT:
-I noticed only 1 of the 6/12/18/24 archers actually attacks ground like their meant to, the rest just attack center of playable map area(meaning something is wrong)

-Ability is meant to:
=Create 6/12/18/24 archers at random spots behind the hero (50 degrees left+right offset by 100-350 or something)
=Then order each archer to attack ground in a random spot where the order(ability) has been targetted (casted)
=Also expiration timer stops the archers from firing twice
This may seem a bit complicated D:. Please help and explain why archers arent ALL attacking ground in random spots around targetted order area.:eekani::eekani::cry:

Edit:I theorise that the problem lies in "set Temp_Point2" coz thats where i want archers to fire at which only 1 fires at D:.
 
Level 6
Joined
Aug 19, 2007
Messages
109
Well, creating 6 archers defeats the purpose of the 'randomness' of Temp_Point. Also- in my experience ordering a unit group to atk somewhere doesnt always do as it say it does. Moreover the archers would all fire on the same spot which too defeats the purpose of the randomsness of Temp_Point_2.:sad:Lol but ill try it anyway.

Edit:Oh dear, as the archer units have locust ablity you cant "set Temp_Unit_Group = units in range matching condition" for some reason they dont get "picked" lol and thus remain stationary. Im open to more suggestions though lol thx for trying.

Edit of an Edit:Lol i'm telling ya its to do with Temp_Point2. I added to the original trigger "create 1 footman at Temp_Point2 and hey presto, hes created at cente of playable map area... thus something with "set Temp_Point2 = (position etc...)" must be wrong D: just cant see what is.

Edit of an Edit of an Edit:Hmph seems i was wrong, the footman WAS created in the right spot. semms that looping a temp point dun work more than once? but wtf about the archers? lol maybe something about "call RemoveLocation (udg_Temp_Point2)" is wrong? But even then it'll just be a memory leak and not a bug?

Edit of an Edit of an Edit of an Edit: (each of these edits represents another test and another variable in finding out the culprit of da bug) ahem: i did this:
  • Scatter Arrows
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(clusterrockets))
      • (Ordered unit) Equal to EC
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
              • Set Temp_Point2 = ((Target point of issued order) offset by (Random real number between 0.00 and 400.00) towards (Random angle) degrees)
              • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
              • Unit - Order (Last created unit) to Attack Ground Temp_Point2
              • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
              • Unit - Create 1 Swordsman for (Owner of EC) at Temp_Point2 facing (Facing of EC) degrees
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • Custom script: call RemoveLocation (udg_Temp_Point2)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 2
            • Then - Actions
              • For each (Integer A) from 1 to 12, do (Actions)
                • Loop - Actions
                  • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                  • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                  • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                  • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                  • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
                  • Custom script: call RemoveLocation (udg_Temp_Point2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 3
                • Then - Actions
                  • For each (Integer A) from 1 to 18, do (Actions)
                    • Loop - Actions
                      • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                      • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                      • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                      • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                      • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                      • Custom script: call RemoveLocation (udg_Temp_Point2)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 4
                    • Then - Actions
                      • For each (Integer A) from 1 to 24, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                          • Set Temp_Point2 = ((Target point of issued order) offset by 400.00 towards (Random angle) degrees)
                          • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                          • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                          • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                          • Custom script: call RemoveLocation (udg_Temp_Point2)
                    • Else - Actions
                      • Do nothing
Note:Ability was tested on lvl 1.
what i saw was 1 footman being created in the right place, whilst the other 5 were created in random point around center of playable map area, as if "(Target Point of Issued order)" ((Temp_Point2)) changed back to center of playable map area after being used once in a loop. The 1 footman created in the right place, and the 1 archer firing in the right place out of 6 seems to point to that...
 
Level 9
Joined
May 27, 2006
Messages
498
Try storing (Target point of issued order) into a variable, not only it leaks (yes, when you set a location offset and dont destroy it, it leaks twice) but it might also solve your problem, as similar problems usually appear when the location gets destroyed/is not set to a variable.

Edit:
Yup, that's it, just tested: set (Target point of issued order) to a variable, this shall solve your problem.
 
Level 5
Joined
Nov 14, 2007
Messages
161
Yup, that's it, just tested: set (Target point of issued order) to a variable, this shall solve your problem.

im ganna guess it's because the new issue ordered is telling the archer to attack. once it's done attacking wouldnt the point of issue ordered be equal to null? defaulting to center of the map?

good luck!
 
Level 6
Joined
Aug 19, 2007
Messages
109
WOWO tytytytytytyvmvmvmvmvm! Never thought of that lol raft_pl=+rep :D
  • Scatter Arrows
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(clusterrockets))
      • (Ordered unit) Equal to EC
    • Actions
      • Set Temp_Point3 = (Target point of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 1
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
              • Set Temp_Point2 = (Temp_Point3 offset by (Random real number between 0.00 and 400.00) towards (Random angle) degrees)
              • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
              • Unit - Order (Last created unit) to Attack Ground Temp_Point2
              • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • Custom script: call RemoveLocation (udg_Temp_Point2)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 2
            • Then - Actions
              • For each (Integer A) from 1 to 12, do (Actions)
                • Loop - Actions
                  • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                  • Set Temp_Point2 = (Temp_Point3 offset by 400.00 towards (Random angle) degrees)
                  • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                  • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                  • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
                  • Custom script: call RemoveLocation (udg_Temp_Point2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 3
                • Then - Actions
                  • For each (Integer A) from 1 to 18, do (Actions)
                    • Loop - Actions
                      • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                      • Set Temp_Point2 = (Temp_Point3 offset by 400.00 towards (Random angle) degrees)
                      • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                      • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                      • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation (udg_Temp_Point)
                      • Custom script: call RemoveLocation (udg_Temp_Point2)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Scatter Arrows (Dummy Cluster Rockets) for EC) Equal to 4
                    • Then - Actions
                      • For each (Integer A) from 1 to 24, do (Actions)
                        • Loop - Actions
                          • Set Temp_Point = ((Position of EC) offset by (Random real number between 100.00 and 350.00) towards (Random real number between (((Facing of EC) - 180.00) + 50.00) and (((Facing of EC) - 180.00) - 50.00)) degrees)
                          • Set Temp_Point2 = (Temp_Point3 offset by 400.00 towards (Random angle) degrees)
                          • Unit - Create 1 Archer (Elven Cmdr) for (Owner of EC) at Temp_Point facing (Facing of EC) degrees
                          • Unit - Order (Last created unit) to Attack Ground Temp_Point2
                          • Unit - Add a 1.80 second Generic expiration timer to (Last created unit)
                          • Custom script: call RemoveLocation (udg_Temp_Point)
                          • Custom script: call RemoveLocation (udg_Temp_Point2)
                    • Else - Actions
      • Custom script: call RemoveLocation (udg_Temp_Point3)
tyvm:thumbs_up:
 
Status
Not open for further replies.
Top