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

GUI/MUI Loop/Distance [Bug]

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
here im making a spell request for some1, evrything seems to work xcept the value RDistance do not work at all!!!

when the RDummyUnit come to target point it should die & explode but nothing come to it,

Yes my variable name are shitty becuz i based it on another system i had

P.S i might have forgot to nullyfiy some variable & my structure probly aint the best any other tips for the trigger itself also Thanks


  • Spell 1 MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spell 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RLoop[1] Equal to 0
        • Then - Actions
          • -------- if that value is zero then it means, there are no instances running at the moment, so we now turn on the Example Loop trigger --------
          • Game - Display to (All players) the text: WE TURN ON LOOP
          • Trigger - Turn on Spell 1 Loop <gen>
        • Else - Actions
      • -------- ------------ --------
      • Game - Display to (All players) the text: WE SETTING VARIABLE
      • Set RLoop[1] = (RLoop[1] + 1)
      • Set RLoop[2] = (RLoop[2] + 1)
      • -------- ------------ --------
      • Set RUnit[RLoop[2]] = (Triggering unit)
      • Set RAoe[RLoop[2]] = 400.00
      • Set RSpeed[RLoop[2]] = 10.00
      • Set RDamage[RLoop[2]] = (10.00 x ((Real((Level of Spell 1 for RUnit[RLoop[2]]))) + (Real((Strength of RUnit[RLoop[2]] (Exclude bonuses))))))
      • Set RStun[RLoop[2]] = True
      • Set REffectStopper[RLoop[2]] = False
      • Set RActive[RLoop[2]] = True
      • -------- ------------ --------
      • Set PointLeak2[200] = (Target point of ability being cast)
      • Set PointLeak2[199] = (PointLeak2[200] offset by RAoe[RLoop[2]] towards (Random angle) degrees)
      • Set RTarget[RLoop[2]] = (Target unit of ability being cast)
      • Set REffect = Units\NightElf\Wisp\WispExplode.mdl
      • Set PointLeak2[202] = (Position of RTarget[RLoop[2]])
      • -------- ------------ --------
      • Set RAngleFacing[RLoop[2]] = (Angle from PointLeak2[199] to PointLeak2[203])
      • Unit - Create 1 Dummy Unit for (Owner of RUnit[RLoop[2]]) at PointLeak2[199] facing RAngleFacing[RLoop[2]] degrees
      • Set RDummyUnit[RLoop[2]] = (Last created unit)
      • Set RDummyUnit2[RLoop[2]] = RDummyUnit[RLoop[2]]
      • Unit - Order RDummyUnit2[RLoop[2]] to Attack RTarget[RLoop[2]]
      • Set PointLeak2[201] = (Position of RDummyUnit2[RLoop[2]])
      • Set RAngle[RLoop[2]] = (Angle from PointLeak2[201] to PointLeak2[202])
      • -------- ------------ --------
      • Set RDistance[RLoop[2]] = (Distance between PointLeak2[201] and PointLeak2[202])
      • -------- ------------ --------
      • -------- STUN formula ; RStuncheck = duration stun / 0,03(trigger loop) /// 7/0,03 /// 12/0,03 etc --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RStun[RLoop[2]] Equal to True
        • Then - Actions
          • Unit - Pause RTarget[RLoop[2]]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Spell 1 for RUnit[RLoop[2]]) Equal to 1
            • Then - Actions
              • Set RStunCheck[RLoop[2]] = 233
              • Game - Display to (All players) the text: STUN BEGIN
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RStunCheckXtra[RLoop[2]] Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: CANNOT STUN MORE TH...
                  • Set RStunCheck[RLoop[2]] = 0
                • Else - Actions
              • Set RStunCheckXtra[RLoop[2]] = True
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Spell 1 for RUnit[RLoop[2]]) Equal to 2
            • Then - Actions
              • Set RStunCheck[RLoop[2]] = 400
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RStunCheckXtra[RLoop[2]] Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: CANNOT STUN MORE TH...
                  • Set RStunCheck[RLoop[2]] = 0
                • Else - Actions
              • Set RStunCheckXtra[RLoop[2]] = True
              • Game - Display to (All players) the text: STUN BEGIN
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Spell 1 for RUnit[RLoop[2]]) Equal to 3
            • Then - Actions
              • Set RStunCheck[RLoop[2]] = 600
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RStunCheckXtra[RLoop[2]] Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: CANNOT STUN MORE TH...
                  • Set RStunCheck[RLoop[2]] = 0
                • Else - Actions
              • Set RStunCheckXtra[RLoop[2]] = True
              • Game - Display to (All players) the text: STUN BEGIN
            • Else - Actions
        • Else - Actions
      • -------- ------------ --------
      • Custom script: call RemoveLocation(udg_PointLeak2[199])
      • Custom script: call RemoveLocation(udg_PointLeak2[200])
      • Custom script: call RemoveLocation(udg_PointLeak2[201])
      • Custom script: call RemoveLocation(udg_PointLeak2[202])
      • Game - Display to (All players) the text: END WE DESTROY USEL...

  • Spell 1 Loop
    • Events
      • Unit - A unit Is attacked
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer RLoop[3]) from 1 to RLoop[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RStun[RLoop[3]] Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: STUN REDUCED
              • Set RStunCheck[RLoop[3]] = (RStunCheck[RLoop[3]] - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (RStunCheck[RLoop[3]] Equal to 0) or ((RTarget[RLoop[3]] is dead) Equal to True)
                • Then - Actions
                  • Game - Display to (All players) the text: NO MORE STUN
                  • Set RLoop[1] = (RLoop[1] - 1)
                  • Unit - Unpause RTarget[RLoop[3]]
                  • Set RTarget[RLoop[3]] = No unit
                  • Set RStunCheckXtra[RLoop[2]] = False
                • Else - Actions
            • Else - Actions
          • Set PointLeak2[201] = (Position of RDummyUnit2[RLoop[2]])
          • Set PointLeak2[202] = (Position of RTarget[RLoop[2]])
          • Set RDistance[RLoop[3]] = (Distance between PointLeak2[201] and PointLeak2[202])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RActive[RLoop[3]] Equal to True
              • (RDummyUnit2[RLoop[3]] is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: LOOP Active
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RDistance[RLoop[3]] Greater than 0.00
                  • (RDummyUnit2[RLoop[3]] is alive) Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: LOOP 1
                  • Unit - Order RDummyUnit2[RLoop[3]] to Attack RTarget[RLoop[3]]
                  • Set PointLeak2[203] = (PointLeak2[201] offset by RSpeed[RLoop[3]] towards RAngleFacing[RLoop[3]] degrees)
                  • Unit - Move RDummyUnit2[RLoop[3]] instantly to PointLeak2[203], facing RAngleFacing[RLoop[3]] degrees
                  • Custom script: call RemoveLocation(udg_PointLeak2[203])
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RDistance[RLoop[3]] Less than 0.00
                    • Then - Actions
                      • Game - Display to (All players) the text: LOOP 4
                      • Unit - Cause RUnit[RLoop[3]] to damage RTarget[RLoop[3]], dealing RDamage[RLoop[3]] damage of attack type Spells and damage type Normal
                      • Unit - Kill RDummyUnit[RLoop[3]]
                      • Unit - Kill RDummyUnit2[RLoop[3]]
                      • Set RActive[RLoop[3]] = False
                    • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (RDistance[RLoop[3]] Less than or equal to 0.00) or ((Attacked unit) Equal to RTarget[RLoop[3]])
                • Then - Actions
                  • Game - Display to (All players) the text: LOOP 4B
                  • Unit - Cause RUnit[RLoop[3]] to damage RTarget[RLoop[3]], dealing RDamage[RLoop[3]] damage of attack type Spells and damage type Normal
                  • Unit - Kill RDummyUnit[RLoop[3]]
                  • Unit - Kill RDummyUnit2[RLoop[3]]
                  • Set RActive[RLoop[3]] = False
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RLoop[1] Equal to 0
                • Then - Actions
                  • Game - Display to (All players) the text: WE CLOSE TRIGGER CU...
                  • -------- if no spell is running we turn off the trigger --------
                  • Set RLoop[2] = 0
                  • Trigger - Turn off (This trigger)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • REffectStopper[RLoop[3]] Equal to False
              • (RDummyUnit2[RLoop[3]] is dead) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: END OF SPELL + SPEC...
              • Set PointLeak2[196] = (Position of RDummyUnit[RLoop[3]])
              • Special Effect - Create a special effect at PointLeak2[196] using REffect
              • Custom script: call RemoveLocation(udg_PointLeak2[196])
              • Special Effect - Destroy (Last created special effect)
              • -------- end of spell we destroy dummy created in first trigger & reseting variable to prevent glitch --------
              • Unit - Remove RDummyUnit[RLoop[3]] from the game
              • Set REffectStopper[RLoop[3]] = True
              • Set RAngle[RLoop[3]] = 0.00
              • Set RAngleFacing[RLoop[3]] = 0.00
              • Set RDistance[RLoop[3]] = 0.00
              • Set RSpeed[RLoop[3]] = 0.00
              • Set RDamage[RLoop[3]] = 0.00
              • Set RUnit[RLoop[3]] = No unit
              • Set RDummyUnit[RLoop[3]] = No unit
              • Set RDummyUnit2[RLoop[3]] = No unit
            • Else - Actions
          • Custom script: call RemoveLocation(udg_PointLeak2[195])
          • Custom script: call RemoveLocation(udg_PointLeak2[197])
          • Custom script: call RemoveLocation(udg_PointLeak2[202])
          • Custom script: call RemoveLocation(udg_PointLeak2[201])

 
Status
Not open for further replies.
Top