Advertisement
dalvorsn

Untitled

Apr 2nd, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. function getNpcSpawnPosByName(nameNpc)
  2.         local map = getConfigValue("mapName")
  3.         local mapName = map:gsub(".otbm", "")
  4.         local spawn_xml = io.open(getDataDir().."/world/"..mapName.."-spawn.xml"):read(-1):close())
  5.         local strFind = "(%s+)<spawn centerx=\"(%d+)\" centery=\"(%d+)\" centerz=\"(%d+)\" radius=\"(%d+)\">(%s+)<npc name=\""..name.."\" x=\"(%d+)\" y=\"(%d+)\" z=\"(%d+)\" spawntime=\"(%d+)\"/>\(%s+)</spawn>"
  6.         local _,centerx, centery, centerz, radius,_, x, y, z, spawntime,_ = spawn_xml:match(strFind)
  7.         local pos = {x = centerx + x, y = centery+y, z - centerz + z}
  8.         return pos
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement