Name | Type | is_array | initial_value |
beta_point | location | Yes | |
beta_unit | unit | Yes | |
GCLL_Alpha | real | Yes | 0.00 |
GCLL_Blue | real | Yes | 0.00 |
GCLL_BlueChangeRate | real | Yes | |
GCLL_Counter | integer | No | |
GCLL_CurrentX1 | real | Yes | |
GCLL_CurrentX2 | real | Yes | |
GCLL_CurrentY1 | real | Yes | |
GCLL_CurrentY2 | real | Yes | |
GCLL_Destroy | boolean | Yes | |
GCLL_Event | real | No | |
GCLL_EventIndex | integer | No | |
GCLL_FadeRate | real | Yes | |
GCLL_Green | real | Yes | 1.00 |
GCLL_GreenChangeRate | real | Yes | |
GCLL_InitialZ1 | real | Yes | |
GCLL_InitialZ2 | real | Yes | |
GCLL_IsActive | boolean | Yes | |
GCLL_IsReversed | boolean | Yes | |
GCLL_IsSourceStatic | boolean | Yes | |
GCLL_IsTargetStatic | boolean | Yes | |
GCLL_IsTimed | boolean | Yes | |
GCLL_Iterator | timer | No | |
GCLL_LastCreatedCLL | integer | No | |
GCLL_Lightning | lightning | Yes | |
GCLL_Location | location | No | |
GCLL_MaxIndex | integer | No | |
GCLL_Recycle | integer | Yes | |
GCLL_Red | real | Yes | 0.00 |
GCLL_RedChangeRate | real | Yes | |
GCLL_Register_Alpha | real | No | |
GCLL_Register_DestroyOn0Alpha | boolean | No | |
GCLL_Register_Duration | real | No | |
GCLL_Register_EndValue | real | No | |
GCLL_Register_FadeDuration | real | No | |
GCLL_Register_InitialSourceZ | real | No | |
GCLL_Register_InitialTargetZ | real | No | |
GCLL_Register_IsReversed | boolean | No | |
GCLL_Register_IsSourceStatic | boolean | No | |
GCLL_Register_IsTargetStatic | boolean | No | |
GCLL_Register_Lightning | lightning | No | |
GCLL_Register_SourcePoint | location | No | |
GCLL_Register_SourceUnit | unit | No | |
GCLL_Register_SourceX | real | No | |
GCLL_Register_SourceY | real | No | |
GCLL_Register_StartValue | real | No | |
GCLL_Register_TargetPoint | location | No | |
GCLL_Register_TargetUnit | unit | No | |
GCLL_Register_TargetX | real | No | |
GCLL_Register_TargetY | real | No | |
GCLL_Register_Type | integer | No | |
GCLL_Register_WhichCLL | integer | No | |
GCLL_SourcePoint | location | Yes | |
GCLL_SourceUnit | unit | Yes | |
GCLL_SourceX | real | Yes | |
GCLL_SourceY | real | Yes | |
GCLL_StaticSourcePoint | location | Yes | |
GCLL_StaticSourceX | real | Yes | |
GCLL_StaticSourceY | real | Yes | |
GCLL_StaticTargetPoint | location | Yes | |
GCLL_StaticTargetX | real | Yes | |
GCLL_StaticTargetY | real | Yes | |
GCLL_TargetPoint | location | Yes | |
GCLL_TargetUnit | unit | Yes | |
GCLL_TargetX | real | Yes | |
GCLL_TargetY | real | Yes | |
GCLL_Time | integer | Yes | |
GCLL_Type | integer | Yes | |
GCLL_Type_ApplyTimed | integer | No | 7 |
GCLL_Type_ChangeBlue | integer | No | |
GCLL_Type_ChangeGreen | integer | No | |
GCLL_Type_ChangeRed | integer | No | |
GCLL_Type_Fading | integer | No | 6 |
GCLL_Type_P2P | integer | No | 4 |
GCLL_Type_P2PLoc | integer | No | 5 |
GCLL_Type_P2U | integer | No | 2 |
GCLL_Type_P2ULoc | integer | No | 3 |
GCLL_Type_U2U | integer | No | 1 |
spellH_Acc | real | Yes | |
spellH_Caster | unit | Yes | |
spellH_CCL | integer | Yes | |
spellH_Index | integer | No | |
spellH_LoopIndex | integer | No | |
spellH_Point | location | Yes | |
spellH_Speed | real | Yes | |
spellP_Acc | real | Yes | |
spellP_Caster | unit | Yes | |
spellP_CLL | integer | Yes | |
spellP_Index | integer | No | |
spellP_LoopIndex | integer | No | |
spellP_Speed | real | Yes | |
spellP_Target | unit | Yes |
//TESH.scrollpos=249
//TESH.alwaysfold=0
// =========================================================================================
// [GUI] Custom Lightning Locker v1.1
// by Reventhous
// =========================================================================================
// -----------------------------------------------------------------------------------------
//
// ~HOW TO IMPORT
// 1. Go to File [tab] > Preferences. Make sure "Automatically create unknwon variables...
// is ticked.
// 2. Copy this "GUI Custom Lightning Locker" category with "gCLL" and "gCLL VariablesGen" triggers in it.
// 3. Paste it to your map
// 4. Finish!
//
// -----------------------------------------------------------------------------------------
// ~METHODS
// This system has 10 methods
// mehodName (methodId)
//
// 1. U2U (gCLLType_U2U)
// ~Attach/lock selected lightning between units
//
// 2. P2U (gCLLType_P2U)
// ~Attach/lock selected lightning between x,y and unit
//
// 3. P2ULoc (gCLLType_P2ULoc)
// ~Similiar with P2U, but uses point/location
//
// 4. P2P (gCLLType_P2P)
// ~Attach/lock selected lightning between x1,y1 and x2,y2
//
// 5. P2PLoc (gCLLType_P2PLoc)
// ~Similiar with P2P, but uses points/locations
//
// 6. ApplyTimed (gCLLType_ApplyTimed)
// ~Apply timed life to selected lightning. Automatically remove the lightning with its CLL
// when the countdown ends.
//
// 7. Fading (gCLLType_Fading)
// ~Make the lightning fade with preferable duration.
//
// 8. ChangeRed (gCLLType_ChangeRed)
// ~Change the lightning (R,g,b) with preferable duration. Works like fading.
//
// 9. ChangeGreen (gCLLType_ChangeGreen)
// ~Change the lightning (r,G,b) with preferable duration. Works like fading.
//
// 10. ChangeBlue (gCLLType_ChangeBlue)
// ~Change the lightning (r,g,B) with preferable duration. Works like fading.
//
// -----------------------------------------------------------------------------------------
// ~HOW TO USE
// I'll show the form of variables to perform those methods
// Note: Don't use carelessly!
//
// 1. U2U
//
// -gCLLRegister_Lightning --> Set this to your lightning
// -gCLLRegister_SourceUnit --> Set this to the source (unit)
// -gCLLRegister_TargetUnit --> Set this to the target (unit)
// -gCLLRegister_InitialSourceZ --> Additional height. For example, 80. will make
// the lightning looks like locked to source head
// -gCLLRegister_InitialTargetZ --> Additional height
// -gCLLRegister_IsSourceStatic --> Decide
// -gCLLRegister_IsTargetStatic --> Decide
// -gCLLRegister_IsReversed --> Reverse mode (boolean)
// -gCLLRegister_Alpha --> The lightning tranparency
// -gCLLRegister_Type --> Set this to U2U method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 2. P2U
//
// -gCLLRegister_Lightning --> Set this to your lightning
// -gCLLRegister_SourceX --> Set this to the source, x- axis
// -gCLLRegister_SourceY --> Set this to the source, Y- axis
// -gCLLRegister_TargetUnit --> Set this to the target (unit)
// -gCLLRegister_InitialSourceZ --> Additional height. For example, 80. will make
// the lightning looks like locked to source head
// -gCLLRegister_InitialTargetZ --> Additional height
// -gCLLRegister_IsSourceStatic --> Decide
// -gCLLRegister_IsTargetStatic --> Decide
// -gCLLRegister_IsReversed --> Reverse mode (boolean)
// -gCLLRegister_Alpha --> The lightning tranparency
// -gCLLRegister_Type --> Set this to P2U method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
//
// 3. P2ULoc
//
// -gCLLRegister_Lightning --> Set this to your lightning
// -gCLLRegister_SourcePoint --> Set this to the source (point/location)
// -gCLLRegister_TargetUnit --> Set this to the target (unit)
// -gCLLRegister_InitialSourceZ --> Additional height. For example, 80. will make
// the lightning looks like locked to source head
// -gCLLRegister_InitialTargetZ --> Additional height
// -gCLLRegister_IsSourceStatic --> Decide
// -gCLLRegister_IsTargetStatic --> Decide
// -gCLLRegister_IsReversed --> Reverse mode (boolean)
// -gCLLRegister_Alpha --> The lightning tranparency
// -gCLLRegister_Type --> Set this to P2ULoc method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 4. P2P
//
// -gCLLRegister_Lightning --> Set this to your lightning
// -gCLLRegister_SourceX --> Set this to the source, x- axis
// -gCLLRegister_SourceY --> Set this to the source, y- axis
// -gCLLRegister_TargetX --> Set this to the target, x- axis
// -gCLLRegister_TargetY --> Set this to the target, y- axis
// -gCLLRegister_InitialSourceZ --> Additional height. For example, 80. will make
// the lightning looks like locked to source head
// -gCLLRegister_InitialTargetZ --> Additional height
// -gCLLRegister_IsSourceStatic --> Decide
// -gCLLRegister_IsTargetStatic --> Decide
// -gCLLRegister_IsReversed --> Reverse mode (boolean)
// -gCLLRegister_Alpha --> The lightning tranparency
// -gCLLRegister_Type --> Set this to P2P method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 5. P2PLoc
//
// -gCLLRegister_Lightning --> Set this to your lightning
// -gCLLRegister_SourcePoint --> Set this to the source (point/location)
// -gCLLRegister_TargetPoint --> Set this to the source (point/location)
// -gCLLRegister_InitialSourceZ --> Additional height. For example, 80. will make
// the lightning looks like locked to source head
// -gCLLRegister_InitialTargetZ --> Additional height
// -gCLLRegister_IsSourceStatic --> Decide
// -gCLLRegister_IsTargetStatic --> Decide
// -gCLLRegister_IsReversed --> Reverse mode (boolean)
// -gCLLRegister_Alpha --> The lightning tranparency
// -gCLLRegister_Type --> Set this to P2P method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 6. ApplyTimed
//
// -gCLLRegister_Duration --> Duration before remove
// -gCLLRegister_WhichCLL --> Set this the seleced CLL
// -gCLLRegister_Type --> Set this to ApplyTimed method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 7. Fading
//
// -gCLLRegister_StartValue --> Starting alpha of the lightning
// -gCLLRegister_EndValue --> Alpha of the lightning at the end of the fading.
// -gCLLRegister_Duration --> Fading duration
// -gCLLRegister_WhichCLL --> Set this the seleced CLL
// -gCLLRegister_Type --> Set this to Fading method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 8. ChangeRed
//
// -gCLLRegister_StartValue --> Starting (R,g,b) of the lightning
// -gCLLRegister_EndValue --> (R,g,b) of the lightning at the end of the changes.
// -gCLLRegister_Duration --> Change duration
// -gCLLRegister_WhichCLL --> Set this the seleced CLL
// -gCLLRegister_Type --> Set this to ChangeRed method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 9. ChangeGreen
//
// -gCLLRegister_StartValue --> Starting (r,G,b) of the lightning
// -gCLLRegister_EndValue --> (r,G,b) of the lightning at the end of the changes.
// -gCLLRegister_Duration --> Change duration
// -gCLLRegister_WhichCLL --> Set this the seleced CLL
// -gCLLRegister_Type --> Set this to ChangeGreen method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// 10. ChangeBlue
//
// -gCLLRegister_StartValue --> Starting (r,g,B) of the lightning
// -gCLLRegister_EndValue --> (r,g,B) of the lightning at the end of the changes.
// -gCLLRegister_Duration --> Change duration
// -gCLLRegister_WhichCLL --> Set this the seleced CLL
// -gCLLRegister_Type --> Set this to ChangeBlue method id
// Trigger - Run gCLL <gen> (ignoring conditions)
//
// -----------------------------------------------------------------------------------------
// ~HOW TO MANUALLY REMOVE THE CLL
// -Use gCLL_Destroy[index] = true, and the system will destroy it.
// -----------------------------------------------------------------------------------------
//
// ~EVENTS
// This system have 6 events
// 1. gCLL_Event == 1.00
// -When the lightning makes [x,y] move (I won't recommend you to use this, YET)
//
// 2. gCLL_Event == 2.00
// -When the fading ends
//
// 3. gCLL_Event == 3.00
// -When ChangeRed ends
//
// 4. gCLL_Event == 4.00
// -When ChangeGreen ends
//
// 5. gCLL_Event == 5.00
// -When ChangeBlue ends
//
// 6. gCLL_Event == 6.00
// -When CLL met the end
//
// -----------------------------------------------------------------------------------------
// Those event will give gCLL_EventIndex (the current CLL) and that's mean
// you will gain the control over the current CLL.
// -----------------------------------------------------------------------------------------
//
// ~CREDITS: Reventhous @HiveWorkshop.com
// -----------------------------------------------------------------------------------------
//
// Important! Using ApplyTimed method is the safest way to use this system.
// =========================================================================================
// -----------------------------------------------------------------------------------------
// The interval
// -----------------------------------------------------------------------------------------
constant function GCLL_Interval takes nothing returns real
return 0.03125
endfunction
// -----------------------------------------------------------------------------------------
// The max life time for CLL. Automatically destroy created CLL after 2 hours
// -----------------------------------------------------------------------------------------
constant function GCLL_MaxLifeTime takes nothing returns integer
return 230400 //equal to 2 hours (2x60x60x32)
endfunction
// -----------------------------------------------------------------------------------------
// Debug mode toggle
// -----------------------------------------------------------------------------------------
constant function GCLL_DebugMode takes nothing returns boolean
return false
endfunction
// -----------------------------------------------------------------------------------------
// What ever you do below this line is at your own risk
// -----------------------------------------------------------------------------------------
// Deallocate
function GCLL_Deallocate takes integer current returns nothing
if udg_GCLL_Counter > 0 then
set udg_GCLL_Counter = udg_GCLL_Counter - 1
else
call PauseTimer(udg_GCLL_Iterator)
endif
if current == udg_GCLL_MaxIndex then
set udg_GCLL_MaxIndex = udg_GCLL_MaxIndex - 1
else
set udg_GCLL_Recycle[current] = udg_GCLL_Recycle[0]
set udg_GCLL_Recycle[0] = current
endif
set udg_GCLL_IsActive[current] = false
endfunction
// Data reset
function GCLL_Reset takes integer i returns nothing
set udg_GCLL_Lightning[i] = null
set udg_GCLL_SourceUnit[i] = null
set udg_GCLL_StaticSourcePoint[i] = null
set udg_GCLL_SourcePoint[i] = null
set udg_GCLL_TargetUnit[i] = null
set udg_GCLL_StaticTargetPoint[i] = null
set udg_GCLL_TargetPoint[i] = null
set udg_GCLL_CurrentX1[i] = 0.00
set udg_GCLL_CurrentY1[i] = 0.00
set udg_GCLL_CurrentX2[i] = 0.00
set udg_GCLL_CurrentY2[i] = 0.00
set udg_GCLL_SourceX[i] = 0.00
set udg_GCLL_SourceY[i] = 0.00
set udg_GCLL_StaticSourceX[i] = 0.00
set udg_GCLL_StaticSourceY[i] = 0.00
set udg_GCLL_TargetX[i] = 0.00
set udg_GCLL_TargetY[i] = 0.00
set udg_GCLL_StaticTargetX[i] = 0.00
set udg_GCLL_StaticTargetY[i] = 0.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_FadeRate[i] = 0.00
set udg_GCLL_RedChangeRate[i] = 0.00
set udg_GCLL_GreenChangeRate[i] = 0.00
set udg_GCLL_BlueChangeRate[i] = 0.00
set udg_GCLL_InitialZ1[i] = 0.00
set udg_GCLL_InitialZ2[i] = 0.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_IsTimed[i] = false
set udg_GCLL_IsSourceStatic[i] = false
set udg_GCLL_IsTargetStatic[i] = false
set udg_GCLL_Destroy[i] = false
endfunction
// For CLL destroy
function GCLL_Destroy takes integer current returns nothing
if udg_GCLL_Lightning[current] != null then
call DestroyLightning(udg_GCLL_Lightning[current])
endif
if udg_GCLL_SourcePoint[current] != null then
call RemoveLocation(udg_GCLL_SourcePoint[current])
endif
if udg_GCLL_StaticSourcePoint[current] != null then
call RemoveLocation(udg_GCLL_SourcePoint[current])
endif
if udg_GCLL_TargetPoint[current] != null then
call RemoveLocation(udg_GCLL_SourcePoint[current])
endif
if udg_GCLL_StaticTargetPoint[current] != null then
call RemoveLocation(udg_GCLL_SourcePoint[current])
endif
call GCLL_Deallocate(current)
call GCLL_Reset(current)
endfunction
// Will returns the current ground z- axis
function GCLL_GetZ takes real x, real y returns real
//automatically create a new location
if udg_GCLL_Location == null then
set udg_GCLL_Location = Location(0.00, 0.00)
endif
call MoveLocation(udg_GCLL_Location, x, y)
return GetLocationZ(udg_GCLL_Location)
endfunction
// The iterating function
function GCLL_OnIterate takes nothing returns nothing
local integer current = udg_GCLL_MaxIndex
local real x1
local real y1
local real x2
local real y2
local real z1
local real z2
loop
exitwhen current == 0
if udg_GCLL_IsActive[current] then
// For U2U method
if udg_GCLL_Type[current] == udg_GCLL_Type_U2U then
if not udg_GCLL_IsSourceStatic[current] then
set x1 = GetUnitX(udg_GCLL_SourceUnit[current])
set y1 = GetUnitY(udg_GCLL_SourceUnit[current])
else
set x1 = udg_GCLL_StaticSourceX[current]
set y1 = udg_GCLL_StaticSourceY[current]
endif
set z1 = GCLL_GetZ(x1, y1) + GetUnitFlyHeight(udg_GCLL_SourceUnit[current]) + udg_GCLL_InitialZ1[current]
if not udg_GCLL_IsTargetStatic[current] then
set x2 = GetUnitX(udg_GCLL_TargetUnit[current])
set y2 = GetUnitY(udg_GCLL_TargetUnit[current])
else
set x2 = udg_GCLL_StaticTargetX[current]
set y2 = udg_GCLL_StaticTargetY[current]
endif
set z2 = GCLL_GetZ(x2, y2) + GetUnitFlyHeight(udg_GCLL_TargetUnit[current]) + udg_GCLL_InitialZ2[current]
endif
// For P2U method
if udg_GCLL_Type[current] == udg_GCLL_Type_P2U then
if not udg_GCLL_IsSourceStatic[current] then
set x1 = udg_GCLL_SourceX[current]
set y1 = udg_GCLL_SourceY[current]
else
set x1 = udg_GCLL_StaticSourceX[current]
set y1 = udg_GCLL_StaticSourceY[current]
endif
set z1 = GCLL_GetZ(x1, y1) + udg_GCLL_InitialZ1[current]
if not udg_GCLL_IsTargetStatic[current] then
set x2 = GetUnitX(udg_GCLL_TargetUnit[current])
set y2 = GetUnitY(udg_GCLL_TargetUnit[current])
else
set x2 = udg_GCLL_StaticTargetX[current]
set y2 = udg_GCLL_StaticTargetY[current]
endif
set z2 = GCLL_GetZ(x2, y2) + GetUnitFlyHeight(udg_GCLL_TargetUnit[current]) + udg_GCLL_InitialZ2[current]
endif
// For P2ULoc method
if udg_GCLL_Type[current] == udg_GCLL_Type_P2ULoc then
if not udg_GCLL_IsSourceStatic[current] then
set x1 = GetLocationX(udg_GCLL_SourcePoint[current])
set y1 = GetLocationY(udg_GCLL_SourcePoint[current])
set z1 = GetLocationZ(udg_GCLL_SourcePoint[current]) + udg_GCLL_InitialZ1[current]
else
set x1 = GetLocationX(udg_GCLL_StaticSourcePoint[current])
set y1 = GetLocationY(udg_GCLL_StaticSourcePoint[current])
set z1 = GetLocationZ(udg_GCLL_StaticSourcePoint[current]) + udg_GCLL_InitialZ1[current]
endif
if not udg_GCLL_IsTargetStatic[current] then
set x2 = GetUnitX(udg_GCLL_TargetUnit[current])
set y2 = GetUnitY(udg_GCLL_TargetUnit[current])
else
set x2 = udg_GCLL_StaticTargetX[current]
set y2 = udg_GCLL_StaticTargetY[current]
endif
set z2 = GCLL_GetZ(x2, y2) + GetUnitFlyHeight(udg_GCLL_TargetUnit[current]) + udg_GCLL_InitialZ2[current]
endif
// For P2P method
if udg_GCLL_Type[current] == udg_GCLL_Type_P2P then
if not udg_GCLL_IsSourceStatic[current] then
set x1 = udg_GCLL_SourceX[current]
set y1 = udg_GCLL_SourceY[current]
else
set x1 = udg_GCLL_StaticSourceX[current]
set y1 = udg_GCLL_StaticSourceY[current]
endif
set z1 = GCLL_GetZ(x1, y1) + udg_GCLL_InitialZ1[current]
if not udg_GCLL_IsTargetStatic[current] then
set x2 = udg_GCLL_TargetX[current]
set y2 = udg_GCLL_TargetY[current]
else
set x2 = udg_GCLL_StaticTargetX[current]
set y2 = udg_GCLL_StaticTargetY[current]
endif
set z2 = GCLL_GetZ(x2, y2) + udg_GCLL_InitialZ2[current]
endif
// For P2PLoc method
if udg_GCLL_Type[current] == udg_GCLL_Type_P2PLoc then
if not udg_GCLL_IsSourceStatic[current] then
set x1 = GetLocationX(udg_GCLL_SourcePoint[current])
set y1 = GetLocationY(udg_GCLL_SourcePoint[current])
set z1 = GetLocationZ(udg_GCLL_SourcePoint[current]) + udg_GCLL_InitialZ1[current]
else
set x1 = GetLocationX(udg_GCLL_StaticSourcePoint[current])
set y1 = GetLocationY(udg_GCLL_StaticSourcePoint[current])
set z1 = GetLocationY(udg_GCLL_StaticSourcePoint[current]) + udg_GCLL_InitialZ1[current]
endif
if not udg_GCLL_IsTargetStatic[current] then
set x2 = GetLocationX(udg_GCLL_TargetPoint[current])
set y2 = GetLocationY(udg_GCLL_TargetPoint[current])
set z1 = GetLocationZ(udg_GCLL_TargetPoint[current]) + udg_GCLL_InitialZ1[current]
else
set x2 = GetLocationX(udg_GCLL_StaticTargetPoint[current])
set y2 = GetLocationY(udg_GCLL_StaticTargetPoint[current])
set z1 = GetLocationZ(udg_GCLL_StaticTargetPoint[current]) + udg_GCLL_InitialZ1[current]
endif
endif
// Will automatically destroy when the system can't find the lightning
if udg_GCLL_Lightning[current] != null then
// When both source and target are static, the system won't call MoveLightningEx
if not udg_GCLL_IsSourceStatic[current] and not udg_GCLL_IsTargetStatic[current] then
// Check the reverse mode
if not udg_GCLL_IsReversed[current] then
call MoveLightningEx(udg_GCLL_Lightning[current], true, x1, y1, z1, x2, y2, z2)
else
call MoveLightningEx(udg_GCLL_Lightning[current], true, x2, y2, z2, x1, y1, z1)
endif
if udg_GCLL_CurrentX1[current] != x1 or udg_GCLL_CurrentY1[current] != y1 or udg_GCLL_CurrentX2[current] != x2 or udg_GCLL_CurrentY2[current] != y2 then
set udg_GCLL_Event = 1.00
set udg_GCLL_EventIndex = current
set udg_GCLL_CurrentX1[current] = x1
set udg_GCLL_CurrentY1[current] = y1
set udg_GCLL_CurrentX2[current] = x2
set udg_GCLL_CurrentY2[current] = y2
set udg_GCLL_Event = 0.00
endif
endif
// Will update the lightning alpha when fade rate has value
if udg_GCLL_FadeRate[current] != 0.00 then
if udg_GCLL_Alpha[current] > 0.00 and udg_GCLL_Alpha[current] < 1.00 then
set udg_GCLL_Alpha[current] = udg_GCLL_Alpha[current] + udg_GCLL_FadeRate[current]
else
set udg_GCLL_FadeRate[current] = 0.00
set udg_GCLL_Event = 2.00
set udg_GCLL_EventIndex = current
set udg_GCLL_Event = 0.00
endif
endif
// Will update the lightning R when change rate has value
if udg_GCLL_RedChangeRate[current] != 0.00 then
if udg_GCLL_Red[current] > 0.00 and udg_GCLL_Red[current] < 1.00 then
set udg_GCLL_Red[current] = udg_GCLL_Red[current] + udg_GCLL_RedChangeRate[current]
else
set udg_GCLL_RedChangeRate[current] = 0.00
set udg_GCLL_Event = 3.00
set udg_GCLL_EventIndex = current
set udg_GCLL_Event = 0.00
endif
endif
// Will update the lightning G when change rate has value
if udg_GCLL_GreenChangeRate[current] != 0.00 then
if udg_GCLL_Green[current] > 0.00 and udg_GCLL_Green[current] < 1.00 then
set udg_GCLL_Green[current] = udg_GCLL_Green[current] + udg_GCLL_GreenChangeRate[current]
else
set udg_GCLL_GreenChangeRate[current] = 0.00
set udg_GCLL_Event = 4.00
set udg_GCLL_EventIndex = current
set udg_GCLL_Event = 0.00
endif
endif
// Will update the lightning B when change rate has value
if udg_GCLL_BlueChangeRate[current] != 0.00 then
if udg_GCLL_Blue[current] > 0.00 and udg_GCLL_Blue[current] < 1.00 then
set udg_GCLL_Blue[current] = udg_GCLL_Blue[current] + udg_GCLL_BlueChangeRate[current]
else
set udg_GCLL_BlueChangeRate[current] = 0.00
set udg_GCLL_Event = 5.00
set udg_GCLL_EventIndex = current
set udg_GCLL_Event = 0.00
endif
endif
//We don't want negative value
if udg_GCLL_Alpha[current] < 0.00 then
set udg_GCLL_Alpha[current] = 0.00
endif
if udg_GCLL_Red[current] < 0.00 then
set udg_GCLL_Red[current] = 0.00
endif
if udg_GCLL_Green[current] < 0.00 then
set udg_GCLL_Green[current] = 0.00
endif
if udg_GCLL_Blue[current] < 0.00 then
set udg_GCLL_Blue[current] = 0.00
endif
//Greater than 1.00 doesn't mean anything. It slows down the fading process
if udg_GCLL_Alpha[current] > 1.00 then
set udg_GCLL_Alpha[current] = 1.00
endif
if udg_GCLL_Red[current] > 1.00 then
set udg_GCLL_Red[current] = 1.00
endif
if udg_GCLL_Green[current] > 1.00 then
set udg_GCLL_Green[current] = 1.00
endif
if udg_GCLL_Blue[current] > 1.00 then
set udg_GCLL_Blue[current] = 1.00
endif
// Update the lightning color
call SetLightningColor(udg_GCLL_Lightning[current], udg_GCLL_Red[current], udg_GCLL_Green[current], udg_GCLL_Blue[current], udg_GCLL_Alpha[current])
// The countdown for the lightning
if udg_GCLL_Time[current] > 0 then
set udg_GCLL_Time[current] = udg_GCLL_Time[current] - 1
else
call GCLL_Destroy(current)
set udg_GCLL_Event = 6.00
set udg_GCLL_EventIndex = current
set udg_GCLL_Event = 0.00
endif
else
call GCLL_Destroy(current)
endif
// For manual destroy method
if udg_GCLL_Destroy[current] then
call GCLL_Destroy(current)
endif
endif
// Get the previous index on the list
set current = current - 1
endloop
endfunction
// allocate
function GCLL_Allocate takes nothing returns integer
local integer this
set udg_GCLL_Counter = udg_GCLL_Counter + 1
if udg_GCLL_Counter == 1 then
call TimerStart(udg_GCLL_Iterator, GCLL_Interval(), true, function GCLL_OnIterate)
endif
if (udg_GCLL_Recycle[0] == 0) then
set udg_GCLL_MaxIndex = udg_GCLL_MaxIndex + 1
set udg_GCLL_IsActive[udg_GCLL_MaxIndex] = true
return udg_GCLL_MaxIndex
endif
set this = udg_GCLL_Recycle[0]
set udg_GCLL_Recycle[0] = udg_GCLL_Recycle[this]
set udg_GCLL_IsActive[this] = true
return this
endfunction
// -----------------------------------------------------------------------------------------
// Everything below this line is the "create" method for this system
// -----------------------------------------------------------------------------------------
function GCLL_U2U takes lightning lt, unit source, unit target, real initialZ1, real initialZ2, boolean isSourceStatic, boolean isTargetStatic, boolean isReversed, real alpha returns integer
local integer i
if lt != null and source != null and target != null then
set i = GCLL_Allocate()
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_Lightning[i] = lt
set udg_GCLL_SourceUnit[i] = source
set udg_GCLL_TargetUnit[i] = target
set udg_GCLL_InitialZ1[i] = initialZ1
set udg_GCLL_InitialZ2[i] = initialZ2
set udg_GCLL_IsSourceStatic[i] = isSourceStatic
set udg_GCLL_StaticSourceX[i] = GetUnitX(source)
set udg_GCLL_StaticSourceY[i] = GetUnitY(source)
set udg_GCLL_IsTargetStatic[i] = isTargetStatic
set udg_GCLL_StaticTargetX[i] = GetUnitX(target)
set udg_GCLL_StaticTargetY[i] = GetUnitY(target)
set udg_GCLL_IsReversed[i] = isReversed
set udg_GCLL_Alpha[i] = alpha
set udg_GCLL_Type[i] = udg_GCLL_Type_U2U
set udg_GCLL_CurrentX1[i] = GetUnitX(source)
set udg_GCLL_CurrentY1[i] = GetUnitY(source)
set udg_GCLL_CurrentX2[i] = GetUnitX(target)
set udg_GCLL_CurrentY2[i] = GetUnitY(target)
return i
endif
return 0
endfunction
function GCLL_P2U takes lightning lt, real x1, real y1, unit target, real initialZ1, real initialZ2, boolean isSourceStatic, boolean isTargetStatic, boolean isReversed, real alpha returns integer
local integer i
if lt != null and target != null then
set i = GCLL_Allocate()
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_Lightning[i] = lt
set udg_GCLL_SourceX[i] = x1
set udg_GCLL_SourceY[i] = y1
set udg_GCLL_TargetUnit[i] = target
set udg_GCLL_InitialZ1[i] = initialZ1
set udg_GCLL_InitialZ2[i] = initialZ2
set udg_GCLL_IsSourceStatic[i] = isSourceStatic
set udg_GCLL_StaticSourceX[i] = udg_GCLL_SourceX[i]
set udg_GCLL_StaticSourceY[i] = udg_GCLL_SourceY[i]
set udg_GCLL_IsTargetStatic[i] = isTargetStatic
set udg_GCLL_StaticTargetX[i] = GetUnitX(target)
set udg_GCLL_StaticTargetY[i] = GetUnitY(target)
set udg_GCLL_IsReversed[i] = isReversed
set udg_GCLL_Alpha[i] = alpha
set udg_GCLL_Type[i] = udg_GCLL_Type_P2U
set udg_GCLL_CurrentX1[i] = x1
set udg_GCLL_CurrentY1[i] = y1
set udg_GCLL_CurrentX2[i] = GetUnitX(target)
set udg_GCLL_CurrentY2[i] = GetUnitY(target)
return i
endif
return 0
endfunction
function GCLL_P2ULoc takes lightning lt, location source, unit target, real initialZ1, real initialZ2, boolean isSourceStatic, boolean isTargetStatic, boolean isReversed, real alpha returns integer
local integer i
if lt != null and source != null and target != null then
set i = GCLL_Allocate()
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_Lightning[i] = lt
set udg_GCLL_SourcePoint[i] = source
set udg_GCLL_TargetUnit[i] = target
set udg_GCLL_InitialZ1[i] = initialZ1
set udg_GCLL_InitialZ2[i] = initialZ2
set udg_GCLL_IsSourceStatic[i] = isSourceStatic
set udg_GCLL_StaticSourcePoint[i] = source
set udg_GCLL_IsTargetStatic[i] = isTargetStatic
set udg_GCLL_StaticTargetX[i] = GetUnitX(target)
set udg_GCLL_StaticTargetY[i] = GetUnitY(target)
set udg_GCLL_IsReversed[i] = isReversed
set udg_GCLL_Alpha[i] = alpha
set udg_GCLL_Type[i] = udg_GCLL_Type_P2ULoc
set udg_GCLL_CurrentX1[i] = GetLocationX(source)
set udg_GCLL_CurrentY1[i] = GetLocationY(source)
set udg_GCLL_CurrentX2[i] = GetUnitX(target)
set udg_GCLL_CurrentY2[i] = GetUnitY(target)
return i
endif
return 0
endfunction
function GCLL_P2P takes lightning lt, real x1, real y1, real x2, real y2, real initialZ1, real initialZ2, boolean isSourceStatic, boolean isTargetStatic, boolean isReversed, real alpha returns integer
local integer i
if lt != null then
set i = GCLL_Allocate()
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_Lightning[i] = lt
set udg_GCLL_SourceX[i] = x1
set udg_GCLL_SourceY[i] = y1
set udg_GCLL_InitialZ1[i] = initialZ1
set udg_GCLL_InitialZ2[i] = initialZ2
set udg_GCLL_IsSourceStatic[i] = isSourceStatic
set udg_GCLL_StaticSourceX[i] = x1
set udg_GCLL_StaticSourceY[i] = y1
set udg_GCLL_IsTargetStatic[i] = isTargetStatic
set udg_GCLL_StaticTargetX[i] = x2
set udg_GCLL_StaticTargetY[i] = y2
set udg_GCLL_IsReversed[i] = isReversed
set udg_GCLL_Alpha[i] = alpha
set udg_GCLL_Type[i] = udg_GCLL_Type_P2P
set udg_GCLL_CurrentX1[i] = x1
set udg_GCLL_CurrentY1[i] = y1
set udg_GCLL_CurrentX2[i] = x2
set udg_GCLL_CurrentY2[i] = y2
return i
endif
return 0
endfunction
function GCLL_P2PLoc takes lightning lt, location source, location target, real initialZ1, real initialZ2, boolean isSourceStatic, boolean isTargetStatic, boolean isReversed, real alpha returns integer
local integer i
if lt != null and source != null and target != null then
set i = GCLL_Allocate()
set udg_GCLL_Red[i] = 1.00
set udg_GCLL_Green[i] = 1.00
set udg_GCLL_Blue[i] = 1.00
set udg_GCLL_Alpha[i] = 1.00
set udg_GCLL_Time[i] = GCLL_MaxLifeTime()
set udg_GCLL_Lightning[i] = lt
set udg_GCLL_SourcePoint[i] = source
set udg_GCLL_TargetPoint[i] = target
set udg_GCLL_InitialZ1[i] = initialZ1
set udg_GCLL_InitialZ2[i] = initialZ2
set udg_GCLL_IsSourceStatic[i] = isSourceStatic
set udg_GCLL_StaticSourcePoint[i] = source
set udg_GCLL_IsTargetStatic[i] = isTargetStatic
set udg_GCLL_StaticTargetPoint[i] = target
set udg_GCLL_IsReversed[i] = isReversed
set udg_GCLL_Alpha[i] = alpha
set udg_GCLL_Type[i] = udg_GCLL_Type_P2PLoc
set udg_GCLL_CurrentX1[i] = GetLocationX(source)
set udg_GCLL_CurrentY1[i] = GetLocationY(source)
set udg_GCLL_CurrentX2[i] = GetLocationX(target)
set udg_GCLL_CurrentY2[i] = GetLocationY(target)
return i
endif
return 0
endfunction
function GCLL_ApplyTimedLife takes integer cll, real duration returns nothing
if udg_GCLL_Lightning[cll] == null or cll <= 0 then
return
endif
set udg_GCLL_IsTimed[cll] = true
set udg_GCLL_Time[cll] = R2I(duration/GCLL_Interval())
endfunction
function GCLL_SetFadeRate takes real sAlpha, real eAlpha, real duration, integer cll returns nothing
if sAlpha < 0.00 or eAlpha > 1.00 then
return
endif
set udg_GCLL_FadeRate[cll] = (eAlpha - sAlpha)/(duration/GCLL_Interval())
set udg_GCLL_Alpha[cll] = sAlpha + udg_GCLL_FadeRate[cll]
endfunction
function GCLL_SetRedCRate takes real sRed, real eRed, real duration, integer cll returns nothing
if sRed < 0.00 or eRed > 1.00 then
return
endif
set udg_GCLL_RedChangeRate[cll] = (eRed - sRed)/(duration/GCLL_Interval())
set udg_GCLL_Red[cll] = sRed + udg_GCLL_RedChangeRate[cll]
endfunction
function GCLL_SetGreenCRate takes real sGreen, real eGreen, real duration, integer cll returns nothing
if sGreen < 0.00 or eGreen > 1.00 then
return
endif
set udg_GCLL_GreenChangeRate[cll] = (eGreen - sGreen)/(duration/GCLL_Interval())
set udg_GCLL_Green[cll] = sGreen + udg_GCLL_GreenChangeRate[cll]
endfunction
function GCLL_SetBlueCRate takes real sBlue, real eBlue, real duration, integer cll returns nothing
if sBlue < 0.00 or eBlue > 1.00 then
return
endif
set udg_GCLL_BlueChangeRate[cll] = (eBlue - sBlue)/(duration/GCLL_Interval())
set udg_GCLL_Blue[cll] = sBlue + udg_GCLL_BlueChangeRate[cll]
endfunction
function GCLL_Actions takes nothing returns nothing
if udg_GCLL_Register_Type == udg_GCLL_Type_U2U then
set udg_GCLL_LastCreatedCLL = GCLL_U2U(udg_GCLL_Register_Lightning, udg_GCLL_Register_SourceUnit, udg_GCLL_Register_TargetUnit, udg_GCLL_Register_InitialSourceZ, udg_GCLL_Register_InitialTargetZ, udg_GCLL_Register_IsSourceStatic, udg_GCLL_Register_IsTargetStatic, udg_GCLL_Register_IsReversed, udg_GCLL_Register_Alpha)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_P2U then
set udg_GCLL_LastCreatedCLL = GCLL_P2U(udg_GCLL_Register_Lightning, udg_GCLL_Register_SourceX, udg_GCLL_Register_SourceY, udg_GCLL_Register_TargetUnit, udg_GCLL_Register_InitialSourceZ, udg_GCLL_Register_InitialTargetZ, udg_GCLL_Register_IsSourceStatic, udg_GCLL_Register_IsTargetStatic, udg_GCLL_Register_IsReversed, udg_GCLL_Register_Alpha)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_P2ULoc then
set udg_GCLL_LastCreatedCLL = GCLL_P2ULoc(udg_GCLL_Register_Lightning, udg_GCLL_Register_SourcePoint, udg_GCLL_Register_TargetUnit, udg_GCLL_Register_InitialSourceZ, udg_GCLL_Register_InitialTargetZ, udg_GCLL_Register_IsSourceStatic, udg_GCLL_Register_IsTargetStatic, udg_GCLL_Register_IsReversed, udg_GCLL_Register_Alpha)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_P2P then
set udg_GCLL_LastCreatedCLL = GCLL_P2P(udg_GCLL_Register_Lightning, udg_GCLL_Register_SourceX, udg_GCLL_Register_SourceY, udg_GCLL_Register_TargetX, udg_GCLL_Register_TargetY, udg_GCLL_Register_InitialSourceZ, udg_GCLL_Register_InitialTargetZ, udg_GCLL_Register_IsSourceStatic, udg_GCLL_Register_IsTargetStatic, udg_GCLL_Register_IsReversed, udg_GCLL_Register_Alpha)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_P2PLoc then
set udg_GCLL_LastCreatedCLL = GCLL_P2PLoc(udg_GCLL_Register_Lightning, udg_GCLL_Register_SourcePoint, udg_GCLL_Register_TargetPoint, udg_GCLL_Register_InitialSourceZ, udg_GCLL_Register_InitialTargetZ, udg_GCLL_Register_IsSourceStatic, udg_GCLL_Register_IsTargetStatic, udg_GCLL_Register_IsReversed, udg_GCLL_Register_Alpha)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_Fading then
call GCLL_SetFadeRate(udg_GCLL_Register_StartValue, udg_GCLL_Register_EndValue, udg_GCLL_Register_Duration, udg_GCLL_Register_WhichCLL)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_ApplyTimed then
call GCLL_ApplyTimedLife(udg_GCLL_Register_WhichCLL, udg_GCLL_Register_Duration)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_ChangeRed then
call GCLL_SetRedCRate(udg_GCLL_Register_StartValue, udg_GCLL_Register_EndValue, udg_GCLL_Register_Duration, udg_GCLL_Register_WhichCLL)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_ChangeGreen then
call GCLL_SetGreenCRate(udg_GCLL_Register_StartValue, udg_GCLL_Register_EndValue, udg_GCLL_Register_Duration, udg_GCLL_Register_WhichCLL)
elseif udg_GCLL_Register_Type == udg_GCLL_Type_ChangeBlue then
call GCLL_SetBlueCRate(udg_GCLL_Register_StartValue, udg_GCLL_Register_EndValue, udg_GCLL_Register_Duration, udg_GCLL_Register_WhichCLL)
endif
endfunction
function InitTrig_GCLL takes nothing returns nothing
//The methods id
set udg_GCLL_Type_U2U = 1
set udg_GCLL_Type_P2U = 2
set udg_GCLL_Type_P2ULoc = 3
set udg_GCLL_Type_P2P = 4
set udg_GCLL_Type_P2PLoc = 5
set udg_GCLL_Type_Fading = 6
set udg_GCLL_Type_ApplyTimed = 7
set udg_GCLL_Type_ChangeRed = 8
set udg_GCLL_Type_ChangeGreen = 9
set udg_GCLL_Type_ChangeBlue = 10
set gg_trg_GCLL = CreateTrigger()
call TriggerAddAction( gg_trg_GCLL, function GCLL_Actions )
endfunction
// THE END