2015-02-20 12:26:09 +00:00
|
|
|
local global = require( "global" )
|
|
|
|
if(global.triggeredOpenDoor1 == nil) then
|
|
|
|
global.triggeredOpenDoor1 = false
|
2015-01-17 12:37:09 +00:00
|
|
|
end
|
|
|
|
function trigger(objectToChange)
|
2015-02-20 12:26:09 +00:00
|
|
|
if(global.triggeredOpenDoor1 == false) then
|
2015-01-17 12:37:09 +00:00
|
|
|
if(not level) then
|
|
|
|
print("No level found in Lua!")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2015-02-20 12:26:09 +00:00
|
|
|
if(not global.openDoorCounter) then
|
|
|
|
global.openDoorCounter = 0
|
2015-01-17 12:37:09 +00:00
|
|
|
end
|
2015-02-20 12:26:09 +00:00
|
|
|
global.openDoorCounter = global.openDoorCounter + 1
|
|
|
|
if (global.openDoorCounter == 3) then
|
2015-01-17 12:37:09 +00:00
|
|
|
local strength = 1
|
|
|
|
local xPos = 0
|
|
|
|
local yPos = 0
|
|
|
|
local zPos = 0
|
|
|
|
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
|
|
|
|
print("Opening the door")
|
|
|
|
end
|
2015-02-20 12:26:09 +00:00
|
|
|
global.triggeredOpenDoor1undo = false
|
2015-01-17 12:37:09 +00:00
|
|
|
|
2015-02-20 12:26:09 +00:00
|
|
|
global.triggeredOpenDoor1 = true
|
2015-01-17 12:37:09 +00:00
|
|
|
print("openDoor1")
|
|
|
|
end
|
|
|
|
end
|