- Joined
- Jan 9, 2016
- Messages
- 1,487
How do we change the building birth effects for each building?Does is depends on the building's race?
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.
This is how I did it, but I am sure there is a better way.
Another way I did this for a different unit was to slowly increase the size of the unit being built. This was a Goblin Hut. I make it small and added a dust animation. It looks the the birth animation from the Dalaran Ruins tower birth.
The other way would be to edit the model with a third-party model editing program. |
function UT_Comparison takes integer ut returns integer
if ut == 'n00N' then
return 1
elseif ut == 'n002' or ut == 'n00O' then
return 2
elseif ut == 'n00M' or ut == 'e005' then
return 3
elseif ut == 'n00P' then
return 4
endif
return 0
endfunction
function Cosmetics takes nothing returns boolean
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit c
local integer i = UT_Comparison(GetUnitTypeId(u))
if i != 0 then
call SetUnitVertexColor( u , 100, 100, 100, 1 )
set c = CreateUnit( GetOwningPlayer(u), 'n01F', x , y , 0.00 )
if i == 3 then
call SetUnitScalePercent( c , 100, 100, 100 )
elseif i == 4 then
call SetUnitScalePercent( c , 160, 160, 160 )
endif
call SetUnitAnimation( c , "birth" )
call SaveUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 , c)
endif
return false
endfunction
function Cosm_Removal1 takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit c
local real x
local real y
local integer i = UT_Comparison(GetUnitTypeId(u))
if i != 0 then
set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
call RemoveUnit(c)
call SetUnitVertexColorBJ( u , 100, 100, 100, 0.00 )
if i == 1 then
set x = GetUnitX(u) - 110
set y = GetUnitY(u) + 25
set c = CreateUnit( GetOwningPlayer(u), 'h00F', x, y, 270.00 )
call SaveUnitHandle( udg_Cosmetic_Table, GetHandleId(u), 0 , c )
endif
call SaveBoolean( udg_Cosmetic_Table, GetHandleId(u), 1, true )
set c = null
endif
set u = null
return false
endfunction
function Cosm_Removal2 takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit c
local real x
local real y
local effect e
local integer i = UT_Comparison(GetUnitTypeId(u))
if i != 0 then
if LoadBoolean( udg_Cosmetic_Table, GetHandleId(u), 1 ) then
if i == 1 then
set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
set x = GetUnitX(c)
set y = GetUnitY(c)
call RemoveUnit(c)
set e = AddSpecialEffect("Abilities\\Weapons\\GlaiveMissile\\GlaiveMissileTarget.mdl", x, y)
call DestroyEffect(e)
set e = null
endif
else
set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
call RemoveUnit(c)
call FlushChildHashtable(udg_Cosmetic_Table, GetHandleId(u))
set c = null
endif
endif
set u = null
return false
endfunction
//===========================================================================
function InitTrig_Building_models takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger r = CreateTrigger()
set gg_trg_Building_models = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Building_models, EVENT_PLAYER_UNIT_CONSTRUCT_START )
call TriggerAddCondition( gg_trg_Building_models, Condition(function Cosmetics) )
call TriggerRegisterAnyUnitEventBJ( r , EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
call TriggerRegisterAnyUnitEventBJ( r , EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL )
call TriggerAddCondition( t , Condition(function Cosm_Removal1) )
call TriggerAddCondition( r , Condition(function Cosm_Removal2) )
set t = null
set r = null
endfunction
