Why doesn't this unit get created?

Cokemonkey11

New Member
Reaction score
18
JASS:

globals
unit slideUnit
integer i
endglobals

function moveInCircle takes nothing returns nothing
    local location currentPos = GetUnitLoc(slideUnit)
    local location currentPosOff
    local real posOffX
    local real posOffY
    set i = (R2I(GetUnitFacing(slideUnit)))
    set currentPosOff = PolarProjectionBJ(currentPos,10,i)
    set posOffX = GetLocationX(currentPosOff)
    set posOffY = GetLocationY(currentPosOff)
    call SetUnitX(slideUnit,posOffX)
    call SetUnitY(slideUnit,posOffY)
endfunction

function Trig_dummyCenter_Actions takes nothing returns nothing
    local timer time = CreateTimer()
    set slideUnit = CreateUnitAtLoc(Player(0),'hfoo',GetRectCenter(gg_rct_regionTemp),270)
    set i = 270
    call TimerStart(time,.03,true,function moveInCircle)
endfunction

function hoverCar takes nothing returns nothing
    set gg_trg_hoverCar = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_hoverCar,2,false)
    call TriggerAddAction(gg_trg_hoverCar, function Trig_dummyCenter_Actions)
endfunction


nothing seems to happen - specifically the unit doesnt get spawned.

When I go to syntax check it tells me gg_rct_regionTemp isn't specified but when i create a gui trigger with it and convert to custom text it does the same, so I assume that's not the problem.

Any help appreciated.
 

Dryvnt

New Member
Reaction score
10
JASS:
globals
unit slideUnit
integer i
endglobals

function moveInCircle takes nothing returns nothing
    local location currentPos = GetUnitLoc(slideUnit)
    local location currentPosOff
    local real posOffX
    local real posOffY
    set i = (R2I(GetUnitFacing(slideUnit)))
    set currentPosOff = PolarProjectionBJ(currentPos,10,i)
    set posOffX = GetLocationX(currentPosOff)
    set posOffY = GetLocationY(currentPosOff)
    call SetUnitX(slideUnit,posOffX)
    call SetUnitY(slideUnit,posOffY)
endfunction

function Trig_dummyCenter_Actions takes nothing returns nothing
    local timer time = CreateTimer()
    set slideUnit = CreateUnitAtLoc(Player(0), ------> 'hfoo' <------ ,GetRectCenter(gg_rct_regionTemp),270)
    set i = 270
    call TimerStart(time,.03,true,function moveInCircle)
endfunction

function hoverCar takes nothing returns nothing
    set gg_trg_hoverCar = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_hoverCar,2,false)
    call TriggerAddAction(gg_trg_hoverCar, function Trig_dummyCenter_Actions)
endfunction


nothing seems to happen - specifically the unit doesnt get spawned.

When I go to syntax check it tells me gg_rct_regionTemp isn't specified but when i create a gui trigger with it and convert to custom text it does the same, so I assume that's not the problem.

Any help appreciated.

I dno if im right, but maybe replace the two o's in hfoo with hf00? :/ I prolly dont be right
 

Flare

Stops copies me!
Reaction score
662
Try creating the unit at GetRectCenter (GetPlayableMapArea ()), or the bj_ variable for Initial Playable Map, I forget what it's called, just for testing purposes - if you try to create a unit at a non-existant location, it won't be created at all.

And, as Faust suggested, add some BJDebugMsg's, particularly immediately before/after the CreateUnitAtLoc, incase gg_rct_regionTemp isn't initialized for some reason
 

Romek

Super Moderator
Reaction score
964
Is the "hoverCar" function even ran?
By default, that should be "InitTrig_hoverCar" so that it is ran on Map Init.

If you have newgen, you could use initializers and scopes.
 

Cokemonkey11

New Member
Reaction score
18
Try creating the unit at GetRectCenter (GetPlayableMapArea ()), or the bj_ variable for Initial Playable Map, I forget what it's called, just for testing purposes - if you try to create a unit at a non-existant location, it won't be created at all.

And, as Faust suggested, add some BJDebugMsg's, particularly immediately before/after the CreateUnitAtLoc, incase gg_rct_regionTemp isn't initialized for some reason

This was the problem. Thanks for the help. I must have done something wrong with the rect settings.

Once again "you must spread some reputation around before giving to flare again" =/
 
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