Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
unit bird = null
real dc = 0.0
real dx = 0.0
real z = 0.0
real zx = 0.0
real h = 0.0
real ds = 0.0
real tm = 0.0
real tm2 = 30.0
real gs = 0.0
real gsf = 0.0
real stx = 0.0
real sty = 0.0
integer elapsed = 0
boolean jumpbool = false
boolean start = false
boolean restart = false
integer ipp = 7
integer page = 0
integer page2 = 1
integer birdtotal = 0
integer target
integer array birdtype
string array birdname
real array birdcost
real delay = 0.0
gamecache cach
dialog dia = DialogCreate()
button array but
destructable hoverd = null
destructable clickd = null
destructable array editdes
destructable flag = null
integer saveint = 0
boolean antibool = false
boolean pointbool = false
rect array deadrect
rect array pointrect
integer deadtotal = 0
integer pointtotal = 0
trigger flap = CreateTrigger()
trigger eclick = CreateTrigger()
trigger ehover = CreateTrigger()
trigger dead = CreateTrigger()
trigger point = CreateTrigger()
player p = Player(0)
string pn
string mode
trackable array track
real array ex
real array ey
integer etotal = 0
unit array eunit
boolean editmode = false
boolean ebool = false
boolean saved = true
integer eclickint = 0
integer ehoverint = 0
integer flagint = 0
integer edex
integer array spacetype
integer array variation
integer array pipevar
integer array cloudvar
integer ovwrite = 0
rect wb
real wbminx
real wbminy
real wbmaxx
real wbmaxy
string array achiname
string array achides
integer achitot
endglobals
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Camera takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer score
local real dr
local real y
local location loc
set tm = tm + 0.001
if tm >= 1.0 then
set tm = 0.0
set tm2 = tm2 + 1
set elapsed = elapsed + 1
endif
if tm2 >= 30.0 then
set tm2 = 0
set gsf = GetRandomReal(0.5, 2.5)
endif
if editmode then
set loc = GetCameraTargetPositionLoc()
call SetUnitPositionLoc(eunit[1], loc)
if not ebool then
call SetCameraQuickPosition(GetLocationX(loc), GetLocationY(loc))
else
call SetCameraQuickPosition(ex[eclickint], ey[eclickint])
endif
call RemoveLocation(loc)
endif
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 270.0, 0)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 3500.0, 0)
call SetCameraField(CAMERA_FIELD_FARZ, 20000.0, 0)
if start then
if bird != null then
call SetUnitX(bird, GetUnitX(bird) + 0.38)
set ds = ds + 0.0009
if ds > 2.25 then
set ds = 2.25
endif
set y = GetUnitY(bird)
if jumpbool == false then
call SetUnitY(bird, y - ds)
else
if dc < dx then
set dc = dc + 0.32
set z = (((4.0 * zx) / dx) * ((dx - dc) * (dc / dx)))
call SetUnitY(bird, h + z)
else
set jumpbool = false
set ds = 1.675
endif
endif
if GetUnitY(bird) < -2493.20 or GetUnitY(bird) > 262.0 then
call StoreInteger(cach, "collapsed", "general", GetStoredInteger(cach, "collapsed", "general") + 1)
if GetStoredInteger(cach, "collapsed", "general") >= 50 then
if not GetStoredBoolean(cach, "ach3", "general")then
call StoreBoolean(cach, "ach3", "general", true)
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") + 100.0)
endif
endif
call SaveGameCache(cach)
call SetUnitExploded(bird, true)
call KillUnit(bird)
set bird = null
set delay = 2.0
endif
else
set delay = delay - 0.001
if delay <= 0.0 then
set delay = 3600.0
set score = GetStoredInteger(cach, "score", "temporary")
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
if mode == "survival" or mode == "custom" then
set restart = true
if mode == "survival" then
if score > 0 then
set i = 0
loop
set i = i + 1
if score > GetStoredInteger(cach, "score" + I2S(i), "highscore") then
set i2 = 11
loop
set i2 = i2 - 1
if i2 == i then
call StoreInteger(cach, "score" + I2S(i), "highscore", score)
call StoreString(cach, "name" + I2S(i), "highscore", pn)
set dr = GetStoredReal(cach, "cash", "general") + gs + gs * GetStoredReal(cach, "gsfr", "general")
if score >= 150 then
if not GetStoredBoolean(cach, "ach8", "general")then
call StoreBoolean(cach, "ach8", "general", true)
call StoreBoolean(cach, "40", "boughtbird", true)
endif
endif
if gs >= I2R(score)*2.5 then
if not GetStoredBoolean(cach, "ach6", "general")then
call StoreBoolean(cach, "ach6", "general", true)
set dr = dr + 200.0
endif
endif
if dr >= 10000.0 then
if not GetStoredBoolean(cach, "ach5", "general")then
call StoreBoolean(cach, "ach5", "general", true)
endif
endif
call StoreReal(cach, "cash", "general", dr)
call StoreInteger(cach, "pillars", "general", GetStoredInteger(cach, "pillars", "general") + score)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00*You set a new high-score!*|r|n|cffffffffName: " + pn + ", Score: " + I2S(score) + ", Rank-" + I2S(i) + "|n- Cash +$|r|cffffcc00" + R2SW(gs, 4, 2) + "|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[1] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]estart|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
return
else
call StoreInteger(cach, "score" + I2S(i2), "highscore", GetStoredInteger(cach, "score" + I2S(i2-1), "highscore"))
call StoreString(cach, "name" + I2S(i2), "highscore", GetStoredString(cach, "name" + I2S(i2-1), "highscore"))
endif
exitwhen i2 == i
endloop
endif
exitwhen i >= 10
endloop
endif
call StoreInteger(cach, "pillars", "general", GetStoredInteger(cach, "pillars", "general") + score)
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") + gs)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffYou lose! Score: " + I2S(score) + "|n- Cash +$|r|cffffcc00" + R2SW(gs, 4, 2) + "|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[1] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]estart|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
else
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffYou lose! Score: " + I2S(score))
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[13] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]estart|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(p, dia, true)
endif
else
call StoreInteger(cach, "pillars", "general", GetStoredInteger(cach, "pillars", "general") + score)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffYou are fail! Score: " + I2S(score) + "|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
endif
endif
endif
endfunction
function EClick takes nothing returns boolean
local integer i = 0
local trackable t = GetTriggeringTrackable()
loop
set i = i + 1
if t == track[i] then
if i != eclickint then
set ebool = true
call RemoveDestructable(clickd)
set clickd = CreateDestructableZ('B007', ex[i], ey[i], 0.0, 0.0, 3.0, 0)
set eclickint = i
call ClearTextMessages()
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 0.0, "X: [|cffffcc00" + R2SW(ex[i], 5, 1) +"|r], Y: [|cffffcc00" + R2SW(ey[i], 5, 1) + "|r]")
//call AddTool(i)
else
call RemoveDestructable(clickd)
set ebool = false
endif
endif
exitwhen i >= etotal
endloop
return false
endfunction
function EHover takes nothing returns boolean
local integer i = 0
local trackable t = GetTriggeringTrackable()
loop
set i = i + 1
if t == track[i] then
call RemoveDestructable(hoverd)
set hoverd = CreateDestructableZ('B006', ex[i], ey[i], 0.0, 0.0, 3.0, 0)
set ehoverint = i
if not ebool then
call ClearTextMessages()
call DisplayTimedTextToPlayer(p, 0.0, 0.0, 0.0, "X: [|cffffcc00" + R2SW(ex[i], 5, 1) +"|r], Y: [|cffffcc00" + R2SW(ey[i], 5, 1) + "|r]")
//call AddTool(i)
endif
endif
exitwhen i >= etotal
endloop
return false
endfunction
function OnClick takes nothing returns boolean
if start then
set dc = 0.0
set dx = 255.0
set zx = 600.0
set h = GetUnitY(bird)
set jumpbool = true
else
set start = true
set ds = 0.02
call ClearTextMessages()
endif
return false
endfunction
function MClick takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer i = 0
local integer i2 = 0
if u == eunit[2] then
call ClearSelection()
call SelectUnit(eunit[1], true)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Save As|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl") + 1
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[200 + i] = DialogAddButton( dia, GetStoredString(cach, "lvlname" + I2S(i), "savedlvl"), 0 )
else
set but[200 + i] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]mpty Slot|r", 69 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
else
if u == eunit[3] then
call ClearSelection()
call SelectUnit(eunit[1], true)
if not saved then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Are You Sure?|r|n|cffff0000*Any unsaved data will be lost|r")
set but[193] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
return false
endif
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Load Level|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[300 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
else
if u == eunit[4] then
call ClearSelection()
call SelectUnit(eunit[1], true)
if not saved then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Are You Sure?|r|n|cffff0000*Any unsaved data will be lost|r")
set but[196] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
return false
endif
set flag = null
set saved = true
set saveint = 0
set i = 0
loop
set i = i + 1
set spacetype[i] = 0
call RemoveDestructable(editdes[i])
exitwhen i >= etotal
endloop
else
if u == eunit[5] then
call ClearSelection()
call SelectUnit(eunit[1], true)
call DialogClear(dia)
if not saved then
call DialogSetMessage(dia, "|cffffaa00 Are You Sure?|r|n|cffff0000*Any unsaved data will be lost|r")
else
call DialogSetMessage(dia, "|cffffaa00Are You Sure?|r")
endif
set but[104] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
endif
endif
endif
endif
return false
endfunction
function tool takes nothing returns boolean
local integer i = 0
local integer i2 = 0
local integer a = GetSpellAbilityId()
if a == 'A001' then // Pipe
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] != 1 then
set spacetype[i] = 1
set variation[i] = 1
//call AddTool(i)
else
set variation[i] = variation[i] + 1
endif
call RemoveDestructable(editdes[i])
if variation[i] > 18 then
set variation[i] = 1
endif
if ModuloInteger(variation[i], 3) != 0 then
set editdes[i] = CreateDestructableZ(pipevar[variation[i]], ex[i], ey[i], 0.0, 0.0, 1.0, 0)
else
set editdes[i] = CreateDestructableZ(pipevar[variation[i]-1], ex[i], ey[i], 0.0, 180.0, 1.0, 0)
endif
endif
if a == 'A002' then // Anti-Point
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] != 2 then
//call AddTool(i)
set spacetype[i] = 2
set variation[i] = 0
call RemoveDestructable(editdes[i])
set editdes[i] = CreateDestructableZ('B008', ex[i], ey[i], 0.0, 90.0, 4.0, 0)
endif
endif
if a == 'A003' then // Clear
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
//call AddTool(i)
set spacetype[i] = 0
set variation[i] = 0
call RemoveDestructable(editdes[i])
endif
if a == 'A006' then // Cloud
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] != 4 then
set spacetype[i] = 4
set variation[i] = 1
//call AddTool(i)
else
set variation[i] = variation[i] + 1
endif
if variation[i] > 3 then
set variation[i] = 1
endif
call RemoveDestructable(editdes[i])
set editdes[i] = CreateDestructableZ(cloudvar[variation[i]], ex[i], ey[i], -20.0, 270.0, 3.0, 0)
endif
if a == 'A007' then // Tree
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if ModuloInteger(i,13) == 0 then
if saved then
set saved = false
endif
if spacetype[i] != 5 then
set spacetype[i] = 5
set variation[i] = 0
//call AddTool(i)
endif
call RemoveDestructable(editdes[i])
set editdes[i] = CreateDestructableZ('B003', ex[i], ey[i]+100.0, -35.0, 270.0, 5.0, 0)
endif
endif
if a == 'A00B' then // Flag
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] != 3 then
//call AddTool(i)
set spacetype[i] = 3
set variation[i] = 0
set spacetype[flagint] = 0
set variation[flagint] = 0
call RemoveDestructable(editdes[i])
call RemoveDestructable(flag)
set editdes[i] = CreateDestructableZ('B009', ex[i], ey[i], 0.0, 90.0, 3.5, 0)
set flag = editdes[i]
set flagint = i
endif
endif
if a == 'A005' then // Clear Selection
if ebool then
call RemoveDestructable(clickd)
set ebool = false
endif
endif
/*if a == 'A00E' then
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] > 0 then
if ey2[i] >= -64.0 then
set ey2[i] = ey2[i] - 32.0
call RemoveDestructable(editdes[i])
if spacetype[i] == 1 then
if ModuloInteger(variation[i], 3) != 0 then
set editdes[i] = CreateDestructableZ(pipevar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 0.0, 1.0, 0)
else
set editdes[i] = CreateDestructableZ(pipevar[variation[i]-1], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 180.0, 1.0, 0)
endif
else
if spacetype[i] == 4 then
set editdes[i] = CreateDestructableZ(cloudvar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], -20.0, 270.0, 3.0, 0)
else
if spacetype[i] == 5 then
set editdes[i] = CreateDestructableZ('B003', ex[i]+ex2[i], ey[i] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
endif
if a == 'A00F' then
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] > 0 then
if ey2[i] <= 64.0 then
set ey2[i] = ey2[i] + 32.0
call RemoveDestructable(editdes[i])
if spacetype[i] == 1 then
if ModuloInteger(variation[i], 3) != 0 then
set editdes[i] = CreateDestructableZ(pipevar[variation[i]], ex[i], ey[i], 0.0, 0.0, 1.0, 0)
else
set editdes[i] = CreateDestructableZ(pipevar[variation[i]-1], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 180.0, 1.0, 0)
endif
else
if spacetype[i] == 4 then
set editdes[i] = CreateDestructableZ(cloudvar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], -20.0, 270.0, 3.0, 0)
else
if spacetype[i] == 5 then
set editdes[i] = CreateDestructableZ('B003', ex[i]+ex2[i], ey[i] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
endif
if a == 'A00C' then
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] > 0 then
if ex2[i] >= -64.0 then
set ex2[i] = ex2[i] - 32.0
call RemoveDestructable(editdes[i])
if spacetype[i] == 1 then
if ModuloInteger(variation[i], 3) != 0 then
set editdes[i] = CreateDestructableZ(pipevar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 0.0, 1.0, 0)
else
set editdes[i] = CreateDestructableZ(pipevar[variation[i]-1], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 180.0, 1.0, 0)
endif
else
if spacetype[i] == 4 then
set editdes[i] = CreateDestructableZ(cloudvar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], -20.0, 270.0, 3.0, 0)
else
if spacetype[i] == 5 then
set editdes[i] = CreateDestructableZ('B003', ex[i]+ex2[i], ey[i] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
endif
if a == 'A00D' then
if saved then
set saved = false
endif
if ebool then
set i = eclickint
else
set i = ehoverint
endif
if spacetype[i] > 0 then
if ex2[i] <= 64.0 then
set ex2[i] = ex2[i] + 32.0
call RemoveDestructable(editdes[i])
if spacetype[i] == 1 then
if ModuloInteger(variation[i], 3) != 0 then
set editdes[i] = CreateDestructableZ(pipevar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 0.0, 1.0, 0)
else
set editdes[i] = CreateDestructableZ(pipevar[variation[i]-1], ex[i]+ex2[i], ey[i]+ey2[i], 0.0, 180.0, 1.0, 0)
endif
else
if spacetype[i] == 4 then
set editdes[i] = CreateDestructableZ(cloudvar[variation[i]], ex[i]+ex2[i], ey[i]+ey2[i], -20.0, 270.0, 3.0, 0)
else
if spacetype[i] == 5 then
set editdes[i] = CreateDestructableZ('B003', ex[i]+ex2[i], ey[i] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
endif*/
if a == 'A004' then
if saveint == 0 then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Save As|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl") + 1
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[200 + i] = DialogAddButton( dia, GetStoredString(cach, "lvlname" + I2S(i), "savedlvl"), 0 )
else
set but[200 + i] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]mpty Slot|r", 69 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
else
if not saved then
set saved = true
endif
call StoreBoolean(cach, "customlvl" + I2S(saveint), "savedlvl", true)
call StoreString(cach, "lvlname" + I2S(saveint), "savedlvl", "CustomLevel" + I2S(saveint))
set i = 0
loop
set i = i + 1
if spacetype[i] != GetStoredInteger(cach, "spaceid" + I2S(i), "CustomLevel" + I2S(saveint)) then
call StoreInteger(cach, "spaceid" + I2S(i), "CustomLevel" + I2S(saveint), spacetype[i])
endif
if variation[i] != GetStoredInteger(cach, "spacevar" + I2S(i), "CustomLevel" + I2S(saveint)) then
call StoreInteger(cach, "spacevar" + I2S(i), "CustomLevel" + I2S(saveint), variation[i])
endif
exitwhen i >= etotal
endloop
call SaveGameCache(cach)
endif
endif
return false
endfunction
function InitTrig_FlapFlap takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local trigger abil = CreateTrigger()
local trigger menuclick = CreateTrigger()
local unit u
set cach = InitGameCache("wc3flapflapFinalCache4.w3v")
set tm2 = GetStoredReal(cach, "gsft", "general")
set gsf = GetStoredReal(cach, "gsf", "general")
set pn = GetPlayerName(p)
call FogEnable(false)
call FogMaskEnable(false)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 12)
call SetTimeOfDayScale(0.0)
call EnableDragSelect(false, false)
call TimerStart(CreateTimer(), 0.001, true, function Camera)
set wb = GetWorldBounds()
set wbminx = GetRectMinX(wb)
set wbminy = GetRectMinY(wb)
set wbmaxx = GetRectMaxX(wb)
set wbmaxy = GetRectMaxY(wb)
call StoreInteger(cach, "game", "general", GetStoredInteger(cach, "game", "general") + 1)
if GetStoredBoolean(cach, "hplayed", "other") == null then
set gsf = 0.5
call StoreInteger(cach, "birdtype", "general", 21)
call StoreInteger(cach, "collected", "general", 2)
call StoreInteger(cach, "totallvl", "savedlvl", 0)
call StoreInteger(cach, "restart", "general", 0)
call StoreBoolean(cach, "hplayed", "other", true)
call StoreBoolean(cach, "21", "boughtbird", true)
call StoreBoolean(cach, "22", "boughtbird", true)
call StoreReal(cach, "gsfr", "general", 0.0)
call StoreBoolean(cach, "ach1", "general", false)
call StoreBoolean(cach, "ach2", "general", false)
call StoreBoolean(cach, "ach3", "general", false)
call StoreBoolean(cach, "ach4", "general", false)
call StoreBoolean(cach, "ach5", "general", false)
call StoreBoolean(cach, "ach6", "general", false)
call StoreBoolean(cach, "ach7", "general", false)
call StoreBoolean(cach, "ach8", "general", false)
call StoreBoolean(cach, "ach9", "general", false)
call StoreBoolean(cach, "ach10", "general", false)
call StoreBoolean(cach, "ach11", "general", false)
call StoreBoolean(cach, "ach12", "general", false)
call StoreBoolean(cach, "ach13", "general", false)
endif
call SaveGameCache(cach)
set u = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'H00H', 0.0, 0.0, 0.0)
call UnitAddItemById(u,'gold')
call RemoveUnit(u)
call PlayMusic("war3mapImported\\blank.mp3")
call TriggerRegisterAnyUnitEventBJ(abil, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerRegisterPlayerUnitEvent(menuclick, p, EVENT_PLAYER_UNIT_SELECTED, null)
call TriggerAddCondition(abil, Condition(function tool))
call TriggerAddCondition(flap, Condition(function OnClick))
call TriggerAddCondition(eclick, Condition(function EClick))
call TriggerAddCondition(ehover, Condition(function EHover))
call TriggerAddCondition(menuclick, Condition(function MClick))
set i = 0
loop
set i2 = 0
loop
set etotal = etotal + 1
set spacetype[etotal] = 0
set variation[etotal] = 0
set ex[etotal] = -4500.13+I2R(i*215)
set ey[etotal] = 175.62-I2R(i2*215)
set i2 = i2 + 1
exitwhen i2 >= 13
endloop
set i = i + 1
exitwhen i >= 171
endloop
set abil = null
set menuclick = null
set u = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitTrig_Library takes nothing returns nothing
set birdtype[21] = 'h000'
set birdtype[22] = 'h001'
set birdtype[23] = 'h00C'
set birdtype[24] = 'h00F'
set birdtype[25] = 'h00D'
set birdtype[26] = 'h00P'
set birdtype[27] = 'h00A'
set birdtype[28] = 'h006'
set birdtype[29] = 'h007'
set birdtype[30] = 'h00E'
set birdtype[31] = 'h005'
set birdtype[32] = 'h00B'
set birdtype[33] = 'h008'
set birdtype[34] = 'h003'
set birdtype[35] = 'h002'
set birdtype[36] = 'h00N'
set birdtype[37] = 'h009'
set birdtype[38] = 'h00M'
set birdtype[39] = 'h004'
set birdtype[40] = 'h00O'
set birdtype[41] = 'h00G'
set birdtype[42] = 'h00Q'
set birdcost[21] = 0.00
set birdcost[22] = 0.00
set birdcost[23] = 65.20
set birdcost[24] = 68.75
set birdcost[25] = 105.50
set birdcost[26] = 120.05
set birdcost[27] = 143.03
set birdcost[28] = 170.00
set birdcost[29] = 189.00
set birdcost[30] = 208.07
set birdcost[31] = 235.00
set birdcost[32] = 270.99
set birdcost[33] = 306.67
set birdcost[34] = 318.50
set birdcost[35] = 340.20
set birdcost[36] = 375.05
set birdcost[37] = 420.75
set birdcost[38] = 467.20
set birdcost[39] = 610.00
set birdcost[40] = 999.99
set birdcost[41] = 1999.99
set birdcost[42] = 9999.99
set birdname[21] = "Albatross"
set birdname[22] = "Vulture"
set birdname[23] = "Hawk"
set birdname[24] = "Owl"
set birdname[25] = "Hypogryph"
set birdname[26] = "Wyvern"
set birdname[27] = "Gargoyle"
set birdname[28] = "Couat"
set birdname[29] = "Faerie Dragon"
set birdname[30] = "Netherdrake"
set birdname[31] = "Chimaera"
set birdname[32] = "Green Dragon"
set birdname[33] = "Sheep"
set birdname[34] = "Blue Dragon"
set birdname[35] = "Black Dragon"
set birdname[36] = "Soul Wyvern"
set birdname[37] = "Frost Wyrm"
set birdname[38] = "Red Dragon"
set birdname[39] = "Gold Dragon"
set birdname[40] = "Flying Dutchman"
set birdname[41] = "Phoenix"
set birdname[42] = "Unknown Species"
set birdtotal = 42
set pipevar[1] = 'B00A'
set pipevar[2] = 'B005'
set pipevar[4] = 'B00E'
set pipevar[5] = 'B00D'
set pipevar[7] = 'B00J'
set pipevar[8] = 'B00K'
set pipevar[10] = 'B00I'
set pipevar[11] = 'B00H'
set pipevar[13] = 'B00C'
set pipevar[14] = 'B00B'
set pipevar[16] = 'B00G'
set pipevar[17] = 'B00F'
set cloudvar[1] = 'B000'
set cloudvar[2] = 'B001'
set cloudvar[3] = 'B002'
set achiname[1] = "Rising Star"
set achiname[2] = "Mass Crusher"
set achiname[3] = "Suicidal"
set achiname[4] = "Flappy Bird Freak"
set achiname[5] = "World Ruler"
set achiname[6] = "Pure Luck"
set achiname[7] = "Match Maker"
set achiname[8] = "Future Legend"
set achiname[9] = "Flappy General"
set achiname[10] = "Legendary Flapper"
set achiname[11] = "The Collector"
set achiname[12] = "A True Achievement"
set achiname[13] = "The End"
set achides[1] = "Complete the Novice Training|nAward: None"
set achides[2] = "Crash for 500 times|nAward: $100.00"
set achides[3] = "Suicide for 50 times|nAward: $100.00"
set achides[4] = "Restart for 600 times|nAward: $250.00"
set achides[5] = "Save $10000.0 cash|nAward: None"
set achides[6] = "Gets 2.5x cash of total score|nAward: $200.00"
set achides[7] = "Save 7 custom levels|nAward: None"
set achides[8] = "Gets 150 scores in survival mode|nAward: Flying Dutchman"
set achides[9] = "Pass the Final Exam|nAward: +0.75x cash rate bonus"
set achides[10] = "Complete the Secret Challenge|nAward: +1.25x cash rate bonus"
set achides[11] = "Collect 20 specieses of birds|nAward: $500.00"
set achides[12] = "Unlock the Legendary Phoenix|nAward: +0.50x cash rate bonus"
set achides[13] = "Unlock all achievements|nAward: Unknown Species"
set achitot = 13
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function DeadActions takes nothing returns nothing
local integer i = GetStoredInteger(cach, "crashed", "general") + 1
call StoreInteger(cach, "crashed", "general", i)
if i >= 500 then
if not GetStoredBoolean(cach, "ach2", "general")then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") + 100.0)
call StoreBoolean(cach, "ach2", "general", true)
endif
endif
call SaveGameCache(cach)
call SetUnitExploded(bird, true)
call KillUnit(bird)
set bird = null
set delay = 2.0
endfunction
function InitTrig_Death takes nothing returns nothing
call TriggerAddAction(dead, function DeadActions)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function ClearRects takes nothing returns nothing
local integer i = 0
local integer x
if deadtotal > pointtotal then
set x = deadtotal
else
set x = pointtotal
endif
loop
set i = i + 1
if deadtotal > 0 then
call RemoveRect(deadrect[deadtotal])
set deadtotal = deadtotal - 1
endif
if pointtotal > 0 then
call RemoveRect(pointrect[pointtotal])
set pointtotal = pointtotal - 1
endif
exitwhen i >= x
endloop
endfunction
function ReDes takes nothing returns nothing
call RemoveDestructable(GetEnumDestructable())
endfunction
function PointActions takes nothing returns nothing
local integer i = 0
local integer i2 = 0
local integer i3 = 0
local integer i4 = 0
local integer score
local integer rdmint = 0
call UnitAddItemById(GetTriggerUnit(),'gold')
set gs = gs + gsf
set score = GetStoredInteger(cach, "score", "temporary") + 1
call StoreInteger(cach, "score", "temporary", score)
call SaveGameCache(cach)
if mode == "survival" then
if score >= target then
call ClearRects()
call EnumDestructablesInRect(wb, null, function ReDes)
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(1,8)
loop
set i = i + 3
set rdmint = GetRandomInt(0, 100)
if rdmint <= 25 and i2 < 8 then
set i2 = GetRandomInt(1,7)
elseif rdmint <= 50 and i2 > 1 then
set i2 = GetRandomInt(2,8)
else
if GetRandomInt(0, 100) <= 50 then
set i2 = i2 - 1
if i2 < 1 then
set i2 = 1
endif
else
set i2 = i2 + 1
if i2 > 8 then
set i2 = 8
endif
endif
endif
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if i > 19 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 128.0, ey[i4] - 128.0, ex[i4] + 128.0, ey[i4] + 128.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 64
endloop
call SetUnitX(bird, ex[195])
call SetUnitY(bird, ey[200])
set target = target + pointtotal
endif
else
if mode == "training1" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
if not GetStoredBoolean(cach, "ach1", "general")then
call StoreBoolean(cach, "ach1", "general", true)
endif
call StoreBoolean(cach, "status1", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You've passed Novice Training|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "training2" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
call StoreBoolean(cach, "status2", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You've passed Accuracy Training|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "training3" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
call StoreBoolean(cach, "status3", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You've passed Agility Training|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "training4" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
call StoreBoolean(cach, "status4", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You've passed Ladder Training|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "training5" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
if not GetStoredBoolean(cach, "ach9", "general")then
call StoreReal(cach, "gsfr", "general", GetStoredReal(cach, "gsfr", "general") + 0.75)
call StoreBoolean(cach, "ach9", "general", true)
endif
call StoreBoolean(cach, "status5", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You've been Graduated.|nNow Try to beat the Secret Challenge|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "training6" then
if score >= pointtotal then
set delay = 3600.0
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
if not GetStoredBoolean(cach, "ach10", "general")then
call StoreBoolean(cach, "ach10", "general", true)
call StoreReal(cach, "gsfr", "general", GetStoredReal(cach, "gsfr", "general") + 1.25)
endif
call StoreBoolean(cach, "status6", "training", true)
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffCongratulations! You beat the game. Thanks for playing, Master.|r")
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(Player(0), dia, true)
endif
else
if mode == "custom" then
if score >= pointtotal then
set delay = 3600.0
call StoreInteger(cach, "playtime", "general", GetStoredInteger( cach, "playtime", "general") + elapsed)
call StoreReal(cach, "gsft", "general", tm2)
call StoreReal(cach, "gsf", "general", gsf)
call SaveGameCache(cach)
call SetUnitExploded(bird, true)
call UnitApplyTimedLife(bird, 'BTLF', 1.0)
set bird = null
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffffffYou Win! Score: " + I2S(score))
set but[12] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00G|r|cffffffff]et Replay|r", 71 )
set but[13] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]estart|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(p, dia, true)
endif
endif
endif
endif
endif
endif
endif
endif
endif
endfunction
function InitTrig_Point takes nothing returns nothing
call TriggerAddAction( point, function PointActions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function InitMenu takes nothing returns nothing
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Menu|r" )
set but[100] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00P|r|cffffffff]lay Game|r", 80 )
set but[101] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]dit Mode|r", 69 )
call DialogDisplay(p, dia, true)
endfunction
function ShowMenu takes nothing returns nothing
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Menu|r" )
set but[1] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]ormal Mode|r", 80 )
set but[194] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ustom Level|r", 67 )
set but[195] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00T|r|cffffffff]raining School|r", 84 )
set but[2] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ird Shop|r", 66 )
set but[3] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00H|r|cffffffff]igh-Score|r", 72 )
set but[4] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00S|r|cffffffff]tatistic|r", 83 )
set but[5] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00A|r|cffffffff]chievements|r", 65 )
set but[6] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Game|r", 81 )
call DialogDisplay(p, dia, true)
endfunction
function ShowHighScore takes nothing returns nothing
local real d
local string s
local integer i = 0
call DialogClear(dia)
set s = "|cffffaa00 High-Score|r|nRank Score Name"
loop
set i = i + 1
if GetStoredInteger(cach, "score" + I2S(i), "highscore") > 0 then
set s = s + "|n|cffffffff" + I2S(i) + ". " + I2S(GetStoredInteger(cach, "score" + I2S(i), "highscore")) + " " + GetStoredString(cach, "name" + I2S(i), "highscore") + "|r"
else
set s = s + "|n|cffffffff" + I2S(i) + ". " + "0" + " -|r"
endif
exitwhen i >= 10
endloop
call DialogSetMessage(dia, s)
set but[7] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]eset Score|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
call DialogDisplay(p, dia, true)
endfunction
function birdshop takes nothing returns nothing
local real cash
local integer i = 0
local integer dex
local string s
call DialogClear(dia)
set cash = GetStoredReal(cach, "cash", "general")
call DialogSetMessage(dia, "|cffffaa00 Bird Shop |r|cffffffff(Cash:|r $|cffffcc00" + R2SW(cash, 4,2) + "|r|cffffffff)|r|n|cff999999*Click the button to select/buy bird|r")
loop
set i = i + 1
set dex = 20+(page - 1)*ipp+i
if birdname[dex] != null then
if not GetStoredBoolean(cach, I2S(dex), "boughtbird") then
set s = "|cff999999" + birdname[dex] + " |cffffffff[Cost: $|r"
if cash >= birdcost[dex] then
set s = s + "|cff00ff00" + R2SW(birdcost[dex], 4, 2) + "|r|cffffffff]|r"
else
set s = s + "|cffff0000" + R2SW(birdcost[dex], 4, 2) + "|r|cffffffff]|r"
endif
else
if GetStoredInteger(cach, "birdtype", "general") != dex then
if dex != birdtotal then
set s = "|cffffff00" + birdname[dex] + "|r"
else
set s = "|cffffff00Sky Barge" + "|r"
endif
else
if dex != birdtotal then
set s = "|cff00ffaa" + birdname[dex] + "|r"
else
set s = "|cff00ffaaSky Barge" + "|r"
endif
endif
endif
set but[dex] = DialogAddButton( dia, s, 0 )
endif
exitwhen i >= ipp
endloop
if page < (birdtotal - 20) / ipp + 1 then
set but[14] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]ext Page|r", 78 )
endif
if page > 1 then
set but[15] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00P|r|cffffffff]rev Page|r", 80 )
endif
if page == 1 or page == (birdtotal - 20) / ipp + 1 then
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
endif
call DialogDisplay(p, dia, true)
endfunction
function buttonclick takes nothing returns boolean
local string s
local string lvlname
local integer i = 0
local integer i2 = 0
local integer i3 = 0
local integer i4 = 0
local integer mod = 0
local integer si = 0
local integer rdmint = 0
local integer ladderint
local real cash = 0.0
local button buton = GetClickedButton()
local boolean achibool
if buton == but[1] then
set mode = "survival"
call ClearRects()
call EnumDestructablesInRect(wb, null, function ReDes)
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(1,8)
loop
set i = i + 3
set rdmint = GetRandomInt(0, 100)
if rdmint <= 25 and i2 < 8 then
set i2 = GetRandomInt(1,7)
elseif rdmint <= 50 and i2 > 1 then
set i2 = GetRandomInt(2,8)
else
if GetRandomInt(0, 100) <= 50 then
set i2 = i2 - 1
if i2 < 1 then
set i2 = 1
endif
else
set i2 = i2 + 1
if i2 > 8 then
set i2 = 8
endif
endif
endif
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if i > 19 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 128
endloop
set stx = ex[195]
set sty = ey[200]
set target = pointtotal
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
if GetStoredInteger(cach, "restart", "general") >= 600 then
if not GetStoredBoolean(cach, "ach4", "general")then
call StoreBoolean(cach, "ach4", "general", true)
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") + 250.0)
endif
endif
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. High-Score: |cffffff00" + I2S(GetStoredInteger(cach, "score1", "highscore")) + "|r, by: |cffffff00" + GetStoredString(cach, "name1", "highscore") + "|r")
return false
endif
if buton == but[2] then
set page = 1
call birdshop()
return false
endif
if buton == but[3] then
call ShowHighScore()
return false
endif
if buton == but[4] then
call DialogClear(dia)
set s = "|cffffaa00 Statistic|r|cffffffff"
set s = s + "|nTotal game played: " + I2S(GetStoredInteger(cach, "game", "general"))
set s = s + "|nTotal restart: " + I2S(GetStoredInteger(cach, "restart", "general"))
set s = s + "|nTotal pillar passed: " + I2S(GetStoredInteger(cach, "pillars", "general"))
set s = s + "|nCash: $" + R2SW(GetStoredReal(cach, "cash", "general"), 4, 2)
set s = s + "|nHighest score: " + I2S(GetStoredInteger(cach, "score1", "highscore")) + " by " + GetStoredString(cach, "name1", "highscore")
set s = s + "|nTotal suicide: " + I2S(GetStoredInteger(cach, "collapsed", "general"))
set s = s + "|nTotal crashed: " + I2S(GetStoredInteger(cach, "crashed", "general"))
set s = s + "|nTotal saved level: " + I2S(GetStoredInteger(cach, "totallvl", "savedlvl"))
set s = s + "|nCollected species: " + I2S(GetStoredInteger(cach, "collected", "general"))
set s = s + "|nTotal played time: " + I2S(R2I(GetStoredInteger(cach, "playtime", "general"))) + " seconds"
set s = s + "|r"
call DialogSetMessage(dia, s)
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[5] then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Achievements|r|n|cffffffffWhite = Locked|r |cffffff00Yellow = Unlocked|r")
set i = (page2-1)*ipp
loop
set i = i + 1
if achiname[i] != null then
if GetStoredBoolean(cach, "ach" + I2S(i), "general") then
set but[550+i] = DialogAddButton( dia, "|cffffff00" + achiname[i] + "|r", 0 )
else
set but[550+i] = DialogAddButton( dia, "|cffffffff" + achiname[i] + "|r", 0 )
endif
endif
exitwhen i >= ipp*page2
endloop
if page2 < achitot/ipp + 1 then
set but[549] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]ext Page|r", 78 )
endif
if page2 > 1 then
set but[550] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00P|r|cffffffff]rev Page|r", 80 )
endif
if page2 == 1 or page2 == achitot/ipp + 1 then
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
endif
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[6] then
call SaveGameCache(cach)
call CustomVictoryBJ(p, false, false)
return false
endif
if buton == but[7] then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Are you sure?|r")
set but[9] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[10] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[8] then
call ShowMenu()
return false
endif
if buton == but[9] then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Are you drunk?|r")
set but[10] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[11] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[10] then
call ShowHighScore()
return false
endif
if buton == but[11] then
loop
set i = i + 1
call StoreInteger(cach, "score" + I2S(i), "highscore", 0)
call SaveGameCache(cach)
exitwhen i >= 10
endloop
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00High-Score has been reseted|r")
set but[10] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00R|r|cffffffff]eturn to High-Score|r", 82 )
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[12] then
call StoreInteger(cach, "game", "general", GetStoredInteger(cach, "game", "general") + 1)
call SaveGameCache(cach)
call RestartGame(true)
return false
endif
if buton == but[13] then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
if GetStoredInteger(cach, "restart", "general") >= 600 then
if not GetStoredBoolean(cach, "ach4", "general")then
call StoreBoolean(cach, "ach4", "general", true)
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") + 250.0)
endif
endif
call StoreInteger(cach, "score", "temporary", 0)
call SaveGameCache(cach)
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
set gs = 0.0
set start = false
set jumpbool = false
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start")
return false
endif
if buton == but[14] then
set page = page + 1
call birdshop()
return false
endif
if buton == but[15] then
set page = page - 1
call birdshop()
return false
endif
if buton == but[100] then // Play Game
call EnableTrigger(flap)
call ShowMenu()
loop
set i = i + 1
set i2 = 0
loop
set i2 = i2 + 1
call TriggerRegisterTrackableHitEvent(flap, CreateTrackable("war3mapImported\\64000x64000Track.mdx", -5000.0+I2R(i*450), -4500.0+I2R(i2*450), 270.0))
exitwhen i2 >= 19
endloop
exitwhen i >= 83
endloop
return false
endif
if buton == but[101] then // Edit Mode
set editmode = true
call StopMusic(true)
set eunit[1] = CreateUnit(p, 'H00H', 0.0, 0.0, 0.0)
set eunit[2] = CreateUnit(p, 'H00I', 0.0, 0.0, 0.0)
set eunit[3] = CreateUnit(p, 'H00J', 0.0, 0.0, 0.0)
set eunit[4] = CreateUnit(p, 'H00K', 0.0, 0.0, 0.0)
set eunit[5] = CreateUnit(p, 'H00L', 0.0, 0.0, 0.0)
call UnitAddItemById(eunit[1], 'I000')
call UnitAddItemById(eunit[1], 'I001')
call ClearSelection()
call SelectUnit(eunit[1], true)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Editor Menu|r")
set but[102] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]reate New|r", 67 )
set but[103] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00L|r|cffffffff]oad Level|r", 76 )
set but[104] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Editor|r", 81 )
call DialogDisplay(p, dia, true)
call EnumDestructablesInRect(wb, null, function ReDes)
set etotal = 0
loop
set i2 = 0
loop
set etotal = etotal + 1
set track[etotal] = CreateTrackable("war3mapImported\\152x152border.mdx", ex[etotal], ey[etotal], 0.0)
call TriggerRegisterTrackableHitEvent(eclick, track[etotal])
call TriggerRegisterTrackableTrackEvent(ehover, track[etotal])
set i2 = i2 + 1
exitwhen i2 >= 13
endloop
set i = i + 1
exitwhen i >= 171
endloop
return false
endif
if buton == but[102] then // Create new level
set saveint = 0
set saved = true
return false
endif
if buton == but[103] then // Load level
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Load Level|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[300 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[200] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[104] then // Quit editor
call RestartGame(false)
return false
endif
set i = 20
loop
set i = i + 1
if buton == but[i] then
if not GetStoredBoolean(cach, I2S(i), "boughtbird") then
if GetStoredReal(cach, "cash", "general") >= birdcost[i] then
call StoreBoolean(cach, I2S(i), "boughtbird", true)
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - birdcost[i])
call StoreInteger(cach, "collected", "general", GetStoredInteger(cach, "collected", "general") + 1)
if GetStoredInteger(cach, "collected", "general") >= 20 then
if not GetStoredBoolean(cach, "ach11", "general")then
call StoreBoolean(cach, "ach11", "general", true)
endif
endif
if i == 41 then
if not GetStoredBoolean(cach, "ach12", "general")then
call StoreBoolean(cach, "ach12", "general", true)
call StoreReal(cach, "gsfr", "general", GetStoredReal(cach, "gsfr", "general") + 0.5)
endif
endif
call SaveGameCache(cach)
endif
else
call StoreInteger(cach, "birdtype", "general", i)
call SaveGameCache(cach)
endif
call birdshop()
return false
endif
exitwhen i >= birdtotal
endloop
if buton == but[193] then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Load Level|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[300 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[194] then // Play custom level
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Custom Levels|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[400 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[195] or buton == but[150] or buton == but[151] or buton == but[152] or buton == but[153] or buton == but[154] or buton == but[155] then // Training School
set cash = GetStoredReal(cach, "cash", "general")
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Training School|r|n|cffffffff (Cash: |cffffcc00$" + R2SW(cash,4,2) + "|r|cffffffff)|r")
if GetStoredBoolean(cach, "status1", "training") then
set but[501] = DialogAddButton(dia, "|cffffff00Novice Training|r", 0)
else
if cash >= 5.0 then
set but[501] = DialogAddButton(dia, "|cffffffffNovice Training [Tax: $|cff00ff005.00|r|cffffffff]|r", 0)
else
set but[150] = DialogAddButton(dia, "|cffffffffNovice Training [Tax: $|cffff00005.00|r|cffffffff]|r", 0)
endif
endif
if GetStoredBoolean(cach, "status2", "training") then
set but[502] = DialogAddButton(dia, "|cffffff00Accuracy Training|r", 0)
else
if cash >= 10.0 then
set but[502] = DialogAddButton(dia, "|cffffffffAccuracy Training [Tax: $|cff00ff0010.00|r|cffffffff]|r", 0)
else
set but[151] = DialogAddButton(dia, "|cffffffffAccuracy Training [Tax: $|cffff000010.00|r|cffffffff]|r", 0)
endif
endif
if GetStoredBoolean(cach, "status3", "training") then
set but[503] = DialogAddButton(dia, "|cffffff00Agility Training|r", 0)
else
if cash >= 13.5 then
set but[503] = DialogAddButton(dia, "|cffffffffAgility Training [Tax: $|cff00ff0013.50|r|cffffffff]|r", 0)
else
set but[152] = DialogAddButton(dia, "|cffffffffAgility Training [Tax: $|cffff000013.50|r|cffffffff]|r", 0)
endif
endif
if GetStoredBoolean(cach, "status4", "training") then
set but[504] = DialogAddButton(dia, "|cffffff00Ladder Training|r", 0)
else
if cash >= 15.0 then
set but[504] = DialogAddButton(dia, "|cffffffffLadder Training [Tax: $|cff00ff0015.00|r|cffffffff]|r", 0)
else
set but[153] = DialogAddButton(dia, "|cffffffffLadder Training [Tax: $|cffff000015.00|r|cffffffff]|r", 0)
endif
endif
if GetStoredBoolean(cach, "status1", "training") and GetStoredBoolean(cach, "status2", "training") and GetStoredBoolean(cach, "status3", "training") and GetStoredBoolean(cach, "status5", "training") then
if GetStoredBoolean(cach, "status5", "training") then
set but[505] = DialogAddButton(dia, "|cffffff00Final Exam|r", 0)
else
if cash >= 50.0 then
set but[505] = DialogAddButton(dia, "|cffffffffFinal Exam [Tax: $|cff00ff0050.00|r|cffffffff]|r", 0)
else
set but[154] = DialogAddButton(dia, "|cffffffffFinal Exam [Tax: $|cffff000050.00|r|cffffffff]|r", 0)
endif
endif
else
set but[154] = DialogAddButton(dia, "|cff555555Final Exam|r", 0)
endif
if GetStoredBoolean(cach, "status5", "training") then
if GetStoredBoolean(cach, "status6", "training") then
set but[506] = DialogAddButton(dia, "|cffffff00Final Exam II|r", 0)
else
if cash >= 75.0 then
set but[506] = DialogAddButton(dia, "|cffffffffFinal Exam II [Tax: $|cff00ff0075.00|r|cffffffff]|r", 0)
else
set but[155] = DialogAddButton(dia, "|cffffffffFinal Exam II [Tax: $|cffff000075.00|r|cffffffff]|r", 0)
endif
endif
endif
set but[8] = DialogAddButton(dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[196] then
set flag = null
set i = 0
set saved = true
set saveint = 0
loop
set i = i + 1
set spacetype[i] = 0
set variation[i] = 0
call RemoveDestructable(editdes[i])
exitwhen i >= etotal
endloop
return false
endif
if buton == but[197] then
return false
endif
if buton == but[198] then // overwrite
if not saved then
set saved = true
endif
set saveint = ovwrite
call StoreString(cach, "lvlname" + I2S(ovwrite), "savedlvl", "CustomLevel" + I2S(ovwrite))
set i = 0
loop
set i = i + 1
if spacetype[i] != GetStoredInteger(cach, "spaceid" + I2S(i), "CustomLevel" + I2S(ovwrite)) then
call StoreInteger(cach, "spaceid" + I2S(i), "CustomLevel" + I2S(ovwrite), spacetype[i])
endif
if variation[i] != GetStoredInteger(cach, "spacevar" + I2S(i), "CustomLevel" + I2S(ovwrite)) then
call StoreInteger(cach, "spacevar" + I2S(i), "CustomLevel" + I2S(ovwrite), variation[i])
endif
exitwhen i >= etotal
endloop
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Save As|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl") + 1
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[200 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
else
set but[200 + i] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]mpty Slot|r", 69 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[199] then
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Save As|r")
set i = 0
set i2 = GetStoredInteger(cach, "totallvl", "savedlvl") + 1
loop
set i = i + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i), "savedlvl") then
set but[200 + i] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i), "savedlvl") + "|r", 0 )
else
set but[200 + i] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]mpty Slot|r", 69 )
endif
exitwhen i >= i2 or i >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[200] then // Editor menu
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Editor Menu|r")
set but[102] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]reate New|r", 67 )
set but[103] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00L|r|cffffffff]oad Level|r", 76 )
set but[104] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Q|r|cffffffff]uit Editor|r", 81 )
call DialogDisplay(p, dia, true)
return false
endif
set i = 200
set i3 = 201 + GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if buton == but[i] then
set ovwrite = i - 200
if not GetStoredBoolean(cach, "customlvl" + I2S(ovwrite), "savedlvl") then
if not saved then
set saved = true
endif
set saveint = ovwrite
call StoreBoolean(cach, "customlvl" + I2S(ovwrite), "savedlvl", true)
call StoreString(cach, "lvlname" + I2S(ovwrite), "savedlvl", "CustomLevel" + I2S(ovwrite))
call StoreInteger(cach, "totallvl", "savedlvl", GetStoredInteger(cach, "totallvl", "savedlvl") + 1)
call SaveGameCache(cach)
set i2 = 0
loop
set i2 = i2 + 1
if spacetype[i2] > 0 then
call StoreInteger(cach, "spaceid" + I2S(i2), "CustomLevel" + I2S(ovwrite), spacetype[i2])
endif
if variation[i2] > 0 then
call StoreInteger(cach, "spacevar" + I2S(i2), "CustomLevel" + I2S(ovwrite), variation[i2])
endif
exitwhen i2 >= etotal
endloop
call SaveGameCache(cach)
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Save As|r")
set i2 = 0
set i4 = GetStoredInteger(cach, "totallvl", "savedlvl")
if i4 >= 7 then
if not GetStoredBoolean(cach, "ach7", "general")then
call StoreBoolean(cach, "ach7", "general", true)
endif
endif
loop
set i2 = i2 + 1
if GetStoredBoolean(cach, "customlvl" + I2S(i2), "savedlvl") then
set but[200 + i2] = DialogAddButton( dia, "|cffffffff" + GetStoredString(cach, "lvlname" + I2S(i2), "savedlvl") + "|r", 0 )
else
set but[200 + i2] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00E|r|cffffffff]mpty Slot|r", 69 )
endif
exitwhen i2 >= i4 + 1 or i2 >= 7
endloop
set but[197] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00C|r|cffffffff]ancel|r", 67 )
call DialogDisplay(p, dia, true)
else
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00Overwrite This Slot?|r")
set but[198] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00Y|r|cffffffff]es|r", 89 )
set but[199] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]o|r", 78 )
call DialogDisplay(p, dia, true)
endif
return false
endif
exitwhen i >= i3
endloop
set i = 300
set i3 = 300 + GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if buton == but[i] then
if not saved then
set saved = true
endif
set si = i - 300
set saveint = si
set i2 = 0
set flag = null
loop
set i2 = i2 + 1
if editdes[i2] != null then
call RemoveDestructable(editdes[i2])
set editdes[i2] = null
endif
set lvlname = GetStoredString(cach, "lvlname" + I2S(si), "savedlvl")
set spacetype[i2] = GetStoredInteger(cach, "spaceid" + I2S(i2), lvlname)
if spacetype[i2] == 1 then
set variation[i2] = GetStoredInteger(cach, "spacevar" + I2S(i2), lvlname)
if ModuloInteger(variation[i2], 3) != 0 then
set editdes[i2] = CreateDestructableZ(pipevar[variation[i2]], ex[i2], ey[i2], 0.0, 0.0, 1.0, 0)
else
set editdes[i2] = CreateDestructableZ(pipevar[variation[i2]-1], ex[i2], ey[i2], 0.0, 180.0, 1.0, 0)
endif
else
if spacetype[i2] == 2 then
set editdes[i2] = CreateDestructableZ('B008', ex[i2], ey[i2], 0.0, 0.0, 4.0, 0)
else
if spacetype[i2] == 3 then
set editdes[i2] = CreateDestructableZ('B009', ex[i2], ey[i2], 0.0, 0.0, 3.5, 0)
set flag = editdes[i2]
set flagint = i2
else
if spacetype[i2] == 4 then
set variation[i2] = GetStoredInteger(cach, "spacevar" + I2S(i2), lvlname)
set editdes[i2] = CreateDestructableZ(cloudvar[variation[i2]], ex[i2], ey[i2], -20.0, 270.0, 3.0, 0)
else
if spacetype[i2] == 5 then
set editdes[i2] = CreateDestructableZ('B003', ex[i2], ey[i2] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
exitwhen i2 >= etotal
endloop
call ClearSelection()
call SelectUnit(eunit[1], true)
return false
endif
exitwhen i >= i3
endloop
set i = 400
set i3 = 400 + GetStoredInteger(cach, "totallvl", "savedlvl")
loop
set i = i + 1
if buton == but[i] then
set mode = "custom"
set si = i - 400
set stx = 0.0
set sty = 0.0
call ClearRects()
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i2 = 0
loop
set i2 = i2 + 1
if editdes[i2] != null then
call RemoveDestructable(editdes[i2])
set editdes[i2] = null
endif
set lvlname = GetStoredString(cach, "lvlname" + I2S(si), "savedlvl")
set spacetype[i2] = GetStoredInteger(cach, "spaceid" + I2S(i2), lvlname)
if spacetype[i2] == 1 then
set variation[i2] = GetStoredInteger(cach, "spacevar" + I2S(i2), lvlname)
if not pointbool then
set pointbool = true
endif
if ModuloInteger(variation[i2],3) != 0 then
set editdes[i2] = CreateDestructableZ(pipevar[variation[i2]], ex[i2], ey[i2], 350.0, 0.0, 1.0, 0)
else
set editdes[i2] = CreateDestructableZ(pipevar[variation[i2]-1], ex[i2], ey[i2], 350.0, 180.0, 1.0, 0)
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i2] - 120.0, ey[i2] - 120.0, ex[i2] + 120.0, ey[i2] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
else
if spacetype[i2] == 2 then
if not antibool then
set antibool = true
endif
else
if spacetype[i2] == 3 then
set stx = ex[i2]
set sty = ey[i2]
else
if spacetype[i2] == 4 then
set variation[i2] = GetStoredInteger(cach, "spacevar" + I2S(i2), lvlname)
set editdes[i2] = CreateDestructableZ(cloudvar[variation[i2]], ex[i2], ey[i2], -20.0, 270.0, 3.0, 0)
else
if spacetype[i2] == 5 then
set editdes[i2] = CreateDestructableZ('B003', ex[i2], ey[i2] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
set mod = i2-(i2/13)*13
if mod < 0 then
set mod = mod + 13
endif
if mod == 0 then
if pointbool then
if not antibool then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i2] + 64.0, wbminy, ex[i2] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
set pointbool = false
set antibool = false
endif
exitwhen i2 >= etotal
endloop
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
if stx == 0.0 and sty == 0.0 then
set stx = ex[195]
set sty = ey[200]
endif
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start")
return false
endif
exitwhen i >= i3
endloop
if buton == but[501] then
set mode = "training1"
if not GetStoredBoolean(cach, "status1", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 5.00)
endif
call SaveGameCache(cach)
call ClearRects()
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
loop
set i = i + 1
set i2 = GetRandomInt(1,8)
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
if i > 18 then
if ModuloInteger(i, 6) == 0 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
else
if i3 < 11 and i3 > 2 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-512.0, 512.0), ey[i4] + GetRandomReal(-256.0, 256.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 9.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-128.0, 128.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 171
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[502] then
set mode = "training2"
if not GetStoredBoolean(cach, "status2", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 10.00)
endif
call SaveGameCache(cach)
call ClearRects()
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(1,8)
loop
set i = i + 1
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
if i > 20 then
if ModuloInteger(i, 7) != 0 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
else
if i3 < 11 and i3 > 2 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-512.0, 512.0), ey[i4] + GetRandomReal(-256.0, 256.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 9.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-128.0, 128.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 56
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[503] then
set mode = "training3"
if not GetStoredBoolean(cach, "status3", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 13.50)
endif
call SaveGameCache(cach)
call ClearRects()
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
loop
set i = i + 1
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
if i > 19 then
if ModuloInteger(i, 4) == 0 then
if i3 == 1 then
if i2 != 1 then
set i2 = 1
else
set i2 = 8
endif
endif
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
else
if i3 < 11 and i3 > 2 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-512.0, 512.0), ey[i4] + GetRandomReal(-256.0, 256.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 9.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-128.0, 128.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 112
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[504] then
set mode = "training4"
if not GetStoredBoolean(cach, "status4", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 15.00)
endif
call SaveGameCache(cach)
call ClearRects()
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(2, 7)
if GetRandomInt(1, 100) <= 50 then
set ladderint = -1
else
set ladderint = 1
endif
loop
set i = i + 1
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
if i > 19 then
if ModuloInteger(i, 3) == 0 then
if i3 == 1 then
set i2 = i2 + ladderint
if i2 == 1 then
set ladderint = 1
elseif i2 == 8 then
set ladderint = -1
endif
endif
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
else
if i3 < 11 and i3 > 2 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-512.0, 512.0), ey[i4] + GetRandomReal(-256.0, 256.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 9.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-128.0, 128.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 128
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[505] then
set mode = "exam"
if not GetStoredBoolean(cach, "status5", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 50.00)
endif
call SaveGameCache(cach)
call ClearRects()
call EnumDestructablesInRect(wb, null, function ReDes)
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(2,7)
loop
set rdmint = GetRandomInt(2,4)
set i = i + rdmint
if rdmint != 1 then
if rdmint == 2 then
if i2 > 1 then
if i2 < 8 then
set i2 = i2 + GetRandomInt(-1,1)
else
set i2 = i2 + GetRandomInt(-1,0)
endif
else
set i2 = i2 + GetRandomInt(0,1)
endif
else
set i2 = GetRandomInt(1,8)
endif
endif
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if i3 > 1 and i3 < 11 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-3350.0, 3350.0), ey[i4] + GetRandomReal(-128.0, 128.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 7.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-64.0, 64.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
if i > 19 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == 13 then
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
endif
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 96
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[506] then
set mode = "exam"
if not GetStoredBoolean(cach, "status6", "training") then
call StoreReal(cach, "cash", "general", GetStoredReal(cach, "cash", "general") - 75.00)
endif
call SaveGameCache(cach)
call ClearRects()
call EnumDestructablesInRect(wb, null, function ReDes)
call DestroyTrigger(dead)
call DestroyTrigger(point)
set dead = CreateTrigger()
set point = CreateTrigger()
call TriggerAddAction(dead, function DeadActions)
call TriggerAddAction(point, function PointActions)
set i = 0
set i2 = GetRandomInt(2,7)
loop
set rdmint = GetRandomInt(1,4)
set i = i + rdmint
if rdmint != 1 then
if rdmint == 2 then
if i2 > 1 then
if i2 < 8 then
set i2 = i2 + GetRandomInt(-1,1)
else
set i2 = i2 + GetRandomInt(-1,0)
endif
else
set i2 = i2 + GetRandomInt(0,1)
endif
else
set i2 = GetRandomInt(1,8)
endif
endif
set i3 = 0
loop
set i3 = i3 + 1
set i4 =(i-1)*13+i3
if i3 > 1 and i3 < 11 then
if GetRandomInt(1, 100) < 5 then
set editdes[i4] = CreateDestructableZ(cloudvar[GetRandomInt(1,3)], ex[i4] + GetRandomReal(-3350.0, 3350.0), ey[i4] + GetRandomReal(-128.0, 128.0), -20.0, 270.0 + GetRandomReal(-35.0, 35.0), GetRandomReal(3.0, 7.0), 0)
endif
else
if i3 == 13 then
if GetRandomInt(1, 100) <= 35 then
set editdes[i4] = CreateDestructableZ('B003', ex[i4] + GetRandomReal(-64.0, 64.0), ey[i4] + 100.0, -35.0, 270.0, 5.0, 0)
endif
endif
endif
if i > 19 then
if i3 <= i2 or i3 >= i2 + 5 then
if i3 == 13 then
if editdes[i4] != null then
call RemoveDestructable(editdes[i4])
set editdes[i4] = null
endif
endif
if i3 == i2 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 180.0, 1.0, 0)
else
if i3 == i2 + 5 then
set editdes[i4] = CreateDestructableZ(pipevar[2], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
else
set editdes[i4] = CreateDestructableZ(pipevar[1], ex[i4], ey[i4], 350.0, 0.0, 1.0, 0)
endif
endif
set deadtotal = deadtotal + 1
set deadrect[deadtotal] = Rect(ex[i4] - 120.0, ey[i4] - 120.0, ex[i4] + 120.0, ey[i4] + 120.0)
call TriggerRegisterEnterRectSimple(dead, deadrect[deadtotal])
if i3 == 13 then
set pointtotal = pointtotal + 1
set pointrect[pointtotal] = Rect(ex[i4] + 64.0, wbminy, ex[i4] + 128.0, wbmaxy)
call TriggerRegisterEnterRectSimple(point, pointrect[pointtotal])
endif
endif
endif
exitwhen i3 >= 13
endloop
exitwhen i >= 96
endloop
set stx = ex[195]
set sty = ey[200]
call StoreInteger(cach, "score", "temporary", 0)
if restart then
call StoreInteger(cach, "restart", "general", GetStoredInteger(cach, "restart", "general") + 1)
endif
call SaveGameCache(cach)
set bird = CreateUnit(p, birdtype[GetStoredInteger(cach, "birdtype", "general")], stx, sty, 345.00)
call SetUnitPathing(bird, false)
call SetCameraTargetController(bird, 0.0, 0.0, false)
set gs = 0.0
set start = false
set jumpbool = false
set target = pointtotal
call SetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD, 0)
call ClearTextMessages()
call DisplayTextToPlayer(p, 0.0, 0.0, "Click anywhere to start. Pass requirement: |cffffff00" + I2S(pointtotal) + "|r scores.")
return false
endif
if buton == but[549] then
set page2 = page2 + 1
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Achievements|r|n|cffffffffWhite = Locked|r |cffffff00Yellow = Unlocked|r")
set i = (page2-1)*ipp
loop
set i = i + 1
if achiname[i] != null then
if GetStoredBoolean(cach, "ach" + I2S(i), "general") then
set but[550+i] = DialogAddButton( dia, "|cffffff00" + achiname[i] + "|r", 0 )
else
set but[550+i] = DialogAddButton( dia, "|cffffffff" + achiname[i] + "|r", 0 )
endif
endif
exitwhen i >= ipp*page2
endloop
if page2 < achitot/ipp + 1 then
set but[549] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]ext Page|r", 78 )
endif
if page2 > 1 then
set but[550] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00P|r|cffffffff]rev Page|r", 80 )
endif
if page2 == 1 or page2 == achitot/ipp + 1 then
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
endif
call DialogDisplay(p, dia, true)
return false
endif
if buton == but[550] then
set page2 = page2 - 1
call DialogClear(dia)
call DialogSetMessage(dia, "|cffffaa00 Achievements|r|n|cffffffffWhite = Locked|r |cffffff00Yellow = Unlocked|r")
set i = (page2-1)*ipp
loop
set i = i + 1
if achiname[i] != null then
if GetStoredBoolean(cach, "ach" + I2S(i), "general") then
set but[550+i] = DialogAddButton( dia, "|cffffff00" + achiname[i] + "|r", 0 )
else
set but[550+i] = DialogAddButton( dia, "|cffffffff" + achiname[i] + "|r", 0 )
endif
endif
exitwhen i >= ipp*page2
endloop
if page2 < achitot/ipp + 1 then
set but[549] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00N|r|cffffffff]ext Page|r", 78 )
endif
if page2 > 1 then
set but[550] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00P|r|cffffffff]rev Page|r", 80 )
endif
if page2 == 1 or page2 == achitot/ipp + 1 then
set but[8] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack to Menu|r", 66 )
endif
call DialogDisplay(p, dia, true)
return false
endif
set i = 550
loop
set i = i + 1
if buton == but[i] then
set si = i - 550
if si == achitot then
if not GetStoredBoolean(cach, "ach13", "general")then
set i2 = 0
loop
set i2 = i2 + 1
exitwhen not GetStoredBoolean(cach, "ach" + I2S(i2), "general")
if GetStoredBoolean(cach, "ach" + I2S(i2), "general") then
call StoreBoolean(cach, "ach13", "general", true)
call StoreBoolean(cach, "42", "boughtbird", true)
endif
endloop
endif
endif
call DialogClear(dia)
if GetStoredBoolean(cach, "ach" + I2S(si), "general") then
set s = "|cffffff00Unlocked|r"
else
set s = "|cffffffffLocked|r"
endif
call DialogSetMessage(dia, "|cffffffffTitle: " + achiname[si] + "|nDescription: " + achides[si] + "|nStatus: " + s)
set but[5] = DialogAddButton( dia, "|cffffffff[|r|cffffcc00B|r|cffffffff]ack|r", 66 )
call DialogDisplay(p, dia, true)
endif
exitwhen i>=550+achitot
endloop
return false
endfunction
function InitTrig_Dialog takes nothing returns nothing
local trigger t1 = CreateTrigger()
call TriggerRegisterDialogEvent(t1, dia)
call TriggerAddCondition(t1, Condition(function buttonclick))
set t1 = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Open_Actions takes nothing returns nothing
call PlayMusic("war3mapImported\\chicken dance ha ha.mp3")
call InitMenu()
endfunction
function InitTrig_Open takes nothing returns nothing
set gg_trg_Open = CreateTrigger()
call TriggerRegisterTimerEventSingle( gg_trg_Open, 0.00 )
call TriggerAddAction( gg_trg_Open, function Trig_Open_Actions )
endfunction