HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem with moving to point with offset

08-02-2007, 07:02 AM#1
Fluff
I have a trigger that move a "squad" of 5 units around based on the position of the captain unit. I set up some variables like this:

P1Leader = player 1's captain unit)
P1Squad[x] = array with 1-5 set as the other units

Trigger is called "P1MovesCopy"

The group should form up around the captain when the captain moves, but instead only P1Squad[1] moves to the correct position, and the other 4 units move to the center of the map and not in formation. I just did this in GUI real quick, but I converted to custom text to I could try to work with it a little.

Collapse JASS:
function Trig_P1MovesCopy_Conditions takes nothing returns boolean
    if ( not ( GetTriggerUnit() == udg_P1Leader ) ) then
        return false
    endif
    return true
endfunction

function Trig_P1MovesCopy_Actions takes nothing returns nothing
    call IssuePointOrderLocBJ( udg_P1Squad[1], "attack", OffsetLocation(GetOrderPointLoc(), -100.00, -200.00) )
    call IssuePointOrderLocBJ( udg_P1Squad[2], "attack", OffsetLocation(GetOrderPointLoc(), 100.00, -200.00) )
    call IssuePointOrderLocBJ( udg_P1Squad[3], "attack", OffsetLocation(GetOrderPointLoc(), 0.00, 200.00) )
    call IssuePointOrderLocBJ( udg_P1Squad[4], "attack", OffsetLocation(GetOrderPointLoc(), -100.00, 100.00) )
    call IssuePointOrderLocBJ( udg_P1Squad[5], "attack", OffsetLocation(GetOrderPointLoc(), 100.00, 100.00) )
endfunction

//===========================================================================
function InitTrig_P1MovesCopy takes nothing returns nothing
    set gg_trg_P1MovesCopy = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_P1MovesCopy, Player(0), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_P1MovesCopy, Condition( function Trig_P1MovesCopy_Conditions ) )
    call TriggerAddAction( gg_trg_P1MovesCopy, function Trig_P1MovesCopy_Actions )
    set gg_trg_P1MovesCopy = null
endfunction

I bet it's a simple problem but I'm too newb. Hopefully it won't take too much effort for a quick fix. Thanks everyone.

There's rep to be had.
08-02-2007, 07:18 AM#2
Tide-Arc Ephemera
I don't JASS, nor will I ever, and this may sound stupid, but have you assigned 5 legitimate units?
08-02-2007, 07:29 AM#3
CommanderZ
I would set the GetOrderPointLoc() to location and work with it as with variable.
08-02-2007, 08:22 AM#4
Fluff
Tide, I know that the units are legit because they do move when the trigger fires, just to the wring place.

CommanderZ, thank you very much I set up a variable and it now works very well. rep'd