Lua Npc Spawn

Discussion in 'Support' started by God Of Pain, Jan 13, 2018.

  1. God Of Pain

    God Of Pain Member

    Joined:
    Aug 3, 2017
    Messages:
    129
    Likes Received:
    2
    Best Answers:
    2
    Code (Lua):
    1. Game.createNpc("Npc Name", Position(11111, 11111, 1), false, true)
    This script above create an npc, but the npc are walking on a big radius, someone know how to limit this like RME limiting the spawn radius?

    tfs 1.2
     
  2. Best Answer:
    Post #2 by silveralol, Jan 13, 2018
  3. silveralol

    silveralol Well-Known Member

    Joined:
    Mar 16, 2010
    Messages:
    1,434
    Likes Received:
    184
    Best Answers:
    6
    Best Answer
    Code (Text):
    1.  
    2. local pos = Position(x, y, z)
    3. local npc = Game.createNpc("Npc Name", pos, false, true)
    4. if npc then
    5.        npc:setMasterPos(pos)
    6. end
    7.  
     
    God Of Pain likes this.
  4. God Of Pain

    God Of Pain Member

    Joined:
    Aug 3, 2017
    Messages:
    129
    Likes Received:
    2
    Best Answers:
    2
    In this case, should be:

    Code (Lua):
    1. npc:setMasterPos(Position(33332, 32052, 7))
    right? thanks
     
  5. silveralol

    silveralol Well-Known Member

    Joined:
    Mar 16, 2010
    Messages:
    1,434
    Likes Received:
    184
    Best Answers:
    6
    could be too :)
     

Share This Page

Loading...