Roku
New Member
- Reaction score
- 3
Hey, well i have this trigger of mine, which is basically a spell. The problem is i get delays on some of the actions, and this causes my spell to look weird. I read about avoiding BJ's, and i tried avoiding as many as possible. So here is the trigger:
I know its not that advanced and maybe uses too many functions, but i'm happy it works. The thing is, my frostbolt has 2.5 sec cast, and when it finishes casting, i have like a half sec delay before my actual bolt is fired. Same thing goes for when the frostbolt hits, there is also a half sec delay before my buff is applied to the unit that is hit and thus it causes some unit coloring issues. (targets that have frostbolt buff turn blue)
JASS:
scope FB
globals
private unit array u
private integer p
endglobals
private function CA takes nothing returns boolean
return GetSpellAbilityId() == 039;A00B039;
endfunction
private function Buffcond takes nothing returns boolean
return GetUnitTypeId(GetEventDamageSource()) == 039;h001039;
endfunction
private function Act takes nothing returns nothing
local location casterpos
local unit d
set p = GetUnitIndex(GetTriggerUnit())
set u[p] = GetTriggerUnit()
set casterpos = GetUnitLoc(u[p])
call CreateNUnitsAtLoc( 1, 039;h001039;, GetOwningPlayer(u[p]), casterpos, bj_UNIT_FACING )
set d = bj_lastCreatedUnit
call IssueTargetOrder( d, "attack", GetSpellTargetUnit() )
call UnitApplyTimedLife(d, 039;BTLF039;, 2.00)
call RemoveLocation(casterpos)
set d = null
set casterpos = null
endfunction
//---------------------------------------
private function Buffapply takes nothing returns nothing
local unit FBdummy = GetEventDamageSource()
local location FBdummypos = GetUnitLoc(FBdummy)
local unit d
local integer s = GetHeroAgi(u[p],true)
local real cr = I2R(s)
local real r = GetRandomReal(0.95,1.05)
call CreateNUnitsAtLoc( 1, 039;h005039;, GetOwningPlayer(FBdummy), FBdummypos, bj_UNIT_FACING )
set d = bj_lastCreatedUnit
call UnitAddAbility( d,039;A00C039;)
call IssueTargetOrder( d, "slow", GetTriggerUnit() )
call UnitApplyTimedLife(d, 039;BTLF039;, 2.00)
call UnitDamageTarget(u[p], GetTriggerUnit(), (1500 + cr) * r, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL , WEAPON_TYPE_WHOKNOWS)
call RemoveLocation(FBdummypos)
set FBdummy = null
set FBdummypos = null
set d = null
endfunction
private function Add takes unit u returns nothing
local trigger t2 = CreateTrigger()
call TriggerRegisterUnitEvent(t2, u, EVENT_UNIT_DAMAGED)
call TriggerAddCondition (t2, Condition(function Buffcond))
call TriggerAddAction(t2, function Buffapply)
set t2 = null
endfunction
private function calladd takes nothing returns nothing
local unit un = GetTriggerUnit()
call Add(un)
set un = null
endfunction
//===========================================================================
function InitTrig_FB takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t3 = CreateTrigger()
local rect map = GetPlayableMapRect()
call TriggerRegisterEnterRectSimple( t3, map )
call TriggerAddAction (t3, function calladd)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(t, Condition(function CA))
call TriggerAddAction( t, function Act )
set map = null
set t = null
set t3 = null
endfunction
endscope
I know its not that advanced and maybe uses too many functions, but i'm happy it works. The thing is, my frostbolt has 2.5 sec cast, and when it finishes casting, i have like a half sec delay before my actual bolt is fired. Same thing goes for when the frostbolt hits, there is also a half sec delay before my buff is applied to the unit that is hit and thus it causes some unit coloring issues. (targets that have frostbolt buff turn blue)