Jump to content

Recommended Posts

For Acce you have to enabled in motion in 2  files.

ActorInstanceAttach.cpp in function  CActorInstance::AttachAcce insert this code at the end of the function.

	if (CGrannyLODController* pLODController = m_LODControllerVector[CRaceData::PART_ACCE])
	{
		if (CGrannyModelInstance* pWeaponModelInstance = pLODController->GetModelInstance())
		{
			CGraphicThing* pItemGraphicThing = pItemData->GetModelThing();
			if (std::shared_ptr<CGrannyMotion> pItemMotion = pItemGraphicThing->GetMotionPointer(0))
			{
				pWeaponModelInstance->SetMotionPointer(pItemMotion);
			}
		}
	}

https://metin2.download/picture/gQvc4889g7IDu1d4mkKV439kWUkEPC5p/.png

and the  ThingInstance.cpp in function CGraphicThingInstance::SetMotion you have to add 

case CRaceData::PART_ACCE:

https://metin2.download/picture/HB3r8PlsvrJj2Jd5Q722hhwSPV3788gG/.png

I hope i can help, before this you have to add all of the tutorial part. 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 19
  • Dislove 2
  • Not Good 2
  • Confused 2
  • Good 9
  • Love 4
  • Love 13

giphy.gif

Best regards, Arlinamid

  • 2 weeks later...
  • 3 months later...

I baked everything in a .rar file. Control it and if you want you can add  to your thread.

If you do not agree with this, I delete the link on metin2dev and keep it to myself.

This is the hidden content, please
 (Download)

included are the codes of: arlinamid & Distraught

Please check the files and check whether they are correct. I took everything from the thread and didn't add anything new. I am not responsible for any damage to your server.

 

Edited by Ace
add wings, change the style of text presentation.
  • Metin2 Dev 122
  • Dislove 1
  • Sad 1
  • Think 1
  • Good 31
  • Love 4
  • Love 51
  • 1 month later...
  • Management

I keep getting this error in Debug mode:

7otFd8t.png

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
	assert(CheckMotionIndex(iMotion)); //line 131

	if (iMotion >= m_pgrnFileInfo->AnimationCount)
		return NULL;

	if (m_motions.empty())
		return NULL;

	return m_motions.at(iMotion);
}

Any idea?

Thank you

Edited by Metin2 Dev
Core X - External 2 Internal

raw

raw

  • Premium
On 9/24/2021 at 5:30 PM, Karbust said:

I keep getting this error in Debug mode:

7otFd8t.png

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
	assert(CheckMotionIndex(iMotion)); //line 131

	if (iMotion >= m_pgrnFileInfo->AnimationCount)
		return NULL;

	if (m_motions.empty())
		return NULL;

	return m_motions.at(iMotion);
}

Any idea?

Thank you

There is an error message because the weapon has no animation.

 

try:

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
	if (!CheckMotionIndex(iMotion))
		return nullptr;

	if (m_motions.empty())
		return nullptr;

	return m_motions.at(iMotion);
}

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

c++latest, latest libs...

  • Management
3 hours ago, flatik said:

There is an error message because the weapon has no animation.

 

try:

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
	if (!CheckMotionIndex(iMotion))
		return nullptr;

	if (m_motions.empty())
		return nullptr;

	return m_motions.at(iMotion);
}

 

I just made it like this, since it only throws the assert on DEBUG...

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
#ifdef _DEBUG
	if (!CheckMotionIndex(iMotion))
		return NULL;
#else
	assert(CheckMotionIndex(iMotion));
#endif

	if (iMotion >= m_pgrnFileInfo->AnimationCount)
		return NULL;

	if (m_motions.empty())
		return NULL;

	return m_motions.at(iMotion);
}

 

raw

raw

  • Honorable Member
8 hours ago, Karbust said:

I just made it like this, since it only throws the assert on DEBUG...

