I've registered EVENT_UNIT_SELECTED on the trigger, and how to get the selecting/clicking player? I've already known that GetTrigerredUnit() to get the selected unit. I've tried GetTriggerPlayer() but the result is not right...
Here is the code
Here is the code
vJASS:
function myaction takes nothing returns nothing
unit u = GetTriggerUnit()
player p = GetTriggerPlayer() // WRONG!!!
...
end
function trigger takes nothing returns nothing
trigger t = CreateTrigger()
unit u = CreateUnit(...)
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_SELECTED )
call TriggerAddAction(t, function myaction)
set t = null
end
Last edited: