New guy with a scripting issue
Posted: Thu May 16, 2013 2:32 pm
Hey
So I've just started working on my first dungeon for Grimrock and I've encountered a problem I was hopping you guys would be able to help me with. The puzzle I'm working on has five levers. The first four activate a different teleporter each, but when the fifth lever is activated I want the first four levers to activate a different teleporter. Also, I want only one teleporter to be active at a time. Also there is a altar at the end containing a blue gem, and when that gem is moved, I do not want the teleporters to work anymore. To accomplish that I've added "counter_puzzle_challenge_2_1" that the first four levers increment when activated, and decrements when deactivated.
So far I've got this code:
It's simplified for one lever right now, and if possible (and practical) I'd like to have one script to run all the levers. I *think* that the code is fine (basically teaching myself Lua on the go) as it doesn't return any errors, but I can't get the levers to call the function. If anyone has any idea how to fix this, I'd love the help
Thanks
PS. I apologize that I cant seem to get the spacing right on the code so here's a screen shot
http://steamcommunity.com/profiles/7656 ... reenshots/
So I've just started working on my first dungeon for Grimrock and I've encountered a problem I was hopping you guys would be able to help me with. The puzzle I'm working on has five levers. The first four activate a different teleporter each, but when the fifth lever is activated I want the first four levers to activate a different teleporter. Also, I want only one teleporter to be active at a time. Also there is a altar at the end containing a blue gem, and when that gem is moved, I do not want the teleporters to work anymore. To accomplish that I've added "counter_puzzle_challenge_2_1" that the first four levers increment when activated, and decrements when deactivated.
So far I've got this code:
SpoilerShow
function Puzzlechallenge_2_1 ()
for item in altar_puzzle_challenege_2:containedItems() do
if item.name == "blue_gem" then
if lever_puzzle_2_1:getLeverState() == "activated" and counter_puzzle_challenge_2_1:getValue() < "2" then
if lever_puzzle_2_s:getLeverState() == "deactivated" then
teleporter_puzzle2_1_1:activate()
teleporter_puzzle2_1_2:deactivate()
teleporter_puzzle2_1_3:deactivate()
teleporter_puzzle2_1_4:deactivate()
else
teleporter_puzzle2_1_1:deactivate()
teleporter_puzzle2_1_2:deactivate()
teleporter_puzzle2_1_3:deactivate()
teleporter_puzzle2_1_4:deactivate()
end
else
counter_puzzle_challenge_2_1:increment()
end
end
end
end
for item in altar_puzzle_challenege_2:containedItems() do
if item.name == "blue_gem" then
if lever_puzzle_2_1:getLeverState() == "activated" and counter_puzzle_challenge_2_1:getValue() < "2" then
if lever_puzzle_2_s:getLeverState() == "deactivated" then
teleporter_puzzle2_1_1:activate()
teleporter_puzzle2_1_2:deactivate()
teleporter_puzzle2_1_3:deactivate()
teleporter_puzzle2_1_4:deactivate()
else
teleporter_puzzle2_1_1:deactivate()
teleporter_puzzle2_1_2:deactivate()
teleporter_puzzle2_1_3:deactivate()
teleporter_puzzle2_1_4:deactivate()
end
else
counter_puzzle_challenge_2_1:increment()
end
end
end
end
Thanks
PS. I apologize that I cant seem to get the spacing right on the code so here's a screen shot
http://steamcommunity.com/profiles/7656 ... reenshots/