Jump to content

Fix horse skills after changing horse riding position


Recommended Posts

  • Premium

There is a problem, when you change position of horse riding skill in playersettingsmodule, you cannot use horse skills. For me, the way skills work on the client side of thing is really dumb, but they went even furher. I don't understand why, client checks if player has a horse riding level from the fixed skill slot, not from skill info itself. 

Spoiler

.png

 

Without my fix, it goes like this:

Spoiler

.gif

With fix:

Spoiler

2022-07-22-12-53-42.gif

 

Actual fix:

Spoiler
// PythonPlayerInput.cpp

// find:
bool CPythonPlayer::__CanAttack()
{
	[...]
}

// Replace with:
extern const DWORD c_iSkillIndex_Riding;
bool CPythonPlayer::__CanAttack()
{
	if (__IsProcessingEmotion())
	{
		return false;
	}

	if (IsOpenPrivateShop())
		return false;

	if (IsObserverMode())
		return false;

	CInstanceBase* pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	DWORD dwSkillIndex = 0;
	GetSkillSlotIndex(c_iSkillIndex_Riding, &dwSkillIndex);
	if (pkInstMain->IsMountingHorse() && pkInstMain->IsNewMount() && (GetSkillGrade(dwSkillIndex) < 1 && GetSkillLevel(dwSkillIndex) < 11))
	{
		return false;
	}

	return pkInstMain->CanAttack();
}

// PythonPlayerSkill.cpp

// Find:
bool CPythonPlayer::__CanUseSkill()
{
	[...]
}

// Replace with:
extern const DWORD c_iSkillIndex_Riding;
bool CPythonPlayer::__CanUseSkill()
{
	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	if (IsObserverMode())
		return false;

	DWORD dwSkillIndex = 0;
	GetSkillSlotIndex(c_iSkillIndex_Riding, &dwSkillIndex);
	if (pkInstMain->IsMountingHorse() && (GetSkillGrade(dwSkillIndex) < 1 && GetSkillLevel(dwSkillIndex) < 20))
	{
		return false;
	}

	return pkInstMain->CanUseSkill();
}

 


 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 4
  • Good 5
  • Love 2

Hello,thanks for your share.While compile, i have this error: ERROR

 

Edited by Metin2 Dev
Core X - External 2 Internal

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

  • Premium
25 minutes ago, Jimmermania said:

Hello,thanks for your share.While compile, i have this error: ERROR

 

Because he doesn't know what's doing.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Think 1
  • Premium
1 hour ago, Jimmermania said:

Hello,thanks for your share.While compile, i have this error: ERROR

 

Check code, I missed one line

Edited by Metin2 Dev
Core X - External 2 Internal
  • Honorable Member

This is what I did some time ago:

DWORD GetHorseSkillSlotIndex()
{
	constexpr auto HorseSkillIndex = 130;
	static DWORD RequireSkillSlotIndex = 0;
	if (!RequireSkillSlotIndex)
		CPythonPlayer::Instance().FindSkillSlotIndexBySkillIndex(HorseSkillIndex, &RequireSkillSlotIndex);
	return RequireSkillSlotIndex;
}

bool CPythonPlayer::__CanUseSkill()
{
	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	if (IsObserverMode())
		return false;

	// Terrible skill slot index managament
	if (pkInstMain->IsMountingHorse() && (GetSkillGrade(GetHorseSkillSlotIndex()) < 1 && GetSkillLevel(GetHorseSkillSlotIndex()) < 20))
		return false;

	return pkInstMain->CanUseSkill();
}

bool CPythonPlayer::__CanAttack()
{
	if (__IsProcessingEmotion())
		return false;

	if (IsOpenPrivateShop())
		return false;

	if (IsObserverMode())
		return false;

	CInstanceBase* pkInstMain=NEW_GetMainActorPtr();
	if (!pkInstMain)
		return false;

	// Terrible skill slot index managament
	if (pkInstMain->IsMountingHorse() && pkInstMain->IsNewMount() && (GetSkillGrade(GetHorseSkillSlotIndex()) < 1 && GetSkillLevel(GetHorseSkillSlotIndex()) < 11))
		return false;

	return pkInstMain->CanAttack();
}

I haven't tested your solution, but using GetSkillSlotIndex should be better than FindSkillSlotIndexBySkillIndex.

Edited by martysama0134
  • Metin2 Dev 2
  • Good 1
  • Active+ Member

So, if I'm not mistaken, we can do that like the @martysama0134 said and we can add the DWORD GetHorseSkillSlotIndex() to PythonPlayer.h to make the function shared in CPythonPlayer class.

This is the hidden content, please

Edited by ReFresh
  • Metin2 Dev 38
  • Good 6
  • Love 12

I'll be always helpful!  😉

  • Honorable Member
5 minutes ago, ReFresh said:

So, if I'm not mistaken, we can do that like the @martysama0134 said and we can add the DWORD GetHorseSkillSlotIndex() to PythonPlayer.h to make the function shared in CPythonPlayer class.

Yes, if you want.

i've noticed that bug when i changed skill order.

its really pathetic to get information from the order. i was disabled that check because in these days you know people are using premium mounts and its formality to give them level 30 horse or check that info but as i said its my opinion.

btw as i remember required horse level for horse skill is 20.

thanks for share.

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.