Triggered Movement Problem

chukky-jr

Member
Reaction score
15
can anybode pointed out what's wrong with the 2nd trigger? the unit always moves in a straight line, to left/right/up/down i want the unit to move to its target

Trigger:
  • Shotlock Starts
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shotlock
    • Actions
      • Set ShotlockIndex[1] = (ShotlockIndex[ShotlockIndex[1]] + 1)
      • Set ShotlockIndex[2] = (ShotlockIndex[ShotlockIndex[2]] + 1)
      • Set ShotlockTarget[ShotlockIndex[2]] = (Target unit of ability being cast)
      • Set ShotlockTargetPosition[ShotlockIndex[2]] = (Position of ShotlockTarget[ShotlockIndex[2]])
      • Set ShotlockCaster[ShotlockIndex[2]] = (Casting unit)
      • Set ShotlockCasterPosition[ShotlockIndex[2]] = (Position of ShotlockCaster[ShotlockIndex[2]])
      • Set ShotlockAngle[ShotlockIndex[2]] = (Angle from ShotlockTargetPosition[2] to ShotlockPosition[2])
      • Set ShotlockDuration[ShotlockIndex[2]] = ((Real((Level of Shotlock for ShotlockCaster[ShotlockIndex[2]]))) + 2.00)
      • -------- Create Projectile --------
      • Unit - Create 1 Compressor for (Owner of ShotlockCaster[ShotlockIndex[2]]) at ShotlockCasterPosition[ShotlockIndex[2]] facing ShotlockAngle[ShotlockIndex[2]] degrees
      • Unit - Turn collision for ShotlockCompUnit[ShotlockIndex[2]] Off
      • Set ShotlockCompUnit[ShotlockIndex[2]] = (Last created unit)
      • Set ShotlockPosition[ShotlockIndex[2]] = (Position of ShotlockCompUnit[ShotlockIndex[2]])
      • Unit - Set the custom value of ShotlockCompUnit[ShotlockIndex[2]] to ShotlockIndex[2]
      • Unit - Set the custom value of ShotlockTarget[ShotlockIndex[2]] to ShotlockIndex[2]
      • Trigger - Turn on Shotlock Moves <gen>


Trigger:
  • Shotlock Moves
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Shotlock Moves Run
      • For each (Integer ShotlockIndex[4]) from 1 to ShotlockIndex[2], do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (Picked + (String((Custom value of (Picked unit)))))
          • Set ShotlockTargetPosition[ShotlockIndex[4]] = (Position of ShotlockTarget[ShotlockIndex[4]])
          • Set ShotlockPosition[ShotlockIndex[4]] = (Position of ShotlockCompUnit[ShotlockIndex[4]])
          • Set ShotlockAngle[ShotlockIndex[4]] = (Angle from ShotlockTargetPosition[4] to ShotlockPosition[4])
          • Set ShotlockTempPoint1[ShotlockIndex[4]] = (ShotlockPosition[ShotlockIndex[4]] offset by 25.00 towards ShotlockAngle[ShotlockIndex[4]] degrees)
          • Set ShotlockDistance[ShotlockIndex[4]] = (Distance between ShotlockPosition[ShotlockIndex[4]] and ShotlockTargetPosition[ShotlockIndex[4]])
          • Unit - Move ShotlockCompUnit[ShotlockIndex[4]] instantly to ShotlockTempPoint1[ShotlockIndex[4]]
          • Custom script: call RemoveLocation (udg_ShotlockTempPoint1[udg_ShotlockIndex[4]])


note :
the Game - Display blablabla was for debugging purpose
some variables are used in other trigger, those 'other' is completely irrelevant since those only works if the 'Shotlock Moves' worked properly
 

chukky-jr

Member
Reaction score
15
nevermind, i fix'd em, the problem was Angle between Degrees returns value between -180 to 180, adding 180 to the variable fix'd em
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
just a heads up your triggers are leaking, you need to set a variable temp_Location or something of that sort to the positions and destroy them after the trigger finishes
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top