• 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!

Lua Stop NPC from moving

nanhut

New Member
Joined
Oct 17, 2016
Messages
7
Reaction score
0
How do i stop a NPC from moving? Is there a exclusive comand? Im rewriting my npc library and its needed because when it focus a player, it doesnt stop moving.
 
If you don't want the NPC to move at all, add this in the XML of the npc:
XML:
walkradius=0

Or you can search for `walkradius` in sources to figure out how to implement it to the server.

Provide server version and more info.
 
If you don't want the NPC to move at all, add this in the XML of the npc:
XML:
walkradius=0

Or you can search for `walkradius` in sources to figure out how to implement it to the server.

Provide server version and more info.

You know when the npc talks to a player, then he stops moving, he just stays where he is, freezed? Thats what i wanna know, if theres any code that would stop him from moving while talking to that player and when the player say bye he starts moving again.
 
You know when the npc talks to a player, then he stops moving, he just stays where he is, freezed? Thats what i wanna know, if theres any code that would stop him from moving while talking to that player and when the player say bye he starts moving again.
what if you try to add this when npc add focus
Lua:
doCreatureSetNoMove(getNpcId(), true)    -- Stop npc movement
and when you release focus you use this
Lua:
doCreatureSetNoMove(getNpcId(), false)    -- Start npc movement

Note: this could be used on older tfs versions (0.x) not sure if it work on newer tfs version
 
what if you try to add this when npc add focus
Lua:
doCreatureSetNoMove(getNpcId(), true)    -- Stop npc movement
and when you release focus you use this
Lua:
doCreatureSetNoMove(getNpcId(), false)    -- Start npc movement

Note: this could be used on older tfs versions (0.x) not sure if it work on newer tfs version

doCreatureSetNoMove seems to be working, but i dont have that getNpcId() function on the otserver.



Lua Script Error: [Npc interface]
data/npc/scripts/melchior.lua:eek:nThink

data/npc/scripts/melchior.lua:147: attempt to call global 'getNpcId' (a nil value)
stack traceback:
data/npc/scripts/melchior.lua:147: in function <data/npc/scripts/melchior.lua:144>
 
doCreatureSetNoMove seems to be working, but i dont have that getNpcId() function on the otserver.



Lua Script Error: [Npc interface]
data/npc/scripts/melchior.lua:eek:nThink

data/npc/scripts/melchior.lua:147: attempt to call global 'getNpcId' (a nil value)
stack traceback:
data/npc/scripts/melchior.lua:147: in function <data/npc/scripts/melchior.lua:144>
What tfs version are you using?

edit:
what if you change it to getNpcCid() instead of getNpcId()
seems like 1.x+ servers use that instead
 
Its avesta 0.63, i couldnt find the tfs version tho.
Avesta is not the same as theforgottenserver (tfs), i think avesta is based of the orginal otserv 0.6.3 dont quote me on that though.
Well since you did have the function to make creatures not move, all you need to do is to find a solution to find the Npc's id.
Im not to familiar whit Avesta or the orginal otserv distributions, and that devsite died a few years ago.
 
Avesta is not the same as theforgottenserver (tfs), i think avesta is based of the orginal otserv 0.6.3 dont quote me on that though.
Well since you did have the function to make creatures not move, all you need to do is to find a solution to find the Npc's id.
Im not to familiar whit Avesta or the orginal otserv distributions, and that devsite died a few years ago.
Is there any tfs for 7.62 or 7.72 server?
 
Back
Top