Code: Select all
oneWayTrigger(
x, y, z, -- for the floor_trigger
int_direction, -- direction *the party is traveling* it triggers on (0 - 3)
"script_id",
"mainFunc",
"resetFunc"
)
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Party",
onMove = function(party,dir,arg1)
somescript.script.printDir(dir)
end,
},
},
}
Code: Select all
function printDir(d)
print(d)
end
Code: Select all
function printDir(d)
-- Facing north
if party.facing == 0 then
if d == 0 then
print("forward")
elseif d == 1 then
print("right")
elseif d == 2 then
print("back")
else
print("left")
end
-- Facing east
elseif party.facing == 1 then
if d == 0 then
print("left")
elseif d == 1 then
print("forward")
elseif d == 2 then
print("right")
else
print("back")
end
-- Facing south
elseif party.facing == 2 then
if d == 0 then
print("back")
elseif d == 1 then
print("left")
elseif d == 2 then
print("forward")
else
print("right")
end
-- Facing west
elseif party.facing == 3 then
if d == 0 then
print("right")
elseif d == 1 then
print("back")
elseif d == 2 then
print("left")
else
print("forward")
end
end
end
Code: Select all
oneWayTrig(5,5,0, {0,1}, "a", "b", "c")