Trackable API

From WarCraft3

Jump to: navigation, search

The Trackable API is a half finished API that lets you detect players mouse actions. You create a trackable with CreateTrackable and use TriggerRegisterTrackableHitEvent or TriggerRegisterTrackableTrackEvent to register events. There is no built in way to detect what player triggered the event, but with clever use of GetLocalPlayer and an attachment system you can achieve the same effect.

function GetTrackablePlayer takes trackable t returns player
    return Player(GetAttachedInt(t))
endfunction

function CreateTrackablePlayer takes player p, string trackableModelPath, real x, real y, real facing returns trackable
    local trackable t
    if GetLocalPlayer() != p then
        set trackableModelPath = ""
    endif
    set t = CreateTrackable(trackableModelPath, x, y, facing)
    call SetAttachedInt(t, GetPlayerId(p))
    return t
endfunction


Code

common.j

//============================================================================
// Trackable API
native CreateTrackable      takes string trackableModelPath, real x, real y, real facing returns trackable
Confused? Jass help forum!
Personal tools