How To Write A Room Prog That Allows Disallows Movement

Main.HowToWriteARoomProgThatAllowsDisallowsMovement History

Hide minor edits - Show changes to output

January 19, 2009, at 11:55 PM EST by admin
Changed line 4 from:
if mobexists("area-1",getroom("area-1")) then
to:
if mobexists("area-1",getroom("area-1")) then
Changed line 7 from:
else
to:
else
Changed line 11 from:
end
to:
end
January 19, 2009, at 11:53 PM EST by Rezit
Changed lines 1-11 from:
Test
to:
The old way of doing things was to create a mob that stopped your travel in certain directions. With Lua, you can utilize room programs to stop players from moving in certain directions. It's tricky because you have to think of all the possible character combinations that a player might use to get to a room. Keep that in mind when you're editing the room. For example, up could be 'u', 'up', or 'go up' and all three commands need to be considered when creating the room progs.


if mobexists("area-1",getroom("area-1")) then
movechar(ch,"area-2")
--- In this example, nothing is outputted to the character, but they just go up.
else
self = ch
echo(ch.name .. " tries to climb up the tree, but breaks a branch.",ch)
send(ch,"The tree is really young, there is nothing to hold onto really.")
end
January 19, 2009, at 11:48 PM EST by Rezit
Added line 1:
Test