• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

GlobalEvent NPC looking directions TFS 1.x

Sir Islam

Never Give Up
Joined
Jun 6, 2008
Messages
504
Solutions
1
Reaction score
117
Location
Suez , Egypt
have fun :)

globalevents.xml

Code:
<globalevent name="npc positioning"  type="startup" script="npcpositioning.lua"/>

npcpositioning.lua
Code:
local npcPositions = {
    { position={x = 2005, y = 1999, z = 6}, direction=WEST },
    { position={x = 1994, y = 1993, z = 6}, direction=SOUTH },
    { position={x = 2005, y = 1993, z = 6}, direction=SOUTH },
    { position={x = 2005, y = 2004, z = 6}, direction=NORTH },
    { position={x = 1989, y = 1993, z = 6}, direction=SOUTH },
    { position={x = 1999, y = 2004, z = 6}, direction=NORTH },
    { position={x = 1993, y = 2004, z = 6}, direction=NORTH }

}
function onStartup()
    for _, mob in ipairs(npcPositions) do
        local tile = Tile(mob.position)
        if tile then
            local creature = tile:getTopCreature()
            if creature then
                creature:setDirection(mob.direction)
            end
        end
    end
    return true
end

Full credit goes to Acedayz
 
Last edited:
Back
Top