Silver Sonitex 1438 Posted September 25, 2022 Silver Share Posted September 25, 2022 (edited) Yo! If you have an item with a limit type LIMIT_REAL_TIME_START_FIRST_USE that has been used at one point and put it inside the safe-box, it will not be removed from the game until you pull it out of the safe-box and perform a teleport. item.h // Search: protected: friend class CInputDB; // Add below: friend class CHARACTER; char.cpp // Search: void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems) { [...] if (!m_pkSafebox->Add(pItems->pos, item)) { M2_DESTROY_ITEM(item); } else item->SetSkipSave(false); // Modify to: if (!m_pkSafebox->Add(pItems->pos, item)) { M2_DESTROY_ITEM(item); } else { item->OnAfterCreatedItem(); item->SetSkipSave(false); } Edited September 28, 2022 by Sonitex 8 2 1 8 Link to comment Share on other sites More sharing options...
Thrall 183 Posted September 25, 2022 Share Posted September 25, 2022 Thank you for this fix Soni, good job. 1 Link to comment Share on other sites More sharing options...
Active Member ReFresh 2342 Posted September 25, 2022 Active Member Share Posted September 25, 2022 Thanks, but I'm not sure, if the bool should be there twice, but in another class. Is that correct? protected: friend class CInputDB; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE Ah, as I can see, the way above will cause error with overloaded variable. So, this way is correct? protected: friend class CInputDB; //FIX REAL TIME FIRST USE friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE But then I can remove the friend class CInputDB; or not? It will be used in both classes at the same time? Yeah, maybe dumb question, but for me it's not really clear from your tut. I'll be always helpful! Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted September 25, 2022 Author Silver Share Posted September 25, 2022 22 minutes ago, ReFresh said: Thanks, but I'm not sure, if the bool should be there twice, but in another class. Is that correct? Hidden Content protected: friend class CInputDB; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE Ah, as I can see, the way above will cause error with overloaded variable. So, this way is correct? protected: friend class CInputDB; //FIX REAL TIME FIRST USE friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE But then I can remove the friend class CInputDB; or not? It will be used in both classes at the same time? Yeah, maybe dumb question, but for me it's not really clear from your tut. That is correct but do not remove the other friend class as it is used for the same purpose just at a different item loading phase. Usually, I use [...] to indicate before/after code. 1 Link to comment Share on other sites More sharing options...
Premium WeedHex 635 Posted September 25, 2022 Premium Share Posted September 25, 2022 It was in my todo list, thank you very much for sharing your idea! 1 Link to comment Share on other sites More sharing options...
Premium imWelly 26 Posted September 27, 2022 Premium Share Posted September 27, 2022 thank you MrMagician for the fix Wdev 1 Link to comment Share on other sites More sharing options...
BadGrecee 4 Posted September 28, 2022 Share Posted September 28, 2022 protected: friend class CInputDB; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE m2dev>1 friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE m2dev>1 It throws an error while compiling. It has been stated here before. 330 Line : friend class CInputDB; bool OnAfterCreatedItem(); 334 Line: friend class CHARACTER; bool OnAfterCreatedItem(); 2 different classes, but it gives an error because it is used 2 times. 1 Link to comment Share on other sites More sharing options...
Premium TAUMP 842 Posted September 28, 2022 Premium Share Posted September 28, 2022 5 minutes ago, BadGrecee said: protected: friend class CInputDB; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE m2dev>1 friend class CHARACTER; bool OnAfterCreatedItem(); //FIX REAL TIME FIRST USE m2dev>1 It throws an error while compiling. It has been stated here before. 330 Line : friend class CInputDB; bool OnAfterCreatedItem(); 334 Line: friend class CHARACTER; bool OnAfterCreatedItem(); 2 different classes, but it gives an error because it is used 2 times. protected: friend class CInputDB; bool OnAfterCreatedItem(); friend class CHARACTER; bool OnAfterCreatedItem(); Link to comment Share on other sites More sharing options...
BadGrecee 4 Posted September 28, 2022 Share Posted September 28, 2022 (edited) 26 minutes ago, TAUMP said: protected: friend class CInputDB; bool OnAfterCreatedItem(); friend class CHARACTER; bool OnAfterCreatedItem(); What is the difference between what I added and what you changed? I sincerely apologize. I'm not saying that as a bad person. Same as the one I added. or i have a problem with my eyes Not: The same error continues. item.h:333:9: error: 'bool CItem::OnAfterCreatedItem()' cannot be overloaded wit h 'bool CItem::OnAfterCreatedItem()' bool OnAfterCreatedItem(); ^~~~~~~~~~~~~~~~~~ item.h:330:9: note: previous declaration 'bool CItem::OnAfterCreatedItem()' bool OnAfterCreatedItem(); ^~~~~~~~~~~~~~~~~~ gmake: *** [Makefile:198: .obj/char_item.o] Error 1 Edited September 28, 2022 by BadGrecee or i have a problem with my eyes :) Link to comment Share on other sites More sharing options...
Premium TAUMP 842 Posted September 28, 2022 Premium Share Posted September 28, 2022 3 minutes ago, BadGrecee said: What is the difference between what I added and what you changed? I sincerely apologize. I'm not saying that as a bad person. Same as the one I added. or i have a problem with my eyes Not: The same error continues. item.h:333:9: error: 'bool CItem::OnAfterCreatedItem()' cannot be overloaded wit h 'bool CItem::OnAfterCreatedItem()' bool OnAfterCreatedItem(); ^~~~~~~~~~~~~~~~~~ item.h:330:9: note: previous declaration 'bool CItem::OnAfterCreatedItem()' bool OnAfterCreatedItem(); ^~~~~~~~~~~~~~~~~~ gmake: *** [Makefile:198: .obj/char_item.o] Error 1 My bad then protected: friend class CInputDB; friend class CHARACTER; bool OnAfterCreatedItem(); Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted September 28, 2022 Author Silver Share Posted September 28, 2022 Edited the tutorial because it required too much brain power to comprehend it. #nohate 11 1 Link to comment Share on other sites More sharing options...
Active Member Ulas 172 Posted November 27, 2022 Active Member Share Posted November 27, 2022 On 9/25/2022 at 1:42 PM, Sonitex said: Yo! If you have an item with a limit type LIMIT_REAL_TIME_START_FIRST_USE that has been used at one point and put it inside the safe-box, it will not be removed from the game until you pull it out of the safe-box and perform a teleport. item.h // Search: protected: friend class CInputDB; // Add below: friend class CHARACTER; char.cpp // Search: void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems) { [...] if (!m_pkSafebox->Add(pItems->pos, item)) { M2_DESTROY_ITEM(item); } else item->SetSkipSave(false); // Modify to: if (!m_pkSafebox->Add(pItems->pos, item)) { M2_DESTROY_ITEM(item); } else { item->OnAfterCreatedItem(); item->SetSkipSave(false); } Can you add video before/after please. Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted November 27, 2022 Author Silver Share Posted November 27, 2022 42 minutes ago, Ulas said: Can you add video before/after please. Create an item that can expire, put it in the safe-box and wait for it to expire, which it won't until you teleport or put in the inventory. 1 Link to comment Share on other sites More sharing options...
Recommended Posts