Jump to content

[Quest] Anunciar a morte de TODOS os Boss


Luffy
 Share

Recommended Posts

Bom pessoal, aqui vou mostrar duas formas de anunciar a morte de todos os boss sem precisar fazer aquelas quests longas

Primeira forma:

Por padrão todos os Boss são do rank 4 e 5. A função npc.get_rank() obtêm o valor do rank deles, já a função npc.get_type() verifica qual o tipo de mob(Mobs normais e boss são tipo 0, NPCs são 1, metins 2  e portais 3. As pedras metins são rank 5 por padrão, por isso é necessário usar npc.get_type() == 0 ou npc.is_metin() == false

Caso não tenhas as funções npc.get_rank, npc.is_metin e npc.get_type, no final do tópico vai ter um tutorial de como adicioná-las.

Spoiler

quest anunciarmortedosboss begin
    state start begin
        when kill with not npc.is_pc() begin

--Você pode substituir o npc.get_type() == 0 por npc.is_metin() == false
            if npc.get_rank() == 5 and npc.get_type() == 0 or npc.get_rank() == 4 then
                notice_all(pc.get_name()..", derrotou "..mob_name(npc.get_race()))
            end
        end
    end    
end

Segunda Forma:

(ACREDITO SER BEM MAIS FÁCIL ASSIM)

Caso não tenha as função npc.is_boss no final do tópico tem um tutorial de como adicioná-los

Spoiler

quest anunciarmortedosboss begin
    state start begin
        when kill with not npc.is_pc() begin
            if npc.is_boss() == true then
                notice_all(pc.get_name()..", derrotou "..mob_name(npc.get_race()))
            end
        end
    end    
end

 

Adicionando npc.get_rank(), npc.get_type(), npc.is_metin() e npc.is_boss()

Vai na sua source em src/server/game e abra questlua_npc.cpp

e adicione isso lá

Spoiler

    int npc_get_rank(lua_State* L)
    {
        lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank());
        return 1;
    }  

 int npc_get_type(lua_State* L)
    {
        lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobTable().bType);
        return 1;
    }

    int npc_is_metin(lua_State* L)
    {
        lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->IsStone());
        return 1;
    }

    int npc_is_boss(lua_State* L)
    {
        lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank() == MOB_RANK_BOSS);
        return 1;
    }

 

Procure por   void RegisterNPCFunctionTable()

e adicione isso lá

Spoiler

            { "get_rank", npc_get_rank },
            { "get_type", npc_get_type },
            { "is_metin", npc_is_metin },
            { "is_boss", npc_is_boss },

depois adicione isso no quest_functions

npc.get_rank

npc.get_type

npc.is_metin

npc.is_boss

Edited by Luffy
Erro gramatical
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...