Jump to content

REAL_TIME_FIRST_USE items not being expired in the safe-box


Recommended Posts

  • Active Member

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 by Sonitex
  • Metin2 Dev 8
  • Good 2
  • Love 1
  • Love 8
  • Active+ Member

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!  😉

  • Active Member
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.

  • Metin2 Dev 1
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.

 

  • Lmao 1
  • Premium
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();

 


 

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 by BadGrecee
or i have a problem with my eyes :)
  • Premium
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();

 


 

  • 1 month later...
  • Active Member
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.

  • Active Member
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.

  • Love 1

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.