Code:
//ALL HEADERS HERE IS ORIGINALLY WRITTEN BY D'SecTioN
function ApplyHeroRespawn takes location respos, unit hero, real duration returns nothing
local leaderboard array l
set l[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] = CreateLeaderboard()
set l[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] = CreateLeaderboardBJ( GetForceOfPlayer(GetOwningPlayer(hero)), ( GetHeroProperName(hero)+": " + I2S(R2I(duration)) + " s"))
call LeaderboardDisplay(l[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))],true)
loop
exitwhen (duration<1)
call TriggerSleepAction(1.00)
set duration = duration-1
call LeaderboardSetLabelBJ(l[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))], GetHeroProperName(hero) + ": " + I2S(R2I(duration)) + "s")
endloop
call ReviveHeroLoc( hero, respos, true )
call DestroyLeaderboard(l[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))])
endfunction
function ApplyFadeEffect takes real start, real end, real smooth, unit wUnit, real duration , real r, real g, real b returns nothing
local real ct = 0
local real step = ((end-start)/duration) / smooth
local real target = end-start
//using 0.2sec step
//call SetUnitVertexColorBJ(wUnit,r,g,b,start)
call BJDebugMsg("STEP! " + R2S(step))
call BJDebugMsg("TARGET! " + R2S(target))
if target > 0 then
loop
exitwhen ct == target
call TriggerSleepAction(1/ smooth)
set ct = ct + step
call BJDebugMsg("CTPlus!! " + R2S(ct))
call SetUnitVertexColorBJ(wUnit,r,g,b,100.00 - ct)
endloop
elseif target < 0 then
loop
exitwhen ct == target
call TriggerSleepAction(1/ smooth)
set ct = ct + step
call BJDebugMsg("CTMinus! " + R2S(ct))
call SetUnitVertexColorBJ(wUnit,r,g,b,-ct)
endloop
endif
endfunction
//HERO GLOW REQUIRES PASSIVE SPELL THAT USES HEROGLOW MODEL. 'Ax0J' is the rawcode
function AddHeroGlow takes unit U returns nothing
call UnitAddAbilityBJ('A000',U)
call SetUnitColor(U,GetPlayerColor(GetOwningPlayer(U)))
endfunction
function RemoveHeroGlow takes unit U returns nothing
call UnitRemoveAbilityBJ('A000',U)
endfunction
function CreateTempFloatTextAtUnit takes string msg, unit target, real offset, real velocity, real degree, real size, real red, real blue, real green, real trans, real timedead returns nothing
local texttag t
call CreateTextTagUnitBJ(msg,target,offset,size,red,green,blue,trans)
set t = GetLastCreatedTextTag()
call SetTextTagVelocityBJ(t,velocity,degree)
call SetTextTagPermanentBJ(t,false)
call SetTextTagAge(t,timedead)
call SetTextTagLifespan(t,timedead)
call SetTextTagFadepoint(t,timedead - 1)
call TriggerSleepAction(timedead + (timedead / 10))
call DestroyTextTag(t)
//remove mem leaks
set t = null
endfunction
function TargetHeal takes unit whichUnit, real healAmount returns nothing
call SetUnitLifeBJ(whichUnit,(GetUnitStateSwap(UNIT_STATE_LIFE,whichUnit) + healAmount))
endfunction
function AddFXLoc_Child takes nothing returns nothing
local effect tempeffect = bj_lastCreatedEffect
local real duration = bj_enumDestructableRadius
call PolledWait(duration)
call DestroyEffect(tempeffect)
set tempeffect = null
endfunction
function AddFXLoc takes string whichEffect, location where, real duration returns nothing
local trigger dispatcher = CreateTrigger()
set bj_enumDestructableRadius = duration
set bj_lastCreatedEffect = AddSpecialEffectLoc(whichEffect,where)
call TriggerAddAction(dispatcher,function AddFXLoc_Child)
call TriggerExecute(dispatcher)
call DestroyTrigger(dispatcher)
set dispatcher = null
endfunction
Please pay attention at the bolded function. You are able to clean the BJDebugMessage. It was just a debugger.
Share This Thread