Jordan 22 Posted March 26, 2021 Share Posted March 26, 2021 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 Share on other sites More sharing options...
Contributor TMP4 10966 Posted March 26, 2021 Contributor Share Posted March 26, 2021 (edited) 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 March 26, 2021 by TMP4 1 Link to comment Share on other sites More sharing options...
Jordan 22 Posted March 28, 2021 Author Share Posted March 28, 2021 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 comment Share on other sites More sharing options...
Honorable Member Mali 41643 Posted March 28, 2021 Honorable Member Share Posted March 28, 2021 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 1 Link to comment Share on other sites More sharing options...
Jordan 22 Posted March 28, 2021 Author Share Posted March 28, 2021 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 comment Share on other sites More sharing options...
Premium Syreldar 1870 Posted March 28, 2021 Premium Share Posted March 28, 2021 (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 March 28, 2021 by Syreldar 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 Link to comment Share on other sites More sharing options...
Jordan 22 Posted March 29, 2021 Author Share Posted March 29, 2021 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 comment Share on other sites More sharing options...
Jordan 22 Posted March 31, 2021 Author Share Posted March 31, 2021 Would appreciate if someone can help me to do this only for a few items of a chest.. br Link to comment Share on other sites More sharing options...
Jordan 22 Posted April 2, 2021 Author Share Posted April 2, 2021 (edited) up - happy easter btw Edited April 2, 2021 by Jordan Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now