Strange Waygate Issue

Z

Zouflain

Guest
My goal is to create a world-wrapping waygate system for a map, and the strange thing is I've done this before without issue (it's a simple trigger). The problem is, the waygates created through this trigger have some sort of bug. Rather than teleport a unit to the destination, for some inexplicable reason they are ordering the unit to move there instead. Other waygates created in other triggers (for test purposes) work perfectly well, but this particular trigger has been giving me nothing but headaches.

Another issue I had but resolved was CreateUnit. No matter what coordinate I used, it always appeared in the upper right-hand corner, as though I'd specified a point out of map bounds. To elude this bug, I simply created the unit and then moved it. I dislike the overhead this causes, but the trigger only fires once anyway.

Also, if I've overlooked any memory leaks, I would appreciate anyone pointing them out. I tried MoveLocation vs creating new ones at each cycle for speed, but perhaps this is the issue? I can't see how, but I'm open to all possibilities.

One thing I will change is the GetLocation's, I'll group them into a real for less function calls. Besides THAT, however, I don't see any mistakes.
JASS:
function Trig_Init_Waygates_Actions takes nothing returns nothing
    local location point1 = Location(0,0)
    local location point2 = Location(0,0)
    local unit lastgate1 = null
    local unit lastgate2 = null
    local real cindex = 0
    loop
      call MoveLocation(point1, 11250,(-11250+(300*cindex)))
      call MoveLocation(point2,-11250,(-11250+(300*cindex)))
      set lastgate1 = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',0,0, bj_UNIT_FACING )
      set lastgate2 = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'n000',0,0, bj_UNIT_FACING )
      call SetUnitPosition(lastgate1,GetLocationX(point1),GetLocationY(point1))
      call SetUnitPosition(lastgate2,GetLocationX(point2),GetLocationY(point2))
      call WaygateSetDestination(lastgate1, GetLocationX(point2), GetLocationY(point2))
      call WaygateSetDestination(lastgate2, GetLocationX(point1), GetLocationY(point1))
      call WaygateActivate(lastgate1,true)
      call WaygateActivate(lastgate2,true)
      set lastgate1 = null
      set lastgate2 = null
      set cindex = cindex + 1
      exitwhen cindex > 75
    endloop
  call RemoveLocation(point1)
  call RemoveLocation(point2)
  set point1 = null
  set point2 = null
endfunction

//===========================================================================
function InitTrig_Init_Waygates takes nothing returns nothing
    set gg_trg_Init_Waygates = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Init_Waygates, 0.01 )
    call TriggerAddAction( gg_trg_Init_Waygates, function Trig_Init_Waygates_Actions )
endfunction


Thank you for any input.

Edit: I fixed the issue, but this is apparently some bug in newgen or warcraft itself. If I don't move the waygates, they work fine - but if I do move them, they cannot operate. I don't know why that might be, but removing the SetUnitPosition fixed the problem. I am VERY curious as to what this means, and any input would be greatly appreciated.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top