- Joined
- Jul 28, 2008
- Messages
- 211
Is there an event that runs when a unit begins counstruction that allows me to get the builder unit?
Thanks!
Thanks!
title.
native:[code=jass]call TriggerRegisterPlayerUnitEvent(trig, Player(index), whichEvent, null)
function TriggerRegisterAnyUnitEventBJ takes trigger trig, playerunitevent whichEvent returns nothing
EVENT_PLAYER_UNIT_CONSTRUCT_START
That was in GUI but since the thread has aJASS:title.[/QUOTE] Ooops... sorry, didn't notice :D JASS from now on, got it ;)
function Trig_Building_Actions takes nothing returns nothing
local string u = UnitId2String(String2UnitIdBJ(OrderId2StringBJ(GetIssuedOrderIdBJ())))
if u!=null then
call DisplayTextToForce( GetPlayersAll(), UnitId2StringBJ(GetUnitTypeId(GetTriggerUnit()))+" is building: "+u )
else
call DisplayTextToForce( GetPlayersAll(), "other order" )
endif
endfunction
//===========================================================================
function InitTrig_Building takes nothing returns nothing
set gg_trg_Building = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Building, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( gg_trg_Building, function Trig_Building_Actions )
endfunction
Try this
Untitled Trigger 001
Events
Unit - A unit Begins construction
Unit - A unit Is issued an order targeting a point
Conditions
Actions
Set structure = (Constructing structure)
Set constructor = (Ordered unit)
Game - Display to (All players) the text: (String((Unit-type of structure)))
Game - Display to (All players) the text: (String((Unit-type of constructor)))
You're welcome.
But don't forget to add a condition to check the issued order, but I don't know the build order string so that the trigger don't fire every time an order other than building is issued.