Jump to content

How works connections in C++


Recommended Posts

Hi, someonke can explain me how works the connections like this:

		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L,npc ? npc->GetHP() : 0);

*EXAMPLE: this go to questmanager.cpp, choose the npc and get the hp from mob_proto

 

Where is defined the GetHp() from a npc/mob?

 

and why if i put

		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L,npc ? npc->GetExp() : 0);

the GetExp() doesnt work?

 

I want learn how works, i want learn more about c++.

 

Thanks.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

  • Premium

idk but maybe like that :

    int npc_get_hp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
        
        lua_pushnumber(L, npc->GetHPPct());
        return 1;
    }

 

 this is a quest function for get the hp !

If you're going to do something, then do it right.

Link to comment
Share on other sites

idk but maybe like that :

    int npc_get_hp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
        
        lua_pushnumber(L, npc->GetHPPct());
        return 1;
    }

 this is a quest function for get the hp !

oh i think u dont understand what i mean, i have this function working , but i wanna know how work the function.

 

I make the GetExp() and doesnt work, and why¿¿¿??? i dont know, but i want know what do the

 LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();

and

npc->GetHPPct()

where is this defined?

Link to comment
Share on other sites

  • Premium

will i dont know c++ anyway

 

https://metin2.download/picture/Dej0vMg7QsKZFUpRKn69U8226ms6OgPT/.png

 

+ i think for the exp :

 

    int npc_get_exp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
         
        lua_pushnumber(L, npc->GetExp());
        return 1;
    }

 

i dont think it's will work anyway !becous npc dont have exp !

Edited by Metin2 Dev
Core X - External 2 Internal

If you're going to do something, then do it right.

Link to comment
Share on other sites

will i dont know c++ anyway

 

https://metin2.download/picture/Dej0vMg7QsKZFUpRKn69U8226ms6OgPT/.png

 

+ i think for the exp :

    int npc_get_exp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
         
        lua_pushnumber(L, npc->GetExp());
        return 1;
    }

i dont think it's will work anyway !becous npc dont have exp !

yep u have right but the mobs yes, how can get the exp of one mob when i kill him?

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

 

will i dont know c++ anyway

 

https://metin2.download/picture/Dej0vMg7QsKZFUpRKn69U8226ms6OgPT/.png

 

+ i think for the exp :

    int npc_get_exp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
         
        lua_pushnumber(L, npc->GetExp());
        return 1;
    }

i dont think it's will work anyway !becous npc dont have exp !

yep u have right but the mobs yes, how can get the exp of one mob when i kill him?

 

Well, you can't.

It's calculated by the GiveExp function.

 

Where is defined GetHP()

 

char.h

fr8B5qP.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

 

 

will i dont know c++ anyway

 

https://metin2.download/picture/Dej0vMg7QsKZFUpRKn69U8226ms6OgPT/.png

 

+ i think for the exp :

    int npc_get_exp(lua_State* L)
    {
        CQuestManager& q = CQuestManager::instance();
        LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
         
        lua_pushnumber(L, npc->GetExp());
        return 1;
    }

i dont think it's will work anyway !becous npc dont have exp !

yep u have right but the mobs yes, how can get the exp of one mob when i kill him?

 

Well, you can't.

It's calculated by the GiveExp function.

 

Thanks, now i know how works the exp.

 

But how works the connections?

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



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