Updated scripts and added scripts for opening the door in Level1
This commit is contained in:
parent
04df8bd22f
commit
10017bb855
16
Levels/scripts/Template.lua
Normal file
16
Levels/scripts/Template.lua
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
if(triggeredSCRIPTNAME == nil) then
|
||||||
|
triggeredSCRIPTNAME = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredSCRIPTNAME == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--enter the scripts code here and replace all occurences of SCRIPTNAME with the name of the script.
|
||||||
|
|
||||||
|
triggeredSCRIPTNAME = true
|
||||||
|
print("SCRIPTNAME")
|
||||||
|
end
|
||||||
|
end
|
@ -7,10 +7,6 @@ function trigger(objectToChange)
|
|||||||
print("No level found in Lua!")
|
print("No level found in Lua!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if(not physics) then
|
|
||||||
print("No physics found in Lua!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
level:deleteObject(objectToChange)
|
level:deleteObject(objectToChange)
|
||||||
triggeredDeleteObject = true
|
triggeredDeleteObject = true
|
||||||
print("deleteObject")
|
print("deleteObject")
|
||||||
|
@ -7,10 +7,6 @@ function trigger(objectToChange)
|
|||||||
print("No level found in Lua!")
|
print("No level found in Lua!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if(not physics) then
|
|
||||||
print("No physics found in Lua!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
a = level:getObjectCount()
|
a = level:getObjectCount()
|
||||||
rand = math.random(0, a - 1)
|
rand = math.random(0, a - 1)
|
||||||
level:deleteObject(rand)
|
level:deleteObject(rand)
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
function trigger(objectToChange)
|
|
||||||
if(not level) then
|
|
||||||
print("No level found in Lua!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if(not physics) then
|
|
||||||
print("No physics found in Lua!")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if(not openDoorCounter) then
|
|
||||||
openDoorCounter = 0
|
|
||||||
end
|
|
||||||
openDoorCounter = openDoorCounter + 1
|
|
||||||
|
|
||||||
if (openDoorCounter == 3) then
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
28
Levels/scripts/openDoor1.lua
Normal file
28
Levels/scripts/openDoor1.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if(triggeredOpenDoor1 == nil) then
|
||||||
|
triggeredOpenDoor1 = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor1 == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(not openDoorCounter) then
|
||||||
|
openDoorCounter = 0
|
||||||
|
end
|
||||||
|
openDoorCounter = openDoorCounter + 1
|
||||||
|
if (openDoorCounter == 3) then
|
||||||
|
local strength = 1
|
||||||
|
local xPos = 0
|
||||||
|
local yPos = 0
|
||||||
|
local zPos = 0
|
||||||
|
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
|
||||||
|
print("Opening the door")
|
||||||
|
end
|
||||||
|
triggeredOpenDoor1undo = false
|
||||||
|
|
||||||
|
triggeredOpenDoor1 = true
|
||||||
|
print("openDoor1")
|
||||||
|
end
|
||||||
|
end
|
19
Levels/scripts/openDoor1undo.lua
Normal file
19
Levels/scripts/openDoor1undo.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
if(triggeredOpenDoor1undo == nil) then
|
||||||
|
triggeredOpenDoor1undo = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor1undo == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(triggeredOpenDoor1) then
|
||||||
|
openDoorCounter = openDoorCounter - 1
|
||||||
|
triggeredOpenDoor1 = false
|
||||||
|
end
|
||||||
|
|
||||||
|
triggeredOpenDoor1undo = true
|
||||||
|
print("openDoor1undo")
|
||||||
|
end
|
||||||
|
end
|
28
Levels/scripts/openDoor2.lua
Normal file
28
Levels/scripts/openDoor2.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if(triggeredOpenDoor2 == nil) then
|
||||||
|
triggeredOpenDoor2 = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor2 == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(not openDoorCounter) then
|
||||||
|
openDoorCounter = 0
|
||||||
|
end
|
||||||
|
openDoorCounter = openDoorCounter + 1
|
||||||
|
if (openDoorCounter == 3) then
|
||||||
|
local strength = 1
|
||||||
|
local xPos = 0
|
||||||
|
local yPos = 0
|
||||||
|
local zPos = 0
|
||||||
|
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
|
||||||
|
print("Opening the door")
|
||||||
|
end
|
||||||
|
triggeredOpenDoor2undo = false
|
||||||
|
|
||||||
|
triggeredOpenDoor2 = true
|
||||||
|
print("openDoor2")
|
||||||
|
end
|
||||||
|
end
|
19
Levels/scripts/openDoor2undo.lua
Normal file
19
Levels/scripts/openDoor2undo.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
if(triggeredOpenDoor2undo == nil) then
|
||||||
|
triggeredOpenDoor2undo = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor2undo == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(triggeredOpenDoor2) then
|
||||||
|
openDoorCounter = openDoorCounter - 1
|
||||||
|
triggeredOpenDoor2 = false
|
||||||
|
end
|
||||||
|
|
||||||
|
triggeredOpenDoor2undo = true
|
||||||
|
print("openDoor2undo")
|
||||||
|
end
|
||||||
|
end
|
28
Levels/scripts/openDoor3.lua
Normal file
28
Levels/scripts/openDoor3.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if(triggeredOpenDoor3 == nil) then
|
||||||
|
triggeredOpenDoor3 = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor3 == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(not openDoorCounter) then
|
||||||
|
openDoorCounter = 0
|
||||||
|
end
|
||||||
|
openDoorCounter = openDoorCounter + 1
|
||||||
|
if (openDoorCounter == 3) then
|
||||||
|
local strength = 1
|
||||||
|
local xPos = 0
|
||||||
|
local yPos = 0
|
||||||
|
local zPos = 0
|
||||||
|
level:moveObject(objectToChange, strength, xPos, yPos, zPos)
|
||||||
|
print("Opening the door")
|
||||||
|
end
|
||||||
|
triggeredOpenDoor3undo = false
|
||||||
|
|
||||||
|
triggeredOpenDoor3 = true
|
||||||
|
print("openDoor3")
|
||||||
|
end
|
||||||
|
end
|
19
Levels/scripts/openDoor3undo.lua
Normal file
19
Levels/scripts/openDoor3undo.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
if(triggeredOpenDoor3undo == nil) then
|
||||||
|
triggeredOpenDoor3undo = false
|
||||||
|
end
|
||||||
|
function trigger(objectToChange)
|
||||||
|
if(triggeredOpenDoor3undo == false) then
|
||||||
|
if(not level) then
|
||||||
|
print("No level found in Lua!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if(triggeredOpenDoor3) then
|
||||||
|
openDoorCounter = openDoorCounter - 1
|
||||||
|
triggeredOpenDoor3 = false
|
||||||
|
end
|
||||||
|
|
||||||
|
triggeredOpenDoor3undo = true
|
||||||
|
print("openDoor3undo")
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user