scorpion182
New Member
- Reaction score
- 5
Is there any function to get unit scale (size) ?
No, there isn't.
You could make your own SetScaleEx that stores the unit scale as well as making the unit smaller/bigger though.
globals
real array SCALE_SIZE
integer array SCALE_UNIT
constant integer MAX_INDEX = 1 // <--e.t.c
endglobals
function GetUnitScale takes unit u returns real
local integer i = 1
loop
exitwhen i > MAX_INDEX
if SCALE_UNIT<i> == GetUnitTypeId(u) then
return SCALE_SIZE<i>
endif
set i = i + 1
endloop
return 0
endfunction
function Init...
set SCALE_UNIT[1] = 039;HMkg039;
set SCALE_SIZE[1] = 1.00 // <-- change it to the size in OE ?
endfunction</i></i>
library Scale initializer Init needs Table
globals
private HandleTable Tab
endglobals
private struct Data
real scale
endstruct
function SetUnitScaleEx takes unit u, real scale returns nothing
local Data d
if not Tab.exists(u) then
set d = Data.create()
set Tab<u> = d
else
set d = Tab<u>
endif
set d.scale = scale
call SetUnitScale(u, scale, scale, scale)
endfunction
function GetUnitScale takes unit u returns real
return Data(Tab<u>).scale
endfunction
private function Cond takes nothing returns boolean
local unit u = GetTriggerUnit()
if Tab.exists(u) then
call Data(Tab<u>).destroy()
call Tab.flush(u)
endif
set u = null
return false
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(t, Filter(function Cond))
set Tab = HandleTable.create()
endfunction
endlibrary</u></u></u></u>