Jump to content

Inbuild GR2 Animation


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 18
  • Dislove 2
  • Not Good 2
  • Confused 2
  • Good 8
  • Love 4
  • Love 13

giphy.gif

Best regards, Arlinamid

Link to comment
Share on other sites

  • 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

it will of course be updated when something new is added.

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 102
  • Dislove 1
  • Sad 1
  • Think 1
  • Good 27
  • Love 4
  • Love 37
Spoiler

Ymir Entertainment was founded in 1999 in Seoul, Korea and 
is currently headed by Byoung Gwan Kim as CEO. The company 
started developing its first 2D online game Metin the same 
year it was founded. The game was commercially launched in 
Korea a year later and received a prize from the Korean 
                    Ministry of Information and Communication in December of the 
                    same year. Following the success of their flagship game Ymir 
                    Entertainment immediately started work on the game’s sequel 
                    Metin 2, which went into Closed Beta in Korea in May 2004. 
                    The game was officially launched in Korea and China in March 
                    2005 before being launched in Asia, Europe and North America 
                    in the years that followed. In January 2011 all of the company’s 
                    shares were bought by Webzen Inc., a Korean game giant known for 
                    their popular MMORPG, MU Online. The company was also awarded 
                    Gameforge’s Global Best Partner of the Year in 2011.
                    
                    Source: https://mmos.com/publishers/ymir-entertainment
                    
                    Thank you ymir 🙂 ❤️ and F*** you Gameforge, 2011 you ruined it.

 

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

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

WRnRW3H.gif

Link to comment
Share on other sites

  • 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
Link to comment
Share on other sites

  • 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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 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 26
  • Eyes 1
  • Cry 1
  • Think 1
  • Scream 1
  • Good 3
  • Love 10
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 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

Link to comment
Share on other sites

  • 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 2
  • Love 1
  • Love 3
Link to comment
Share on other sites

  • 2 months later...
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

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.