Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I believe it can't because of the way wc3 saves / interpretes the units / widgets. I thought I saw a get item name but I can't be sure as I am not near my pc right now
globalls
private unit temp
private destructable tempd
private item tempi
private Table t
endglobals
function Widget2Unit takes widget w returns unit
set t.widget[0] = w
set temp = t.unit[0]
call t.flush()
return temp
endfunction
function Widget2Destructable takes widget w returns destructable
set t.widget[0] = w
set tempd = t.destructable[0]
call t.flush()
return tempd
endfunction
function Widget2Item takes widget w returns item
set t.widget[0] = w
set tempi = t.item[0]
call t.flush()
return tempi
endfunction
function GetWidgetType takes widget w returns integer
set t.widget[0] = w
if t.unit[0] != null then
call t.flush()
return 1
elseif t.item[0] != null then
call t.flush()
return 2
elseif t.destructable[0] != null then
call t.flush()
return 3
endif
return 0
endfunction
function GetWidgetName takes widget w returns string
local integer i = GetWidgetType(w)
if i == 1 then
return GetUnitName(Widget2Unit(w))
elseif i == 2 then
return GetItemName(Widget2Item(w))
elseif i == 3 then
return GetDestructableName(Widget2Destructable(w))
else
return "Failed"
endif
endfunction
TriggerRegisterAnyUnitEventBJ(,EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER) function for issues on destructibles & items?I'm guessing its just because its a player unit event.
EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER -> EVENT_PLAYER_UNIT_ISSUED_ORDERGetObjectNameGetObjectName
Though this only retrieves object's names via raw data.
You can also use typecasting.
GetObjectName
Though this only retrieves object's names via raw data.
You can also use typecasting.
e/ why wontTriggerRegisterAnyUnitEventBJ(,EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER)function for issues on destructibles & items?
constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER = ConvertPlayerUnitEvent(40)
EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER is mostly just for compatibility with older maps that might've used it. They added the target order event in a patch iirc.GetOrderTarget() to get the target. It returns a widget. There are also other event responses:constant native GetOrderTargetDestructable takes nothing returns destructable
constant native GetOrderTargetItem takes nothing returns item
constant native GetOrderTargetUnit takes nothing returns unit
You should use:
Instead.JASS:constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER = ConvertPlayerUnitEvent(40)EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDERis mostly just for compatibility with older maps that might've used it. They added the target order event in a patch iirc.
You useGetOrderTarget()to get the target. It returns a widget. There are also other event responses:
If I'm not mistaken, you should be able to check which one isn't null to figure out whether it is a unit, destructable, or item that was targeted. Someone made a script for it a while back, I can't find it though.JASS:constant native GetOrderTargetDestructable takes nothing returns destructable constant native GetOrderTargetItem takes nothing returns item constant native GetOrderTargetUnit takes nothing returns unit
EDIT: Found it:
https://www.hiveworkshop.com/forums/jass-resources-412/snippet-order-types-169593/
e/ why wontTriggerRegisterAnyUnitEventBJ(,EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER)function for issues on destructibles & items?
