int NpcScriptInterface::luaActionFollow(lua_State* L) { //selfFollow(player) Npc* npc = getScriptEnv()->getNpc(); if (!npc) { pushBoolean(L, false); return 1; } pushBoolean(L, npc->setFollowCreature(getPlayer(L, 1))); return 1; }
int32_t NpcScriptInterface::luaActionFollow(lua_State* L) { //selfFollow(cid) uint32_t cid = popNumber<uint32_t>(L); Player* player = g_game.getPlayerByID(cid); if (cid != 0 && !player) { pushBoolean(L, false); return 1; } Npc* npc = getScriptEnv()->getNpc(); if (!npc) { pushBoolean(L, false); return 1; } pushBoolean(L, npc->setFollowCreature(player)); return 1; }
int NpcScriptInterface::luaActionFollow(lua_State* L) { //selfFollow(cid) uint32_t cid = popNumber(L); ScriptEnviroment* env = getScriptEnv(); Player* player = env->getPlayerByUID(cid); if(cid != 0 && !player){ lua_pushboolean(L, false); return 1; } Npc* npc = env->getNpc(); if(!npc){ lua_pushboolean(L, false); return 1; } bool result = npc->setFollowCreature(player, true); lua_pushboolean(L, result); return 1; }