Jump to content

newja

Inactive Member
  • Posts

    52
  • Joined

  • Last visited

  • Days Won

    2
  • Feedback

    0%

Posts posted by newja

  1. M2 Download Center

    This is the hidden content, please
    ( 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 9
  2. He said that {item_id, count} doesn't work in his table.

     

    Solution is easy.

    local index =
                {   [1] = {1111, 5},
                    [2] = {2222, 4},
                    [3] = {3333, 3},
                }
     
    local idx = index[1]
    syschat("Item ID: ".. idx[1])
    syschat("Count: "..idx[2])
  3.  

    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

    • Love 1
  4. quest firstport begin
        state start begin
            when login with pc.getqf("first") == 0 begin
                table = {
                        [1] = {33493, 4994},
                        [2] = {xxxxx, xxxx},
                        [3] = {xxxxx, xxxx},
                        }
                index = table[pc.get_empire()]
                pc.warp(index[1], index[2])
                pc.setqf("first", 1)
            end
        end
    end
    • Love 1
  5. This heappens when I upgrade for the very first time.

    HEXkd.png

     

     

    Then, If I use again the same item.

    8Az1g.png

    After upgrade or /reload q? Happened to me after reload.

     

    If you want to get data from actual item such as vnum, bonuses, sockets or slot number (e.g. Upgraded sword from +0 to +1, now you get ID 10 instead of new ID 11, continue reading to change that) you have to change all this:
    quest::CQuestManager::instance().upgrade(GetPlayerID(), item);
    with this
    quest::CQuestManager::instance().upgrade(GetPlayerID(), pkNewItem);

     

    This fixed the problem.

    • Love 1
  6. If you want to trigger this event while upgrading with scroll you need to do following:
     
    Open char_item.cpp and search for this. Now add:
    quest::CQuestManager::instance().upgrade(GetPlayerID(), item);
     
    ########################################################
     
    If you want to get data from actual item such as vnum, bonuses, sockets or slot number (e.g. Upgraded sword from +0 to +1, now you get ID 10 instead of new ID 11, continue reading to change that) you have to change all this:
    quest::CQuestManager::instance().upgrade(GetPlayerID(), item);
    with this
    quest::CQuestManager::instance().upgrade(GetPlayerID(), pkNewItem);
     
    Forgot to mention but this event is called only when upgrade is succesfull.
     
    Regards,
    newja
    • Love 1
  7. Nice , But Can u make it like that?

     

    when xx.upgrade begin

    No need for that, you can use item.vnum in quest to see what was upgraded.

    Example

    when upgrade begin
        if item.vnum =< 19 and item.vnum >= 10 then
            syschat("Only 10-19 ID is checked")
        end
    end

    Also it's easier to use it with tables than copying 1000 times same phrase (xx.upgrade) with different item id, lol.

    • Love 1
  8. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Spoiler

    211837p6VJQL4.gif

     

    Open char_item.cpp and find:

    sys_log(0, "PayPee End %d", cost);

    after this add:

    quest::CQuestManager::instance().upgrade(GetPlayerID(), pkNewItem);

    Open quest.h and find:

    QUEST_ITEM_INFORMER_EVENT,

    after this add:

    QUEST_UPGRADE_EVENT,

    Open questnpc.cpp and find:

        bool NPC::OnItemInformer(PC& pc, unsigned int vnum)

    after this add:

        bool NPC::OnUpgrade(PC& pc, LPITEM item)
        {
            return HandleEvent(pc, QUEST_UPGRADE_EVENT);
        }

    Open questnpc.h and find:

    bool    OnItemInformer(PC& pc,unsigned int vnum);

    after this add:

    bool    OnUpgrade(PC& pc,LPITEM item);

    Open questmanager.cpp and find:

    m_mapEventName.insert(TEventNameMap::value_type("item_informer", QUEST_ITEM_INFORMER_EVENT));

    after this add:

    m_mapEventName.insert(TEventNameMap::value_type("upgrade", QUEST_UPGRADE_EVENT));

    now find:

    void CQuestManager::ItemInformer(unsigned int pc,unsigned int vnum)

    after this add:

        void CQuestManager::upgrade(unsigned int pc, LPITEM item)
        {
            PC * pPC;
     
            if ((pPC = GetPC(pc)))
            {
                if (!CheckQuestLoaded(pPC))
                    return;
     
                SetCurrentItem(item);
                m_mapNPC[QUEST_NO_NPC].OnUpgrade(*pPC,item);
            }
            else
                sys_err("QUEST no such pc id : %d", pc);
        }

    Open questmanager.h and find:

    void    ItemInformer(unsigned int pc, unsigned int vnum);

    after this add:

    void    upgrade(unsigned int pc, LPITEM item);

    Example Quest:

    when upgrade begin
    	vnum = item.vnum - 10
    	syschat("Sword+"..vnum.." >> Sword+"..vnum+1)
    end

     

    Regards,

    newja

    • Metin2 Dev 1
    • Good 1
    • Love 1
    • Love 11
  9. Someone know how to display the pet level in a "say" for example ?

     

    I tried to put : "say("Your pet is level" ..pet_level)" but it doesn't work.

    Have you defined pet_level?

    say("Your pet level: "..pc.getqf("pet_"..pc.getqf("pet_item").."_level"))

    If not, then try it.

    • Love 1
  10. Are you sure this work 100%?

    Because we already tried this and sometimes it works and sometimes not.

     

    There's such a mess in the code, I can't really tell if it's everything now but..

    go to char_battle.cpp and find:

    item->SetOwnership(ch);

    replace with this

                       if (CBattleArena::instance().IsBattleArenaMap(ch->GetMapIndex()) == false)
                            if (ch->IsPC())
                            {
                                item->SetOwnership(ch);
                            }
                            else if (ch->IsPet())
                            {
                                for (CPetSystem::TPetActorMap::iterator go = ch->GetPetSystem()->m_petActorMap.begin();go != ch->GetPetSystem()->m_petActorMap.end(); ++go)
                                {
                                    CPetActor* petActor = go->second;
                                    if (NULL != petActor)
                                    {
                                        LPCHARACTER own = petActor->GetOwner();
                                        if (own)
                                        {
                                            item->SetOwnership(own);
                                        }
                                    }
                                }
                            }

    or do as @Deucalion says, however its problem lies deeper than that.

     

    Regards,

    newja

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