Jump to content

Quest Event - Upgrade


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

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

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.