コード例 #1
0
ファイル: npc.cpp プロジェクト: marksamman/forgottenserver
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;
}
コード例 #2
0
ファイル: npc.cpp プロジェクト: EnzzoCaaue/forgottenserver
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;
}
コード例 #3
0
ファイル: npc.cpp プロジェクト: Codex-NG/avesta74
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;
}