Lua teleport coding
function MoveEntityToNode(entIn,pathIn,nodeIn)
if not entIn then
print("Warning!: Entity not specified for move")
return false
elseif not pathIn then
print("Warning!: Path not specified for Entity " .. entIn .. " move")
return false
end
local node
if nodeIn then
node = nodeIn
else
node = 0
end
local locDest = GetPathPoint(pathIn,node)
local charUnit = GetCharacterUnit(entIn)
local charVeh = GetCharacterVehicle(entIn)
if charVeh then
SetEntityMatrix(charVeh,locDest)
elseif charUnit then
SetEntityMatrix(charUnit,locDest)
return true
end
return false
end
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room1")
end,
"Room1Region"
)
ActivateRegion("Room1Region")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room0")
end,
"Room0Region"
)
ActivateRegion("Room0Region")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room5")
end,
"Room2Region"
)
ActivateRegion("Room2Region")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room3")
end,
"GotoRoom3"
)
ActivateRegion("GotoRoom3")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room1")
end,
"gotoroom1"
)
ActivateRegion("gotoroom1")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room4")
end,
"Gotoroom4"
)
ActivateRegion("Gotoroom4")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room0")
end,
"gotoroom0"
)
ActivateRegion("gotoroom0")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room1")
end,
"room1wall"
)
ActivateRegion("room1wall")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Room0")
end,
"room0wall"
)
ActivateRegion("room0wall")