int NpcScriptInterface::luaSetNpcFocus(lua_State* L) { //doNpcSetCreatureFocus(cid) Npc* npc = getScriptEnv()->getNpc(); if (npc) { npc->setCreatureFocus(getCreature(L, -1)); } return 0; }
int32_t NpcScriptInterface::luaSetNpcFocus(lua_State* L) { //doNpcSetCreatureFocus(cid) Npc* npc = getScriptEnv()->getNpc(); if (npc) { npc->setCreatureFocus(g_game.getCreatureByID(popNumber(L))); } return 0; }
int NpcScriptInterface::luaNpcSetFocus(lua_State* L) { // npc:setFocus(creature) Creature* creature = getCreature(L, 2); Npc* npc = getUserdata<Npc>(L, 1); if (npc) { npc->setCreatureFocus(creature); pushBoolean(L, true); } else { lua_pushnil(L); } return 1; }
int32_t NpcScriptInterface::luaSetNpcFocus(lua_State* L) { //doNpcSetCreatureFocus(cid) uint32_t cid = popNumber(L); ScriptEnvironment* env = getScriptEnv(); Npc* npc = env->getNpc(); if (npc) { npc->setCreatureFocus(g_game.getCreatureByID(cid)); } return 0; }
int NpcScriptInterface::luaSetNpcFocus(lua_State *L) { //doNpcSetCreatureFocus(cid) uint32_t cid = popNumber(L); ScriptEnviroment* env = getScriptEnv(); Npc* npc = env->getNpc(); if(npc){ Creature* creature = env->getCreatureByUID(cid); npc->setCreatureFocus(creature); } return 0; }
int NpcScriptInterface::luaSetNpcFocus(lua_State* L) { //setNpcFocus(cid) uint32_t cid = popNumber(L); ScriptEnviroment* env = getScriptEnv(); Npc* npc = env->getNpc(); if (npc) { Creature* creature = env->getCreatureByUID(cid); if (creature) { npc->setCreatureFocus(creature); } else { npc->focusCreature = 0; npc->setWalkDelay(std::time(unsigned(NULL)) + 5); } } return 1; }