std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion)
{
#ifdef _DEBUG
	if (!CheckMotionIndex(iMotion))
		return NULL;
#else
	assert(CheckMotionIndex(iMotion));
#endif

	if (iMotion >= m_pgrnFileInfo->AnimationCount)
		return NULL;

	if (m_motions.empty())
		return NULL;

	return m_motions.at(iMotion);
}

 

Asserts are only compiled in debug builds anyway. Putting that extra check there only in debug mode and not even asserting is the worst case. It just hides errors during the development process but they can appear on live.

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

  • 3 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 3 weeks later...

Hello,

 

I'm facing an error when trying to compile the binary (VS 22) after following this guide. I've searched and searched for a solution but, my knowledge here is very limited to none.

Here is ActorInstanceAttach.cpp (only the block modified following this guide): https://pastebin.com/hEsyTbrz

Here is the error: https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

What am I doing wrong? (The binary compiled without problems before applying the modifications)

 

Thanks!

 

Edit: Solved. For anyone else who haves the error above, just add

This in ActorInstanceAttach.cpp:

			if (std::shared_ptr<CGrannyMotion> pItemMotion = pItemGraphicThing->GetMotionPointer(0))

instead of:

		if (CGrannyMotion* pItemMotion = pItemGraphicThing->GetMotionPointer(0))

 (from the part wrote by Distraught)

Works like a charm.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
  • 4 weeks later...
  • 4 weeks later...
On 3/26/2021 at 8:55 AM, arlinamid said:

For Acce you have to enabled in motion in 2  files.

ActorInstanceAttach.cpp in function  CActorInstance::AttachAcce insert this code at the end of the function.

	if (CGrannyLODController* pLODController = m_LODControllerVector[CRaceData::PART_ACCE])
	{
		if (CGrannyModelInstance* pWeaponModelInstance = pLODController->GetModelInstance())
		{
			CGraphicThing* pItemGraphicThing = pItemData->GetModelThing();
			if (std::shared_ptr<CGrannyMotion> pItemMotion = pItemGraphicThing->GetMotionPointer(0))
			{
				pWeaponModelInstance->SetMotionPointer(pItemMotion);
			}
		}
	}

https://metin2.download/picture/gQvc4889g7IDu1d4mkKV439kWUkEPC5p/.png

and the  ThingInstance.cpp in function CGraphicThingInstance::SetMotion you have to add 

case CRaceData::PART_ACCE:

https://metin2.download/picture/HB3r8PlsvrJj2Jd5Q722hhwSPV3788gG/.png

I hope i can help, before this you have to add all of the tutorial part. 

 

no working for me

26 minutes ago, razor93 said:

 

no working for me

sloved :

 

 ActorInstanceAttach.cpp:

if (std::shared_ptr<CGrannyMotion> pItemMotion = pItemGraphicThing->GetMotionPointer(0))

change:

if (CGrannyMotion* pItemMotion = pItemGraphicThing->GetMotionPointer(0))

Spoiler

Edited by Metin2 Dev
Core X - External 2 Internal
On 11/30/2020 at 7:47 PM, Distraught said:
if (CGrannyLODController* pLODController = m_LODControllerVector[dwPartIndex])
{
    if (CGrannyModelInstance* pWeaponModelInstance = pLODController->GetModelInstance())
    {
		CGraphicThing* pItemGraphicThing = pItemData->GetModelThing();
		if (CGrannyMotion* pItemMotion = pItemGraphicThing->GetMotionPointer(0))
		{
			pWeaponModelInstance->SetMotionPointer(pItemMotion);
		}
    }
}

Add the code above to the end of

void CActorInstance::AttachWeapon(DWORD dwParentPartIndex, DWORD dwPartIndex, CItemData * pItemData)

function in ActorInstanceAttach.cpp

 

and ThingInstance.cpp in the function 

bool CGraphicThingInstance::SetMotion(DWORD dwMotionKey, float blendTime, int loopCount, float speedRatio)

modify 

std::for_each(m_LODControllerVector.begin(), m_LODControllerVector.end(), SetMotionPointer);

to

