Jump to content
Maintenance : Final step ×

Get Monster Rank Function


Recommended Posts

  • Active+ Member

Hello Metin2 Dev Community.

I'm here to present a function to check and return the monster rank.

Spoiler
//File: questlua_npc.cpp

//Search for:
	int npc_get_level(lua_State * L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc ? npc->GetLevel() : 0);
		return 1;
	}

//Add after:
	int npc_get_rank(lua_State * L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc ? npc->GetMobRank() : 0);
		return 1;
	}

//Search for:
	{ "get_level",			npc_get_level			},

//Add after:
	{ "get_rank",			npc_get_rank			},

//Now in quest_functions add:
	npc.get_rank
      

//Here is a simple quest on how it works.
quest test begin
    state start begin
        when kill with npc.get_race() == 101 begin
            if npc.get_rank() == 4 then
                game.drop_item_with_ownership(19, 1)
            end
        end
    end
end

 


I'm creating my biolog that's why i had to create this function, i know there are other ways to do this but i decided to do it this way.
I'm sharing in case someone needs.

 

With best regards, Doose.

Edited by Doose
  • Metin2 Dev 1
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.