Jump to content
External pictures are being replaced... ×
×
×
  • Create New...
  • 0

Need help in Cpp function


danio475

Question

Hi guys I need to edit this funcion :

(Item.cpp) game src

	else if (GetWearFlag() & WEARABLE_UNIQUE)
	{
		if (ch->GetWear(WEAR_UNIQUE1))
			return WEAR_UNIQUE2;
		else
			return WEAR_UNIQUE1;
		
	}

I need just to add WEAR_UNIQUE3, and WEAR_UNIQUE4 because I want to expand Unique slots by sacrifice Ring slots, thanks for help ;) 

 

@@Edit somebody know how to edit it for 4 Unique slots?. Because without this game using only first two slots :v 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

solved by myself you have to define 16 if's with options to wear it's something like that :

 

	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;
	if (!ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;
	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;

 

 

There is a final function : 

else if (GetWearFlag() & WEARABLE_UNIQUE)
{
	if (!ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	if (!ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE1;
	
	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;
	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;
	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;
	if (ch->GetWear(WEAR_UNIQUE1) && !ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE2;

	
	
	if (ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE3;
	if (ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && !ch->GetWear(WEAR_UNIQUE3) && ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE3;
	
	if (ch->GetWear(WEAR_UNIQUE1) && ch->GetWear(WEAR_UNIQUE2) && ch->GetWear(WEAR_UNIQUE3) && !ch->GetWear(WEAR_UNIQUE4))
		return WEAR_UNIQUE4;

}

 

 

 

the result : https://zapodaj.net/e3415396a997f.jpg.html 

Link to comment
Share on other sites

  • 0
21 hours ago, danio475 said:

@Syreldar that's why I asked for help on dev... I'm a totally beginner in cpp and I just do that as I can... idk why you're so rude before edition

else if (GetWearFlag() & WEARABLE_UNIQUE)
	{
		int wear[4] = { WEAR_UNIQUE1, WEAR_UNIQUE2, WEAR_UNIQUE3, WEAR_UNIQUE4 };

		for (int i = 0; i <= 3; i++)
		{
			if (!ch->GetWear(wear[i]))
				break;
		}

		return wear[i];
	}

Didn't test but should work as well.

  • Love 1
Link to comment
Share on other sites

  • 0

@danio475 Where is scope of break in this loop?

You did a loop and check if not wear stop the loop without do nothing, so this loop not have sense.

	return wear[i];

You can't do that because "i" is not declared.

Should look like this what you say.

else if (GetWearFlag() & WEARABLE_UNIQUE)
{
	BYTE WEAR_EQ_LIST[4] = { 
		WEAR_UNIQUE1,	WEAR_UNIQUE2, 
		WEAR_UNIQUE3,	WEAR_UNIQUE4 
	};

	for (BYTE i=0; i<_countof(WEAR_EQ_LIST); i++)
	{
		BYTE bCell = WEAR_EQ_LIST[i];
		if (!ch->GetWear(bCell))
			return bCell;
	}
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

@Tasho

Thanks for reply i'll test your code but I have one question about mine version.

 

So, in my code is any (except tons of IF's ) problem? Like any bug, core downer or something? ;p I know it's write really bad but I always preffer to try find solution by myself, not only ask on dev or other boards for help ^^. Once again thanks for code

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.