Jump to content

[C++]Nova função npc.spawn_effect


juniorsilva
 Share

Recommended Posts

Bem não tenho muito o que falar sobre a função é basicamente a função usada nos pets apenas converti para npcs, então vamos lá para adicionar essa nova função na sua source vai precisar ir no arquivo game/src/questlua_npc.cpp e adicionar abaixo da função: "int npc_set_vid_damage_mul(lua_State* L)" essa nova função:

int npc_spawn_effect(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
	        if (npc != NULL)
        {
            if (npc->IsPC())
                return 0;
        }
	        if (lua_isstring(L, 1))
        {
            npc->SpecificEffectPacket(lua_tostring(L, 1));
        }
	        return 0;
    }

depois disso vá no void RegisterNPCFunctionTable() e no final abaixo da definição :

{ "dec_remain_hairdye_count",    npc_dec_remain_hairdye_count    },

Adicionar:

{ "spawn_effect",        npc_spawn_effect        },

Pronto, agora vamos para a quest:

quest spawn_effect begin
    state start begin
	    when 20095.chat."Test Spawn Effect" begin
        say("Olá quer testar minha nova função?")
        say("")
        local s = select("Sim","Não")
        if s == 2 then
            return
        end
        npc.spawn_effect("d:\\\\ymir work\\\\effect\\\\etc\\\\levelup_1\\\\level_up.mse")
    end
	    end
end

Resultado final:

1003_224137.jpg?1507081397

 

Bem isso é tudo pessoal, qualquer bug ou crash deixe uma mensagem no tópico.

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...