Exemplo n.º 1
0
int NpcScriptInterface::luaSetNpcFocus(lua_State* L)
{
    //doNpcSetCreatureFocus(cid)
    Npc* npc = getScriptEnv()->getNpc();
    if (npc) {
        npc->setCreatureFocus(getCreature(L, -1));
    }
    return 0;
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
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;
}
Exemplo n.º 6
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;
}