Triggers
- Init Casting
- Events
- Map initialization
- Conditions
- Actions
- Custom script: local integer i=0
- Hashtable - Create a hashtable
- Set BarHash = (Last created hashtable)
- -------- The number of the llllllllllllllllllllllll on the casting bar. . . --------
- Set NumberofTicks = 30
- -------- Size of the Bar --------
- Set CastingBarSize = 6.00
- -------- The Z offset of the casting bar. --------
- Set BarOffset = 50.00
- -------- Color of the casting bar for each player. . . --------
- Set PlayerColors[1] = |cffff0303
- Set PlayerColors[2] = |cff0042ff
- Set PlayerColors[3] = |cff1ce6b9
- Set PlayerColors[4] = |cff540081
- Set PlayerColors[5] = |cfffffc01
- Set PlayerColors[6] = |cfffe8a0e
- Set PlayerColors[7] = |cff20c000
- Set PlayerColors[8] = |cffe55bb0
- Set PlayerColors[9] = |cff959697
- Set PlayerColors[10] = |cff7ebff1
- Set PlayerColors[11] = |cff106246
- Set PlayerColors[12] = |cff4e2a04
- Set PlayerColors[13] = |c002F2F2F
- Set PlayerColors[14] = |c002F2F2F
- -------- Spell Configuration --------
- -------- This is the ability for the spell you want to set the casting time of --------
- Set TempAbil = Flame Strike
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 1, 3.0)
- -------- ^ --------
- -------- That is the casting Time --------
- Set TempAbil = Banish
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 1, 2.0)
- Set TempAbil = Phoenix
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 1, 5.0)
- Set TempAbil = Siphon Mana
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 1, 1.5)
- -------- ^ --------
- -------- Some Abilities require less/more casting time per level so change this --------
- -------- 1 being the level of the ability --------
- -------- If every level of the spell have the same casting time then only set it once. --------
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 2, 1.0)
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 3, 0.5)
- Set TempAbil = Starfall
- Custom script: call SaveReal(udg_BarHash,udg_TempAbil, 1, 10)
- Custom script: call SaveBoolean(udg_BarHash,udg_TempAbil, udg_TempAbil,true)
- -------- ^ --------
- -------- If that is true, then the ability will be "channeled" and will go full bar to low bar instead of low bar to full bar. --------
- -------- All you have to do is insert this boolean below ur casting times --------
- Custom script: loop
- Custom script: set i=i+1
- Custom script: exitwhen i==udg_NumberofTicks
- Custom script: set udg_LoadingBarText=udg_LoadingBarText+"l"
- Custom script: endloop
- Custom script: set udg_CastingBarSize=udg_CastingBarSize*.0023
- Custom script: call DestroyTrigger(GetTriggeringTrigger())
- BeginCast
- Events
- Unit - A unit Begins channeling an ability
- Conditions
- Actions
- Custom script: local unit u=GetTriggerUnit()
- Custom script: local integer i=GetSpellAbilityId()
- Custom script: local integer c
- Custom script: local string s
- Custom script: local real r=LoadReal(udg_BarHash,i,GetUnitAbilityLevel(u,i))
- Custom script: if r==0 then
- Custom script: set r=LoadReal(udg_BarHash,i,1)
- Custom script: endif
- Custom script: if not IsUnitInGroup(u,udg_CastingGroup) and r>0 then
- Custom script: set c=GetUnitUserData(u)
- Custom script: set udg_BeginCastTime[c]=0
- Custom script: set udg_EndCastTime[c]=r
- Custom script: set udg_Channel[c]=LoadBoolean(udg_BarHash,i,i)
- Custom script: if udg_Channel[c] then
- Custom script: set s="["+udg_PlayerColors[GetPlayerId(GetOwningPlayer(u))+1]+udg_LoadingBarText+"|r]"
- Custom script: else
- Custom script: set s="["+udg_LoadingBarText+"]"
- Custom script: endif
- Custom script: set udg_CastingBar[c]=CreateTextTag()
- Custom script: call SetTextTagVisibility(udg_CastingBar[c], IsUnitVisible(u,GetLocalPlayer()))
- Custom script: call SetTextTagText(udg_CastingBar[c],s,udg_CastingBarSize)
- Custom script: call SetTextTagPos(udg_CastingBar[c],GetUnitX(u),GetUnitY(u),udg_BarOffset)
- Custom script: call GroupAddUnit(udg_CastingGroup,u)
- Trigger - Turn on CastingPeiodic <gen>
- Custom script: endif
- Custom script: set u=null
- EndCast
- Events
- Unit - A unit Stops casting an ability
- Conditions
- Actions
- Custom script: local unit u=GetTriggerUnit()
- Custom script: local integer c
- Custom script: if IsUnitInGroup(u,udg_CastingGroup) then
- Custom script: set c=GetUnitUserData(u)
- Custom script: call GroupRemoveUnit(udg_CastingGroup,u)
- Custom script: call DestroyTextTag(udg_CastingBar[c])
- Custom script: if IsUnitGroupEmptyBJ(udg_CastingGroup) then
- Trigger - Turn off CastingPeiodic <gen>
- Custom script: endif
- Custom script: endif
- Custom script: set u=null
- CastingPeiodic
- Events
- Time - Every 0.10 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in CastingGroup and do (Actions)
- Loop - Actions
- Custom script: local unit u=GetEnumUnit()
- Custom script: local integer c=GetUnitUserData(u)
- Custom script: local real r
- Custom script: if udg_BeginCastTime[c]>=udg_EndCastTime[c] then
- Custom script: call GroupRemoveUnit(udg_CastingGroup,u)
- Custom script: call DestroyTextTag(udg_CastingBar[c])
- Custom script: if IsUnitGroupEmptyBJ(udg_CastingGroup) then
- Trigger - Turn off CastingPeiodic <gen>
- Custom script: endif
- Custom script: else
- Custom script: set udg_BeginCastTime[c]=udg_BeginCastTime[c]+.1
- Custom script: set r=udg_BeginCastTime[c]/udg_EndCastTime[c]
- Custom script: if udg_Channel[c] then
- Custom script: set r=1-r
- Custom script: endif
- Custom script: set r=r*udg_NumberofTicks
- Custom script: if r>=1 then
- Custom script: call SetTextTagText(udg_CastingBar[c],"["+udg_PlayerColors[GetPlayerId(GetOwningPlayer(u))+1]+SubString(udg_LoadingBarText,0,R2I(r))+"|r"+SubString(udg_LoadingBarText,R2I(r)-1,udg_NumberofTicks)+"]",udg_CastingBarSize)
- Custom script: endif
- Custom script: call SetTextTagVisibility(udg_CastingBar[c], IsUnitVisible(u,GetLocalPlayer()))
- Custom script: call SetTextTagPos(udg_CastingBar[c],GetUnitX(u),GetUnitY(u),udg_BarOffset)
- Custom script: endif
- Custom script: set u=null