so one of my tricks is a not-so-long corridor that has to be walked-through backwards, otherwise - well, just copy and paste to check for yourselves.
Backwards might be a wrong word here, what I mean is that player has to turn around and start clicking "S"
First the layout:
All hidden pressure plates, first and last runs the tpCleanUp() function
other plates run teleportBack() function.
Now, the code (feel free to modify/change/correct yada-yada ):
Note: This has been set to be passable going backwards from W to E.
Code: Select all
tp_index = 1
function teleportBack()
if party.facing ~= 3 then
x = party.x
y = party.y
l = party.level
f = party.facing
if findEntity("tp3_"..tp_index-1) then
tpCleanUp()
end
hudPrint("Huh ?")
spawn("teleporter",l,x,y,f,"tp3_"..tp_index)
findEntity("tp3_"..tp_index):setInvisible(false)
findEntity("tp3_"..tp_index):setHideLight(true)
findEntity("tp3_"..tp_index):setSilent(true)
findEntity("tp3_"..tp_index):setScreenFlash(false)
findEntity("tp3_"..tp_index):setSilent(true)
findEntity("tp3_"..tp_index):setTriggeredByParty(true)
findEntity("tp3_"..tp_index):setTeleportTarget(x-1,y,f,l)
tp_index = tp_index + 1
else
tpCleanUp()
end
end
function tpCleanUp()
if findEntity("tp3_"..tp_index-1) then
findEntity("tp3_"..tp_index-1):destroy()
end
end