//==================================================================================//
// //
// Lightning Test by Maker v1.00 //
// //
// Allows the user to see available lightnings and lists their string code //
// Press ESC to toggle lightnings //
// Type -code to set variable called LLL to the entered string //
// For example -mbur //
// Then you can use LLL in your spell and easily change the lightning type //
// between casts. //
//==================================================================================//
library LightningTest initializer Init
globals
private constant real SZ = 0.028 // Floating text size
private constant real OX = 0 // Origin x of upmost lightning
private constant real OY = 0 // Origin y of upmost lightning
private constant real OF = 100 // Space between lightnings
private boolean ESC = true // Begins test when Esc is pressed
// Do not change the ones below
string LLL = "LEAS"
private boolean TOG = true
private string array SA
private lightning array LA
private texttag array TA
endglobals
private function InitStrings takes nothing returns nothing
set SA[0] = "CLPB - Chain Lightning Primary"
set SA[1] = "CLSB - Chain Lightning Secondary"
set SA[2] = "DRAB - Drain"
set SA[3] = "DRAL - Drain Life"
set SA[4] = "DRAM - Drain Mana"
set SA[5] = "AFOD - Finger of Death"
set SA[6] = "FORK - Forked Lightning"
set SA[7] = "HWPB - Healing Wave Primary"
set SA[8] = "HWSB - Healing Wave Secondary"
set SA[9] = "CHIM - Lightning Attack"
set SA[10] = "LEAS - Magic Leash"
set SA[11] = "MBUR - Mana Burn"
set SA[12] = "MFPB - Mana Flare"
set SA[13] = "SPLK - Spirit Link"
endfunction
private function SetStr takes nothing returns nothing
set LLL = SubString(GetEventPlayerChatString(), 1, 5)
endfunction
function LightningTestBegin takes nothing returns nothing
local integer i = 0
local real alpha
if TOG then
call FogEnable(false)
call FogMaskEnable(false)
call SetCameraPosition(OX, OY)
set alpha = 1
else
set alpha = 0
endif
loop
call SetTextTagVisibility(TA[i], TOG)
call SetLightningColor(LA[i], 1, 1, 1, alpha)
set i = i + 1
exitwhen LA[i] == null
endloop
set TOG = not TOG
endfunction
function LightningTestEnd takes nothing returns nothing
set TOG = true
call LightningTestBegin()
endfunction
private function Init takes nothing returns nothing
local trigger t1
local trigger t2 = CreateTrigger()
local real x = OX
local real y = OY
local integer i = 0
if ESC then
set t1 = CreateTrigger()
call TriggerAddAction(t1, function LightningTestBegin)
call TriggerRegisterPlayerEvent(t1, Player(0), EVENT_PLAYER_END_CINEMATIC)
set t1 = null
endif
call InitStrings()
loop
set TA[i] = CreateTextTag()
call SetTextTagText(TA[i], SA[i], SZ)
call SetTextTagPos(TA[i], x, y, 80)
set LA[i] = AddLightningEx(SubString(SA[i], 0, 4), false, x, y, 50, x + 300, y, 50)
call SetTextTagVisibility(TA[i], false)
call SetLightningColor(LA[i], 1, 1, 1, 0)
set i = i + 1
exitwhen SA[i] == null
set y = y - 100
endloop
call TriggerRegisterPlayerChatEvent(t2, Player(0), "-", false)
call TriggerAddAction(t2, function SetStr)
call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "Press ESC to show/hide lightning types.")
call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "Type -xxxx to change the lightning string.")
call DisplayTimedTextToPlayer(Player(0), 0, 0, 1000, "For example -mbur")
set t2 = null
endfunction
endlibrary