• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Problem when Moving units

Status
Not open for further replies.
Level 23
Joined
Apr 8, 2017
Messages
1,624
Hi, im trying to make my own version of the "Sphere" from Bloodmage but with triggers

Trigger, EVERY 0.02 seconds btw
  • Acciones
    • Set zzzDruPriVisualLocBase = ((Position of zzzDruPriVisualUnit[100]) offset by (15.00, 0.00))
    • Set zzzDruPriVisualValue[1] = 1.00
    • Set zzzDruPriVisualAng = (zzzDruPriVisualAng + zzzDruPriVisualValue[1])
    • Set zzzDruPriVisualValue[2] = 50.00
    • -------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • if: Conditions
        • zzzDruPriVisualAng Mayor que o igual a 360.00
      • then: Actions
        • Set zzzDruPriVisualAng = (zzzDruPriVisualAng - 360.00)
      • Otros: Actions
    • Set zzzDruPriVisualLoc1 = (zzzDruPriVisualLocBase offset by zzzDruPriVisualValue[2] towards zzzDruPriVisualAng degrees)
    • Unit - Move zzzDruPriVisualUnit[1] instantly to zzzDruPriVisualLoc1, facing 90.00 degrees
    • -------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • if: Conditions
        • zzzDruPriVisualAng Mayor que o igual a 360.00
      • then: Actions
        • Set zzzDruPriVisualAng = (zzzDruPriVisualAng - 360.00)
      • other: Actions
    • Set zzzDruPriVisualLoc2 = (zzzDruPriVisualLocBase offset by zzzDruPriVisualValue[2] towards zzzDruPriVisualAng degrees)
    • Set zzzDruPriVisualAng = (zzzDruPriVisualAng + 120.00)
    • Unit - Move zzzDruPriVisualUnit[2] instantly to zzzDruPriVisualLoc2, facing 90.00 degrees
    • -------- --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • if: Conditions
        • zzzDruPriVisualAng Mayor que o igual a 360.00
      • then: Actions
        • Set zzzDruPriVisualAng = (zzzDruPriVisualAng - 360.00)
      • other: Actions
    • Set zzzDruPriVisualLoc3 = (zzzDruPriVisualLocBase offset by zzzDruPriVisualValue[2] towards zzzDruPriVisualAng degrees)
    • Set zzzDruPriVisualAng = (zzzDruPriVisualAng + 120.00)
    • Unit - Move zzzDruPriVisualUnit[3] instantly to zzzDruPriVisualLoc3, facing 90.00 degrees
    • -------- --------
    • -------- --------
    • Custom script: call RemoveLocation(udg_zzzDruPriVisualLoc1)
    • Custom script: call RemoveLocation(udg_zzzDruPriVisualLoc2)
    • Custom script: call RemoveLocation(udg_zzzDruPriVisualLoc3)
    • Custom script: call RemoveLocation(udg_zzzDruPriVisualLocBase)

The problem is that the units has a weird effect that its like a "twinkle"

ezgif-2-e0da293ce5.gif


.
 
Two of them are being moved to the same location, and the unused location precesses around every 3 cycles, so 0.06s. I expect that’s the issue. You change the angle after moving #2 instead of increasing the angle right after you move #1. What you did from 2->3 is correct, you just messed up 1->2.

There should be no need to check the angle >=360 between each unit; the game knows how to handle 495 degrees or whatever. Just do the check once, or better: use the Modulo function, which gives the remainder when dividing by a number. 402 mod 360 is 42, the leftover after taking away 360. This works no matter how many multiples of 360 higher the angle variable is; it will always reduce to < 360.
 
Two of them are being moved to the same location, and the unused location precesses around every 3 cycles, so 0.06s. I expect that’s the issue. You change the angle after moving #2 instead of increasing the angle right after you move #1. What you did from 2->3 is correct, you just messed up 1->2.

There should be no need to check the angle >=360 between each unit; the game knows how to handle 495 degrees or whatever. Just do the check once, or better: use the Modulo function, which gives the remainder when dividing by a number. 402 mod 360 is 42, the leftover after taking away 360. This works no matter how many multiples of 360 higher the angle variable is; it will always reduce to < 360.
Well, it works for me, it made me do some fixes, tyvm 😘
 
Status
Not open for further replies.
Back
Top