Code: Select all
function dreamscapeEntry()
if not teleCheck.canTeleport() then return false end
if party.level == 16 then
hudPrint("You are already in the Dreamfields... ")
return
end
if dreamblocker then dreamblocker:destroy() end
if talismanblocker then talismanblocker:destroy() end
local d = findEntity("dreamEntrytimer")
local p = timers:find("timer_preservation")
local i = timers:find("timer_isolation")
if (d ~= nil and p:isActivated() == true) and (i ~= nil and i:isActivated() == true) then
blinkgateScript.severGate()
spawn("blocker", party.level, party.x, party.y, party.facing, "dreamblocker")
:activate()
party:wakeUp(false)
party:setPosition(2, 1, 2, 16)
playSoundAt("teleport",party.level,party.x,party.y,0)
party:playScreenEffect("cold_glow_bless")
hudPrint("You have entered the Dream Fields... ")
else
hudPrint("You can't seem to shift over to the dreaming world...")
end
if d then d:destroy() end
end
function frostcapsleep(item, champion)
if timers:find("frostcapsleeptimer") ~= nil then
timers:find("frostcapsleeptimer"):destroy()
end
hudPrint("The frozen mushroom makes you all feel very drowsy....")
timers:create("frostcapsleeptimer")
:setTimerInterval(8)
:setConstant()
:addConnector("activate", "dreamscapeScript", "sleepCap")
:activate()
return true
end
function sleepCap(t)
t:destroy()
local d = timers:find("dreamEntrytimer")
if d then d:destroy() end
local p = timers:find("timer_preservation")
local i = timers:find("timer_isolation")
hudPrint("The frozen mushroom puts you all into a deep sleep....")
if p == nil or i == nil then
party:rest()
else
spawn("timer", party.level, party.x, party.y, party.facing, "dreamEntrytimer")
:setTimerInterval(5)
:addConnector("activate", "dreamscapeScript", "dreamscapeEntry")
:activate()
party:rest()
end
end
function returnfromDream()
if party.level == 16 and not wakeTimer then
if talismanblocker then
spawn("timer", party.level, party.x, party.y, party.facing, "wakeTimer")
:setTimerInterval(5)
:addConnector("activate", "dreamscapeScript", "wake1")
:activate()
elseif dreamblocker then
spawn("timer", party.level, party.x, party.y, party.facing, "wakeTimer")
:setTimerInterval(5)
:addConnector("activate", "dreamscapeScript", "wake2")
:activate()
end
end
return true
end
-- so canceling sleep doesn't screw everything up
function onWakeUp()
if dreamEntryTimer then dreamEntryTimer:destroy() end
if wakeTimer then wakeTimer:destroy() end
end
function wake1()
if party.level == 16 then
local t = findEntity("talismanblocker")
if not t then return end
party:wakeUp(false)
party:setPosition(t.x, t.y, t.facing, t.level)
playSound("teleport")
party:playScreenEffect("cold_glow_bless")
hudPrint("You awaken back into the Labyrinth...")
t:destroy()
end
end
function wake2()
if party.level == 16 then
local b = findEntity("dreamblocker")
if not b then return end
party:wakeUp(false)
party:setPosition(b.x, b.y, b.facing, b.level)
playSound("teleport")
party:playScreenEffect("cold_glow_bless")
hudPrint("You awaken back into the Labyrinth...")
b:destroy()
end
end
function dreamweaverEntry(item, champion)
if not teleCheck.canTeleport() then return false end
if party.level == 16 then
hudPrint("You cannot invoke the Talisman to enter The Dreamfields if you are already here...")
else
blinkgateScript.severGate()
if talismanblocker then talismanblocker:destroy() end
spawn("blocker", party.level, party.x, party.y, party.facing, "talismanblocker")
:activate()
party:setPosition(4, 25, 2, 16)
playSoundAt("teleport",party.level,party.x,party.y,0)
party:playScreenEffect("cold_glow_bless")
hudPrint("The Dreamweavers return again...")
end
return false
end
function severGate()
local b = talismanblocker or dreamblocker
if b then
party:setPosition(b.x, b.y, b.facing, b.level)
b:destroy()
hudPrint("You are jolted back to the waking world.")
end
end