Puzzle involving a route
Posted: Sat Oct 06, 2012 2:12 pm
I want to share my "wonderful" script (because it really saved me tons of work
), for a 'route' puzzle, like the... uhm, the secret on level 6 (I don't remember the name that secret has a name like roundabout or something like that) which you have to walk around some pillars in a certain way, and then some items (and a monster!) will spawn.
Since my route has almost 20 hidden pressure plate to be pressed in a certain order (I have to say this clearly, WITHOUT passing twice on a same spot, otherwise this script won't work), and doing them with
if pressupreplate0:isUp and counter:getvalue() == 0 then increment
if pressupreplate1:isUp and counter:getvalue() == 1 then increment, I used a index.
You need to call your plates like plate0, plate1, plate2 and so on. Place a counter, which I'll call counterRoute, and connect all the plates to the script to the function route().
The script is written in this way.
Of course, you can place some plates that they just reset your counterRoute. No deviations! 
I've omitted the check script (for my puzzle the player must press a button at the end of the route and see if it was done right), but I'm sure it's not a problem for you
Oh, the hard part is... naming correctly the plate (the first time I forgot to rename a plate... and I could not figure out why the script wasn't working
)
Since my route has almost 20 hidden pressure plate to be pressed in a certain order (I have to say this clearly, WITHOUT passing twice on a same spot, otherwise this script won't work), and doing them with
if pressupreplate0:isUp and counter:getvalue() == 0 then increment
if pressupreplate1:isUp and counter:getvalue() == 1 then increment, I used a index.
You need to call your plates like plate0, plate1, plate2 and so on. Place a counter, which I'll call counterRoute, and connect all the plates to the script to the function route().
The script is written in this way.
SpoilerShow
function route()
i = counterRoute:getValue()
if findEntity("plate"..i):isUp() then
counterRoute:reset()
else
counterRoute:increment()
end
end
function reset()
counterRoute:reset()
end
i = counterRoute:getValue()
if findEntity("plate"..i):isUp() then
counterRoute:reset()
else
counterRoute:increment()
end
end
function reset()
counterRoute:reset()
end
I've omitted the check script (for my puzzle the player must press a button at the end of the route and see if it was done right), but I'm sure it's not a problem for you
Oh, the hard part is... naming correctly the plate (the first time I forgot to rename a plate... and I could not figure out why the script wasn't working