• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Gui Unit indexing system problem

Status
Not open for further replies.
Level 24
Joined
Feb 9, 2009
Messages
1,786
Hello, trying to setup three orbiting units that rotate until the buff applied by the dummy either is dispelled or expired
Problem is that the unit's do not rotate

I'd like to keep the indexing triggers and have it GUI so no hashtables or JASS solutions please!

Here's the triggers:
  • Main Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Orbit
    • Actions
      • Set tempp1 = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at tempp1 facing Default building facing degrees
      • Unit - Add Buff Spell to (Last created unit)
      • Unit - Order (Last created unit) to Human Priest - Inner Fire (Triggering unit)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Set Tempkey = (Custom value of (Triggering unit))
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Kill OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))]
          • Set tempp2 = (tempp1 offset by 50.00 towards (120.00 x (Real((Integer A)))) degrees)
          • Unit - Create 1 Orbit unit for (Owner of (Triggering unit)) at tempp2 facing Default building facing degrees
          • Set OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))] = (Last created unit)
          • Custom script: call RemoveLocation(udg_tempp2)
      • Custom script: call RemoveLocation(udg_tempp1)

  • Dummy Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Buff Spell
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Target unit of ability being cast) is in SS_group) Equal to True
            • Then - Actions
              • Unit Group - Add (Target unit of ability being cast) to SS_group
              • Trigger - Turn on SS Group <gen>
            • Else - Actions
          • Custom script: call RemoveLocation(udg_tempp2)
          • Custom script: call RemoveLocation(udg_tempp1)
        • Else - Actions

  • SS Group
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in SS_group and do (Actions)
        • Loop - Actions
          • Set Tempkey = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Buff ) Equal to True
                • Then - Actions
                  • For each (Integer A) from 1 to 3, do (Actions)
                    • Loop - Actions
                      • Set tempp1 = (Position of (Picked unit))
                      • Set tempp3 = (Position of OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between tempp1 and tempp3) Greater than 50.00
                        • Then - Actions
                          • Set Orbit_Distance[Tempkey] = (Orbit_Distance[Tempkey] + 25.00)
                          • Set tempp2 = (tempp1 offset by 120.00 towards ((120.00 x (Real((Integer A)))) + Orbit_Distance[Tempkey]) degrees)
                          • Unit - Move OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))] instantly to tempp2, facing (Angle from tempp2 to tempp1) degrees
                        • Else - Actions
                          • Set tempp2 = (tempp1 offset by 25.00 towards (Facing of OrbitUnit[Tempkey]) degrees)
                          • Unit - Move OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))] instantly to tempp2, facing (Angle from tempp1 to tempp3) degrees
                          • Unit - Make OrbitUnit[((3 x Tempkey) + ((Integer A) - 1))] face tempp1 over 0.00 seconds
                      • Custom script: call RemoveLocation(udg_tempp3)
                      • Custom script: call RemoveLocation(udg_tempp2)
                      • Custom script: call RemoveLocation(udg_tempp1)
                • Else - Actions
                  • For each (Integer A) from 1 to 3, do (Actions)
                    • Loop - Actions
                      • Unit - Kill OrbitUnit[(((3 x Tempkey) + (Integer A)) - 1)]
                  • Unit Group - Remove (Picked unit) from SS_group
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (SS_group is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off SS Group <gen>
                    • Else - Actions
            • Else - Actions
              • For each (Integer A) from 1 to 3, do (Actions)
                • Loop - Actions
                  • Unit - Kill OrbitUnit[(((3 x Tempkey) + (Integer A)) - 1)]
              • Unit Group - Remove (Picked unit) from SS_group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (SS_group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off SS Group <gen>
                • Else - Actions
 

Attachments

  • Orbit test - GUI UNIT EVENT BY BRIBE DO NOT DISTRIBUTE.w3x
    29.1 KB · Views: 21
Level 10
Joined
Oct 5, 2008
Messages
355
Look at the trigger dummy cast. You add the unit only into the group currently when it is already in it. (which it never will, ofc). Thus, your loop doesnt get activated and the dummies wont orbit. Change the condition
"
((Target unit of ability being cast) is in SS_group) equal to True
"

to
"
((Target unit of ability being cast) is in SS_group) equal to false
"

this would do the trick, and its doing fine in my test, except for that the change of the degrees is with 25°/0,05 sec a bit too fast. 10° had a much smoother effect. On the other hand i wanted to ask what you wanted to do with the check for the distance between the dummies point and the casters point. I don't see a reason for it there, but i don't know if i'm missing something, so i would like to know your reasoning for it :)
 
Last edited:
Level 24
Joined
Feb 9, 2009
Messages
1,786
Thanks so much, fast reply too!

The trigger was cut to show the problem and not unnecessary details
As for the distance bit its in case the buff is transferred to another unit, that way it should float nicely towards the target unit, but as the speed is way out of wack since the trigger was strung together to get the problem solved
 
Status
Not open for further replies.
Top