示例#1
0
int NpcScriptInterface::luaSetNpcFocus(lua_State* L)
{
    //doNpcSetCreatureFocus(cid)
    Npc* npc = getScriptEnv()->getNpc();
    if (npc) {
        npc->setCreatureFocus(getCreature(L, -1));
    }
    return 0;
}
示例#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;
}
示例#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;
}
示例#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;
}
示例#5
0
文件: npc.cpp 项目: cp1337/devland
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;
}
示例#6
0
文件: npc.cpp 项目: Codex-NG/avesta74
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;
}