Jump to content

Recommended Posts

  • Active+ Member
This is the hidden content, please

Alternative download links →

This is the hidden content, please

Hello Metin2 Dev.
I'm here to present a Premium System.

How does it work?

  • Once use item, player gets Permanent Premium.
  • Since this is V1, it only allows the player to expand the bravery cape.
  • Premium shows it's activated on above left corner.
  • Players can only activate Premium on certain maps (I chose City 1 of each kingdom, but you can choose other).

In case of any problem, report here and i'll fix it.

  • Metin2 Dev 136
  • Eyes 4
  • Think 1
  • Confused 1
  • Scream 1
  • Good 21
  • Love 4
  • Love 82
Link to comment
Share on other sites

Using FindAffect is always bad. You have to make a bool variable for this.

Example:

User

case 31052: The variable in AddAffect in char_affect.cpp is returned true when it uses its object.

For example: SetPremiumAffect(true)

When the Effect is Deleted into the RemoveAffect in char_affect.cpp

For example: SetPremiumAffect(false)

When the player exits the game and re-enters the LoadAffect in char_affect.cpp

For example: SetPremiumAffect(true)

When you want to query the effect

if (GetPremiumAffect()) {
This effect is already used.
return false
}

Example2 :

if (GetPremiumAffect()) {
//If there is an effect, run the codes.

}

Never Use FindAffect It Always Shits The Server.

Edited by BadRomani
Link to comment
Share on other sites

3 minutes ago, Th1Doose said:

Thanks for the comment, i'll give it a check!

Example:

char.h

 

public:
	bool				GetAttractRangerFindAffect() { return m_iAttractRangerFindAffect; }
	void				SetAttractRangerFindAffect(bool affect) { m_iAttractRangerFindAffect = affect; }

protected:
	bool				m_iAttractRangerFindAffect;


char_item.cpp

 

			case 72000:
			{
				if (GetAttractRangerFindAffect())
				{
					ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DONT_USE"));
					return false;
				}

				AddAffect(AFFECT_CALL_ARCHER, POINT_NONE, 0, AFF_NONE, item->GetValue(0), 0, true);
				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Archers can now come to you."));

				item->SetCount(item->GetCount() - 1);
			}
			break;

 

char.cpp

 

	m_iAttractRangerFindAffect = false;

affect.h
 

	AFFECT_CALL_ARCHER						 = 757,

 

char_affect.cpp

LoadAffect

 

		if (AFFECT_CALL_ARCHER == pElements->dwType)
		{
			SetAttractRangerFindAffect(true);
		}

AddAffect
 

	if (dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(true);
	}


RemoveAffect

 

	if (pkAff->dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(false);
	}

 

How should the condition be?

 

				if (GetAttractRangerFindAffect())
					AttractRanger();

 

  • Facepalm 1
Link to comment
Share on other sites

  • Active+ Member
8 hours ago, BadRomani said:

Example:

char.h

 

public:
	bool				GetAttractRangerFindAffect() { return m_iAttractRangerFindAffect; }
	void				SetAttractRangerFindAffect(bool affect) { m_iAttractRangerFindAffect = affect; }

protected:
	bool				m_iAttractRangerFindAffect;


char_item.cpp

 

			case 72000:
			{
				if (GetAttractRangerFindAffect())
				{
					ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DONT_USE"));
					return false;
				}

				AddAffect(AFFECT_CALL_ARCHER, POINT_NONE, 0, AFF_NONE, item->GetValue(0), 0, true);
				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Archers can now come to you."));

				item->SetCount(item->GetCount() - 1);
			}
			break;

 

char.cpp

 

	m_iAttractRangerFindAffect = false;

affect.h
 

	AFFECT_CALL_ARCHER						 = 757,

 

char_affect.cpp

LoadAffect

 

		if (AFFECT_CALL_ARCHER == pElements->dwType)
		{
			SetAttractRangerFindAffect(true);
		}

AddAffect
 

	if (dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(true);
	}


RemoveAffect

 

	if (pkAff->dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(false);
	}

 

How should the condition be?

 

				if (GetAttractRangerFindAffect())
					AttractRanger();

 

I studied your code and now i'm going to re-apply it to my system, thanks!

Link to comment
Share on other sites

  • Active+ Member
On 6/5/2023 at 5:18 PM, BadRomani said:

Example:

char.h

 

public:
	bool				GetAttractRangerFindAffect() { return m_iAttractRangerFindAffect; }
	void				SetAttractRangerFindAffect(bool affect) { m_iAttractRangerFindAffect = affect; }

protected:
	bool				m_iAttractRangerFindAffect;


char_item.cpp

 

			case 72000:
			{
				if (GetAttractRangerFindAffect())
				{
					ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DONT_USE"));
					return false;
				}

				AddAffect(AFFECT_CALL_ARCHER, POINT_NONE, 0, AFF_NONE, item->GetValue(0), 0, true);
				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Archers can now come to you."));

				item->SetCount(item->GetCount() - 1);
			}
			break;

 

char.cpp

 

	m_iAttractRangerFindAffect = false;

affect.h
 

	AFFECT_CALL_ARCHER						 = 757,

 

char_affect.cpp

LoadAffect

 

		if (AFFECT_CALL_ARCHER == pElements->dwType)
		{
			SetAttractRangerFindAffect(true);
		}

AddAffect
 

	if (dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(true);
	}


RemoveAffect

 

	if (pkAff->dwType == AFFECT_CALL_ARCHER)
	{
		SetAttractRangerFindAffect(false);
	}

 

How should the condition be?

 

				if (GetAttractRangerFindAffect())
					AttractRanger();

 

I tested it and i see a little problem with this. Everytime you restart the character you can reactivate the item. Which is caused by char.cpp.

Quote

    m_iAttractRangerFindAffect = false;

Link to comment
Share on other sites

On 6/8/2023 at 2:28 PM, Th1Doose said:

I tested it and i see a little problem with this. Everytime you restart the character you can reactivate the item. Which is caused by char.cpp.

If you activate the effect and this effect is loaded in affect.sql (for example: Effect ID: 300), each time the character exits the game and re-enters, affect.sql will be triggered again in the LoadAffect function. So if there is 300 effect ID in affect.sql, this variable returns the correct value again. and if your value is correct in checkpoints

For example:

if(GetTrue())
   work();

I have been using the system for a long time. It's never been a problem. Please check LoadAffect.

 

Example:

LoadAffect(....,....,...)

SetEffect(true);

RemoveAffect(....,....,...)
 

SetEffect(false);

condition/use

if(GetEffect()) {
  You already have this effect.

return false;

}

OR

if(GetEffect()) {

  InitStartFunction();}


 

Edited by BadRomani
  • Love 1
Link to comment
Share on other sites

Announcements



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