HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Moving unit to player's camera target

01-27-2007, 09:15 AM#1
Maszrum
I wonder if it's possible to get camera target coordinates for certain player in multiplayer game. Then I'd like to move a unit owned by player to these coodrinates.

The following code doesn't work:
Collapse JASS:
function MoveUnitToCameraTarget takes unit u, player p returns nothing

    local real x
    local real y

    if(GetLocalPlayer()==p)then
        set x=GetCameraTargetPositionX()
        set y=GetCameraTargetPositionY()
    endif

        call SetUnitX(u, x) 
        call SetUnitY(u, y)
endfunction

I'm not sure if I do it correctly, so I ask for help.
01-27-2007, 10:08 AM#2
PipeDream
http://www.wc3jass.com/viewtopic.php?t=2676
01-27-2007, 11:00 PM#3
Guest
Collapse JASS:
function MoveUnitToCameraTarget takes unit u, player p returns nothing

    local location l


    if(GetLocalPlayer()==p)then
        set l=GetCameraTargetPositionLoc()
        call SetUnitPositionLoc( u, l )
        call RemoveLocation(l)
    endif

endfunction


Try this?