Ok I downloaded the file thinking it was going to be a Editor version, but it's a Dat file. It's good to see you can create stairs and a lift, but would have liked the Editor version rather than the Dat versionnichg wrote:Alright, I made a bit of a demo map with some stairs (and a model-less secret door to constrain movement) along with an elevator using a similar trick.
If you'd like, you can use my elevator script. I'm not sure it's the most optimal method, but it works well.Mysterious wrote:Ok I downloaded the file thinking it was going to be a Editor version, but it's a Dat file. It's good to see you can create stairs and a lift, but would have liked the Editor version rather than the Dat versionnichg wrote:Alright, I made a bit of a demo map with some stairs (and a model-less secret door to constrain movement) along with an elevator using a similar trick.(sigh)
Code: Select all
-------------
-- INIT
-------------
e_i = 0
e_j = 0
elevator:setWorldPositionY(0) --// make sure elevator is in place.
force_field_1:setWorldPositionY(-0.5) --// for the glowing floor effect.
force_field_1.controller:deactivate()
sound_1.sound:stop()
--//
function goUp()
--// The following makes it so you can't click the buttons once the ride has started
wall_button_3.clickable:setSize(vec(0,0,0))
wall_button_4.clickable:setSize(vec(0,0,0))
--
if dungeon_door_wooden_double_1.door:isOpen() then
dungeon_door_wooden_double_1.door:close()
delayedCall(self.go.id,2,"goUp")
return
end
if e_i < 9.0 then --// 9.0 is the WorldPositionY for elevation 3. Change this as needed.
force_field_1.controller:activate() --// Turn on glowing floor.
if not moving then
sound_1.sound:play("pushable_block_hover")
sound_1.sound:fadeIn(1)
sound_1.sound:setVolume(2.5)
sound_1.sound:setPitch(0.8) --// Makes it sound better, imo.
moving = true
end
elevator:setWorldPositionY(e_i)
party:setWorldPositionY(e_i)
force_field_1:setWorldPositionY(e_i-0.5)
party.party:shakeCamera(0.02,0.05)
e_i = e_i + 0.02
delayedCall(self.go.id,0.05,"goUp")
return
else
if moving then
playSound("wall_sliding_lock")
end
e_j = e_i
movinggate:setWorldPositionY(e_j)
elevator:setWorldPositionY(9) --// Make sure it's at the right spot.
party:setWorldPositionY(9) --// Ditto.
force_field_1:setWorldPositionY(8.5)
playSound("gate_open")
wall_button_3.clickable:setSize(vec(.25,.25,.25,0)) --// Allow pressing the buttons
wall_button_4.clickable:setSize(vec(.25,.25,.25,0)) --// again.
force_field_1.controller:deactivate() --// Turn off glowing floor.
moving = false
sound_1.sound:fadeOut(1)
gratingOpen()
end
end
--// The following function lowers the gate on the top level. This is optional, depending on your setup.
function gratingOpen()
if movinggate then
if e_j >= 5.5 then
movinggate:setWorldPositionY(e_j)
movinggate:setWorldPosition(28.5,e_j,33,0)
e_j = e_j - 0.05
delayedCall(self.go.id,0.05,"gratingOpen")
return
end
movinggate:destroy()
playSound("gate_lock")
end
end
--// ---------
--// The following function is very similar to goUp(), except this one goes down.
function goDown()
wall_button_3.clickable:setSize(vec(0,0,0))
wall_button_4.clickable:setSize(vec(0,0,0))
if not gateclosing then
playSound("gate_close")
gateclosing = true
end
if not movinggate then
spawn("dungeon_wall_grating",7,9,21,0,2,"movinggate")
end
e_j = movinggate:getWorldPositionY()
if e_j < 9 then
e_j = e_j + 0.1
movinggate:setWorldPositionY(e_j)
movinggate:setWorldPosition(28.5,e_j,33,0)
delayedCall(self.go.id,0.05,"goDown")
return
end
if not gateclosed then
playSound("gate_lock")
gateclosed = true
end
if e_i > 0 then
force_field_1.controller:activate()
if not moving then
sound_1.sound:play("pushable_block_hover")
sound_1.sound:fadeIn(1)
sound_1.sound:setVolume(2.5)
sound_1.sound:setPitch(0.8)
moving = true
end
elevator:setWorldPositionY(e_i)
party:setWorldPositionY(e_i)
force_field_1:setWorldPositionY(e_i-0.5)
party.party:shakeCamera(0.02,0.05)
e_i = e_i - 0.02
delayedCall(self.go.id,0.05,"goDown")
return
else
if moving then
playSound("wall_sliding_lock")
end
e_j = 9
movinggate:setWorldPositionY(e_j)
elevator:setWorldPositionY(0)
force_field_1:setWorldPositionY(-0.5)
party:setWorldPositionY(0)
wall_button_3.clickable:setSize(vec(.25,.25,.25,0))
wall_button_4.clickable:setSize(vec(.25,.25,.25,0))
gateclosed = false
gateclosing = false
moving = false
force_field_1.controller:deactivate()
sound_1.sound:fadeOut(1)
dungeon_door_wooden_double_1.door:open()
end
end