Hi
As known, NPC selfFollow works ONLY if we set a player to be a target. What I mean? I mean, if I use selfFollow, NPC will be following only a player, but not a creature which we wish to be following.
Due to this I fixed it yesterday:
npc.cpp
Find:
Add below:
Find:
Add below (as a new function of course):
npc.h
Find:
Add below:
Compile it and done.
Then you shall use selfFollowCreature(cel) instead of selfFollow(cel)
Tested with TFS 0.3 for 8.42.
As known, NPC selfFollow works ONLY if we set a player to be a target. What I mean? I mean, if I use selfFollow, NPC will be following only a player, but not a creature which we wish to be following.
Due to this I fixed it yesterday:
npc.cpp
Find:
Code:
lua_register(m_luaState, "selfFollow", NpcScriptInterface::luaActionFollow);
Add below:
Code:
lua_register(m_luaState, "selfFollowCreature", NpcScriptInterface::luaActionFollowCreature);
Find:
Code:
int32_t NpcScriptInterface::luaActionFollow(lua_State* L)
Add below (as a new function of course):
Code:
int32_t NpcScriptInterface::luaActionFollowCreature(lua_State* L)
{
//selfFollowCreature(cid)
ScriptEnviroment* env = getScriptEnv();
Creature* creature = env->getCreatureByUID(popNumber(L));
Npc* npc = env->getNpc();
if(!creature)
{
lua_pushboolean(L, false);
return 1;
}
if(!npc)
{
lua_pushboolean(L, false);
return 1;
}
lua_pushboolean(L, npc->setFollowCreature(creature, true));
return 1;
}
npc.h
Find:
Code:
static int32_t luaActionFollow(lua_State* L);
Add below:
Code:
static int32_t luaActionFollowCreature(lua_State* L);
Compile it and done.
Then you shall use selfFollowCreature(cel) instead of selfFollow(cel)
Tested with TFS 0.3 for 8.42.
Last edited: