Jump to content

Enable/disable on dews and permanent items by adding time.


Recommended Posts

Hi guys, as you know there are some "systems" which lets you enable and disable the dew, but the problem is that it creates a new dew, which is not "blend". Does any have knowledge how to make the normal dews, to have the "elixir" effect without using those new "dews" which are not item_blend type? like enable/disable? (those 50821-50826).

 

 

 

And also, any idea how did rubinum managed to make the pet thing (adding 1 day of life till 200 when it becomes permanent)? the function 199-permanent itself it's interesting how did the make that it automatically goes permanent instead of x time while using same pet.

 

thanks in advance if any would share the 'secrets'

Link to comment
Share on other sites

  • Premium

I think this should do it for the permanent dews (char_item.cpp):

		case ITEM_BLEND:
			// 새로운 약초들
			sys_log(0,"ITEM_BLEND!!");
			if (Blend_Item_find(item->GetVnum()))
			{
				int		affect_type		= AFFECT_BLEND;
				int		apply_type		= aApplyInfo[item->GetSocket(0)].bPointType;
				int		apply_value		= item->GetSocket(1);
				// int		apply_duration	= item->GetSocket(2);

				if (FindAffect(affect_type, apply_type))
				{
					if (item->GetSocket(2) == 1)
					{
						RemoveAffectBlend(affect_type, apply_type);
						item->SetSocket(2, 0);
						item->Lock(0);
					}
					else
					{
						ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이미 효과가 걸려 있습니다."));
					}
				}
				else
				{
					AddAffect(affect_type, apply_type, apply_value, 0, 60*60*60*60*60*365, 0, false);
					item->Lock(1);
					item->SetSocket(2, 1);
				}
			}
			break;

uiInventory.py -> before: self.wndItem.RefreshSlot() add:

			if itemVnum >= 50821 and itemVnum <= 50826:
				metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(3)]
				isActivated = 0 != metinSocket[2]
				if isActivated:
					self.wndItem.ActivateSlot(i)
				else:
					self.wndItem.DeactivateSlot(i)

 

  • Love 1
Link to comment
Share on other sites

  • Premium
5 hours ago, Itachi said:

Do not use that.
It is badly done.

And why it is badly done may i ask? 
He can use the “shish kebab” version if he wants to or yours. The code above is doing the same thing without the icons on the top left corner. Why you never made your code public on this community tho? 

Edited by Anix
Link to comment
Share on other sites

  • Premium
5 hours ago, Itachi said:

Do not use that.
It is badly done.

 

It doesn't matter, unless the code is flawed in some way (memory leaks/no checks on pointers/etc) your point is invalid.

He is trying to change the way a system of a 2004 game works. Rewriting the 10 lines of code that system is made of like a pro won't make up for the hundreds of thousands of lines written by monkeys 16 years ago.

 

If it does the job well, then it's fine.

Edited by Syreldar

 

"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

@Anix can't really compile because of that

						RemoveAffectBlend(affect_type, apply_type);

it says that is undefined. 

 

Anyway i don't want them to be always permanent, i just want them to be enabled and disabled even if they are just for 10 minutes as they were made by ymir, but if anyone knows and could help with that, the thing i said, adding time on an item would make it to go permanent at some point, then the permanent dews are fine :D 

 

where should i define it, i don't really know much about coding and stuff like that, i tried to do something on char.h but it's not what it should be ^^ 

 

 

Also, Itachi, any better idea then? :blush:

Edited by raNNNNNk
Link to comment
Share on other sites

  • Premium

Why bother with rewriting a whole system when you can create a new item and make it add and remove affect upon using it. If it is active, set socket(0) to 1 and edit the function that handles active/unactive effect in the inventory and taskbar, you can copy most of it since it is the same for elixirs.

 

For the pet permanent functionality: when you reach 200 days cancel the real time event on the item and add a check so it never starts again if the item has 200 days or more. On the client side modify the code to hide the remaining time if the item has more than 200 days remaning.

 

I hope I could help you :).

Link to comment
Share on other sites

I managed to get them to be enabled and disabled, but the problem is as following: if i enable them , i get the correct value for the selected time, like in the following gif

 

https://metin2.download/picture/18lC1AGWQ24WnCMC6QK3w1bEI7vSZ7Po/.gif

 

the problem is that the dews can be combined and get more time, like this https://metin2.download/picture/q8AqU4Xg6mhel2yE9q5tT3s8d4JP229b/.gif

 

but if i click on a 20minutes let's say, i get the affect (20% critical) for 20minutes, but the dew remains the same (for 20 minutes), if i disable (or the time runs down by itself), still 20 minutes, i need it to countdown the time that it gets used, for now they're somewhat permanent which is not what i want, i need them to expire after the time is gone.

 

 

Like let's say, the alchemy, as long as it is active, the time goes down, otherwise it keeps the time, but on alchemy there is TIMER_BASED_ON_WEAR on proto, and the blends are not like this.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 1
Link to comment
Share on other sites

		case ITEM_BLEND:

			// 새로운 약초들
			sys_log(0,"ITEM_BLEND!!");
			if (Blend_Item_find(item->GetVnum()))
			{
				int		affect_type		= AFFECT_BLEND;
				int		apply_type		= aApplyInfo[item->GetSocket(0)].bPointType;
				int		apply_value		= item->GetSocket(1);
				int		apply_duration	= item->GetSocket(2);
				CAffect* pAffect = FindAffect(affect_type, apply_type);

				if (FindAffect(affect_type, apply_type))
				{
					if (item->GetSocket(2))
					{
						RemoveAffect(pAffect);
						item->Lock(false);
					}
					else
					{
						ChatPacket(CHAT_TYPE_INFO, "Isi face deja efectul.");
					}
				}
				else
				{
					AddAffect(affect_type, apply_type, apply_value, 0, apply_duration, 0, false);
					item->Lock(true);
				}
			}
			break;

that's how the case looks for now, i guess there need a little modification so that the time will go down when enabled, then paused when disabled.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.