Jump to content
×
×
  • Create New...

Quest Function - pc.get_exp_data()


Recommended Posts

M2 Download Center

Download Here ( Internal )

Introduction & Small explaination

 

https://www.youtube.com/watch?v=RbhBA1Ko4x8

 

As you can see in the video, this function stores XP amount of the last killed mob.

Variable is reseted every time you login into the game (including warps).

 

##### HowTo #####

Spoiler

######## Open char.h and paste this in public class ########

Spoiler

int    GivenExpData;
int    GetExpData() const {return GivenExpData;}


######## Open char.cpp and find ########

Spoiler
void CHARACTER::Initialize()

Somewhere inside add this

GivenExpData = 0;


######## Open char_battle.cpp and find ########

Spoiler
to->PointChange(POINT_EXP, iExp, true);

 
make a new line and add

to->GivenExpData = iExp;


######## Open questlua_pc.cpp and add this function ########

Spoiler
int pc_get_exp_data(lua_State * L)
{
    lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetExpData());
    return 1;
}

 
Somewhere at the end of RegisterPCFunctionTable paste

{"get_exp_data", pc_get_exp_data},


######## Test Quest ########
(notice that this version isn't the same as showed in the video)

Spoiler
quest exp begin
state start begin
    when kill with !npc.is_pc() begin
        chat(pc.get_exp_data().." EXP "..mob_name(npc.get_race()))
    end
end
end

 
Example of printed message (when you kill a mob)

999 EXP Wild Dog
  • Metin2 Dev 1
  • Love 8
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

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


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.