for (int i = 0; i < m_LODControllerVector.size(); ++i)
{
	switch (i)
	{
		case CRaceData::PART_WEAPON:
		case CRaceData::PART_WEAPON_LEFT:
			break;

		default:
			SetMotionPointer(m_LODControllerVector[i]);
			break;
	}
}

and add these to the includes

#include "../GameLib/GameType.h"
#include "../GameLib/RaceData.h"

to make it work when the weapon is equipped. ?‍♂️?‍♂️

 

anim-weap-just-flexin-its-for-next-chris

 

its working. Thank you so munch

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Angry 1
  • 3 weeks later...
  • 2 weeks later...
On 3/19/2022 at 5:54 PM, dumita123 said:

Unfortunately the link for the animated weapon expired. If somebody is kind enough, would you please give an updated one here? Thanks!

Try the backup made by Ace: 

This is the hidden content, please

Look here for that weapon.

 

 

 

 

  • Metin2 Dev 32
  • kekw 1
  • Eyes 2
  • Cry 1
  • Think 1
  • Scream 1
  • Good 3
  • Love 13
  • 2 weeks later...
  • 2 weeks later...
  • Premium

This line pkThingInst->Deform(); makes some buildings to become very big after a teleport (depends what was the last map you were in). Not adding this fixed the problem without affecting the animation of the wings.

  • 3 months later...
  • Premium

I dont know why, but its not working for me ? Compiled without any error in vs2022, but the attached sashes with animations still without animation as before the edits ?
Weapon is good, but sash isnt
https://metin2.download/picture/sjbb1YNr9u0HbOH60t0pYLh8L4rruPQx/.gif


 

EDIT

fixed



Problem was:

This part:

if (CGrannyLODController* pLODController = m_LODControllerVector[CRaceData::PART_SASH])
    {
        if (CGrannyModelInstance* pWeaponModelInstance = pLODController->GetModelInstance())
        {
            CGraphicThing* pItemGraphicThing = pItemData->GetModelThing();
            if (std::shared_ptr<CGrannyMotion> pItemMotion = pItemGraphicThing->GetMotionPointer(0))
            {
                pWeaponModelInstance->SetMotionPointer(pItemMotion);
            }
        }
    }

will go to: 

void CActorInstance::AttachSash(CItemData * pItemData, float fSpecular)
(in actorinstanceattach.cpp)

Instead of:
void CActorInstance::AttachWeapon(DWORD dwParentPartIndex, DWORD dwPartIndex, CItemData * pItemData)

Edited by Ulthar
Core X - External 2 Internal
  • Metin2 Dev 1

Ulthar

  • 2 weeks later...

Thanks for sharing. I have tried to add many times for wing animations but I always get an error. I couldn't do it. Is there anyone who can do it if I give my clean files? (scale sash added)

 

clean source codes required;

This is the hidden content, please

This is the hidden content, please

===============================================================

 

Errors I get while adding;

spacer.png

spacer.png

@ Tatsumaru @ B4RC0D3

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 8
  • Think 1
  • Good 3
  • Love 1
  • Love 3
  • 2 months later...
  • Premium
3 minutes ago, petmen021 said:

Its not work for  Visual Studio 2013?  ?

I get 
"Sharder_ptr" and "std" errors... and etc ?

#include <memory>

add it inside the header files that you receive the error.

  • Love 1
52 minutes ago, dumita123 said:

#include <memory>

add it inside the header files that you receive the error.

Thanks now get error 

Quote

LODController.h(213): error C2664: 'void CGrannyLODController::ChangeMotionPointer(const std::shared_ptr<CGrannyMotion>,int,float)' : cannot convert argument 1 from 'const CGrannyMotion *' to 'const std::shared_ptr<CGrannyMotion>'
3>          Constructor for class 'std::shared_ptr<CGrannyMotion>' is declared 'explicit'

Quote

1>..\..\source\EterGrnLib\ModelInstanceMotion.cpp(101): warning C4244: 'argument' : conversion from 'float' to 'granny_int32x', possible loss of data




I dont know why..

All error this "explicit"

Edited by petmen021

Hát van ilyen :D

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.