Jump to content

Recommended Posts

I'd like to make a quest, when any player receive item X from chest X to make an announcement. 

For example when the player get a poison sword from the death reaper chest.

Maybe someone already did something like that or know how to do it?

Link to comment
https://metin2.dev/topic/26263-quest-when-player-receive-item-from-chat/
Share on other sites

  • Contributor

So you want something like this?

when x.use begin
    local rnd = math.random(1,100)
    if rnd >= 75 then
        pc.give_item2(189, 1)
        notice_all(pc.get_name().." got a fancy sword!")
    elseif rnd >= 50 then
        pc.give_item2(149, 1)
        notice_all(pc.get_name().." got a semi-fancy sword!")
    else
        pc.give_item2(19, 1)
        notice_all(pc.get_name().." got a not so fancy sword!")
    end
    pc.remove_item("x", 1)
end

You have to set the chest to ITEM_QUEST in item_proto and set all the drop in the quest. 

If you don't want to use quest for the chest drop then the notice_all is not possible using just a quest, you have to do it in the game file's source in c++.

Edited by TMP4
  • Love 1
On 3/26/2021 at 9:42 AM, TMP4 said:

So you want something like this?


when x.use begin
    local rnd = math.random(1,100)
    if rnd >= 75 then
        pc.give_item2(189, 1)
        notice_all(pc.get_name().." got a fancy sword!")
    elseif rnd >= 50 then
        pc.give_item2(149, 1)
        notice_all(pc.get_name().." got a semi-fancy sword!")
    else
        pc.give_item2(19, 1)
        notice_all(pc.get_name().." got a not so fancy sword!")
    end
    pc.remove_item("x", 1)
end

You have to set the chest to ITEM_QUEST in item_proto and set all the drop in the quest. 

If you don't want to use quest for the chest drop then the notice_all is not possible using just a quest, you have to do it in the game file's source in c++.

Thanks for your reply.
Okay, since I don't want to do the drop via quest, I'll have to do it via source.
Can someone help me with an example how to do it please?

  • Honorable Member

Find:

					if (item_get)
					{
						bSuccess = true;
					}

Change:

					if (item_get)
					{
						bSuccess = true;
						const TItemTable* Chest = ITEM_MANAGER::instance().GetTable(dwGroupNum);
						if (Chest) {
							char szBuf[128];
							snprintf(szBuf, sizeof(szBuf), "%s receive %s from %s", GetName(), item_get->GetName(), Chest->szLocaleName);
							BroadcastNotice(szBuf);
						}
					}

char_item.cpp

  • Love 1

 

2 hours ago, Mali61 said:

Find:


					if (item_get)
					{
						bSuccess = true;
					}

Change:


					if (item_get)
					{
						bSuccess = true;
						const TItemTable* Chest = ITEM_MANAGER::instance().GetTable(dwGroupNum);
						if (Chest) {
							char szBuf[128];
							snprintf(szBuf, sizeof(szBuf), "%s receive %s from %s", GetName(), item_get->GetName(), Chest->szLocaleName);
							BroadcastNotice(szBuf);
						}
					}

char_item.cpp

Thank you!
How can I do it only if one or two special item are received out of the box?

  • Honorable Member
1 hour ago, Jordan said:

Thank you!
How can I do it only if one or two special item are received out of the box?

make some vectors of chests and items, then check it via item->GetVnum() and broadcast the notice if the item is one of the items of the chest you want to be noticed about when found.

Edited by Syreldar
  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

13 hours ago, Syreldar said:

make some vectors of chests and items, then check it via item->GetVnum() and broadcast the notice if the item is one of the items of the chest you want to be noticed about when found.

Thanks for your reply.
Could you give me an example please?

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.