Jump to content
  • 0

Quest - when player receive item from chat


Jordan

Question

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 post

8 answers to this question

Recommended Posts

  • 0

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
Link to post
  • 0
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?

Link to post
  • 0
  • 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

🌛

Link to post
  • 0
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?

Link to post
  • 0
  • Developer
Posted (edited)
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

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to post
  • 0
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?

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



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