Active Member B4RC0D3 1001 Posted December 21, 2019 Active Member Share Posted December 21, 2019 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hello together, today i want to share something with you for christmas. But before we start let me tell you, this system isn't in is final form! I will update this thread (if metin2dev will still exist in the new year) to complete this system. Anyways let's get startet. What kind of System is it? You can use inbuilt animations on objects (map objects) and weapons (currently not working, just if the weapon is a ground item instance! I'm working on it). Here is a preview: https://metin2.download/picture/JeG1pGK2WEyY5aY0CUwSk9N8WPoTjdr9/.gif First you can see a placed object on the map with inbuilt animation (sorry it is really far away :O) Later you can see a weapon (thanks to @Tatsumaru) which has an inbuilt animation. But this is currently just working as ground instance and not in the player hands itself. How to implement it Spoiler Open up your client source (c++) eterGrbLib Spoiler 1. struct FSetMotionPointer, struct FChangeMotionPointer and struct FEndStopMotionPointer in eterGrbLib/LODController.h //Change const CGrannyMotion * m_pMotion; //With std::shared_ptr<CGrannyMotion> m_pMotion; 2. eterGrbLib/LODController.h //Search for this void SetMotionPointer(const CGrannyMotion * c_pMotion, float fBlendTime, int iLoopCount, float speedRatio); void ChangeMotionPointer(const CGrannyMotion * c_pMotion, int iLoopCount, float speedRatio); //Replace with void SetMotionPointer(const std::shared_ptr<CGrannyMotion> c_pMotion, float fBlendTime, int iLoopCount, float speedRatio); void ChangeMotionPointer(const std::shared_ptr<CGrannyMotion> c_pMotion, int iLoopCount, float speedRatio); 3. eterGrbLib/LODController.cpp //Search for void CGrannyLODController::SetMotionPointer(const CGrannyMotion * c_pMotion, float fBlendTime, int iLoopCount, float speedRatio) //Replace with void CGrannyLODController::SetMotionPointer(const std::shared_ptr<CGrannyMotion> c_pMotion, float fBlendTime, int iLoopCount, float speedRatio) //Search for void CGrannyLODController::ChangeMotionPointer(const CGrannyMotion * c_pMotion, int iLoopCount, float speedRatio) //Replace with void CGrannyLODController::ChangeMotionPointer(const std::shared_ptr<CGrannyMotion> c_pMotion, int iLoopCount, float speedRatio) 4. eterGrnLib/Mesh.cpp //Search for m_pgrnMeshDeformer = GrannyNewMeshDeformer(pgrnInputType, pgrnOutputType, GrannyDeformPositionNormal, GrannyDontAllowUncopiedTail); //Replace with m_pgrnMeshDeformer = GrannyNewMeshDeformer(pgrnInputType, pgrnOutputType, GrannyDeformPositionNormal, GrannyAllowUncopiedTail); 5. eterGrnLib/ModelInstance.h //Search for void SetMotionPointer(const CGrannyMotion* pMotion, float blendTime=0.0f, int loopCount=0, float speedRatio=1.0f); void ChangeMotionPointer(const CGrannyMotion* pMotion, int loopCount=0, float speedRatio=1.0f); //Replace with void SetMotionPointer(const std::shared_ptr<CGrannyMotion> pMotion, float blendTime = 0.0f, int loopCount = 0, float speedRatio = 1.0f); void ChangeMotionPointer(const std::shared_ptr<CGrannyMotion> pMotion, int loopCount = 0, float speedRatio = 1.0f); 6. eterGrnLib/ModelInstanceMotion.cpp //Search for void CGrannyModelInstance::SetMotionPointer(const CGrannyMotion * pMotion, float blendTime, int loopCount, float speedRatio) //Replace with void CGrannyModelInstance::SetMotionPointer(const std::shared_ptr<CGrannyMotion> pMotion, float blendTime, int loopCount, float speedRatio) //Search for (it is in the SetMotionPointer function!) m_pgrnCtrl = GrannyPlayControlledAnimation(localTime, m_pgrnAni, pgrnModelInstance); //Replace with granny_model_instance* InstanceOfModel = pgrnModelInstance; granny_animation* Animation = m_pgrnAni; granny_real32 StartTime = localTime; granny_controlled_animation_builder* Builder = GrannyBeginControlledAnimation(StartTime, Animation); if (Builder) { granny_int32x TrackGroupIndex; if (GrannyFindTrackGroupForModel(Animation, GrannyGetSourceModel(InstanceOfModel)->Name, &TrackGroupIndex)) { GrannySetTrackGroupLOD(Builder, TrackGroupIndex, true, 1.0f); GrannySetTrackGroupTarget(Builder, TrackGroupIndex, InstanceOfModel); } else { GrannySetTrackGroupLOD(Builder, 1.0f, true, 1.0f); GrannySetTrackGroupTarget(Builder, 0, InstanceOfModel); } m_pgrnCtrl = GrannyEndControlledAnimation(Builder); } //Search for void CGrannyModelInstance::ChangeMotionPointer(const CGrannyMotion* pMotion, int loopCount, float speedRatio) //Replace with void CGrannyModelInstance::ChangeMotionPointer(const std::shared_ptr<CGrannyMotion> pMotion, int loopCount, float speedRatio) 7. eterGrnLib/Thing.h //Search for CGrannyMotion * GetMotionPointer(int iMotion); //Replace with std::shared_ptr<CGrannyMotion> GetMotionPointer(int iMotion); //Search for CGrannyMotion * m_motions; //Replace with std::vector<std::shared_ptr<CGrannyMotion>> m_motions; 8. eterGrnLib/Thing.cpp //Search for void CGraphicThing::Initialize() { ... } //Replace with void CGraphicThing::Initialize() { m_pgrnFile = NULL; m_pgrnFileInfo = NULL; m_pgrnAni = NULL; m_models = NULL; } //Search for void CGraphicThing::OnClear() { ... } //Replace with void CGraphicThing::OnClear() { if (!m_motions.empty()) m_motions.clear(); if (m_models) delete [] m_models; if (m_pgrnFile) GrannyFreeFile(m_pgrnFile); Initialize(); } //Search for CGrannyMotion * CGraphicThing::GetMotionPointer(int iMotion) { ... } //Replace with std::shared_ptr<CGrannyMotion> CGraphicThing::GetMotionPointer(int iMotion) { assert(CheckMotionIndex(iMotion)); if (iMotion >= m_pgrnFileInfo->AnimationCount) return NULL; if (m_motions.empty()) return NULL; return m_motions.at(iMotion); } //Search for bool CGraphicThing::LoadMotions() { ... } //Replace with bool CGraphicThing::LoadMotions() { assert(m_pgrnFile != NULL); assert(m_motions->empty()); if (m_pgrnFileInfo->AnimationCount <= 0) return false; int motionCount = m_pgrnFileInfo->AnimationCount; for (int m = 0; m < motionCount; ++m) { auto motion = std::make_shared<CGrannyMotion>(); if (!motion->BindGrannyAnimation(m_pgrnFileInfo->Animations[m])) return false; m_motions.push_back(motion); } return true; } gameLib Spoiler 1. gameLib/ActorInstanceMotion.cpp //Search for CGrannyMotion * pGrannyMotion = pMotion->GetMotionPointer(0); //Replace with std::shared_ptr<CGrannyMotion> pGrannyMotion = pMotion->GetMotionPointer(0); 2. gameLib/Area.cpp //Search for pkThingInst->Update(); //Add BEFORE!!!! pkThingInst->Deform(); userInterface Spoiler 1. userInterface/PythonItem.cpp //Search for itor->second->Update(); //Add BEFORE!!! itor->second->ThingInstance.Deform(); itor->second->ThingInstance.Update(); //Search for pGroundItemInstance->ThingInstance.Show(); //Add below if (pGroundItemInstance->ThingInstance.GetBaseThingPtr()->GetMotionCount() > 0) { pGroundItemInstance->ThingInstance.RegisterMotionThing(0, pGroundItemInstance->ThingInstance.GetBaseThingPtr()); pGroundItemInstance->ThingInstance.SetMotion(0); } Another part : by Distraught Spoiler 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. What is missing for now? Currently the deforming for weapons holden by the player won't work. But as i said in the first few lines, i will add it later. But for now i want to give this parts to you for christmas! (Sorry i'm currently out of time to finish it before 2019 ends... Maybe someone of you want to complet it in his on way). The attachments Animated Object: This is the hidden content, please Sign In or Sign Up <- Thanks to KillMoves who did this sometime ago!!! (Animated Weapon: This is the hidden content, please Sign In or Sign Up <- Thanks to Tatsumaru!!! Have fun with it, your B4RC0D3 Edited August 27, 2022 by Metin2 Dev Core X - External 2 Internal 420 3 7 16 1 4 2 2 3 11 8 7 2 141 14 289 Link to comment Share on other sites More sharing options...
Kori 170 Posted December 21, 2019 Share Posted December 21, 2019 Wow nice I think with a little knowledge we can create a better snow or rain animation for some maps and the drop animation with effect are really nice but I think when you have a big drop with ~30 dropps is the effect so hard or? Link to comment Share on other sites More sharing options...
onur balcı 619 Posted December 21, 2019 Share Posted December 21, 2019 Wow nice when finish weapon & sash so player usable items i share a lot models thx 4 share Animated gr2 wing https://dosya.co/7tlx83tkg13z/ob_animated_wing_test.rar.html 10 1 1 6 4 12 Link to comment Share on other sites More sharing options...
Forum Moderator Raylee 656 Posted December 21, 2019 Forum Moderator Share Posted December 21, 2019 Cool work, thank you for the christmas gift Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5256 Posted December 21, 2019 Honorable Member Share Posted December 21, 2019 You can share this weapon, it is an experimental mouse xD 1 1 Link to comment Share on other sites More sharing options...
Active Member B4RC0D3 1001 Posted December 21, 2019 Author Active Member Share Posted December 21, 2019 vor 2 Stunden schrieb Kori: Wow nice I think with a little knowledge we can create a better snow or rain animation for some maps and the drop animation with effect are really nice but I think when you have a big drop with ~30 dropps is the effect so hard or? I didn't tested the Effect with many drops. But this is a server specific "Feature" and not part of this System. Anyways those animated drops can easy disabled by some devs which understand how this release works. (HINT: You just need to edit two lines in PythonItem.cpp) Also this System was built, because i hate those mde weapons which will have a lower Performance as inbuilt animations. Anyways lets see what the future will bring to us. 1 Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted December 21, 2019 Silver Share Posted December 21, 2019 Woah, thank you so much! If someone experiences compile errors regarding std::shared_ptr, include <memory> inside Thing.h & ModelInstance.h! 5 Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19665 Posted December 21, 2019 Honorable Member Share Posted December 21, 2019 Lovely, thanks. 1 Link to comment Share on other sites More sharing options...
ElRenardo 25 Posted December 22, 2019 Share Posted December 22, 2019 Thanks, can be really usefull for buildings ! :) Link to comment Share on other sites More sharing options...
Alpha 482 Posted December 30, 2019 Share Posted December 30, 2019 But thats already built into the game you can enable it by just adding the ->Deform(); Part for buildings all you are adding seems to be LOD to the animations and that is basically GrannySampleModelAnimationsAcceleratedLOD Some of the M2M Map Objects have Animations builtin and also some metin2 objects there is a watermill for example that has an animation in its gr2 file Ah the rest of your code gets rid of the: "Unable to find matching track_group for Model:" messages 3 Link to comment Share on other sites More sharing options...
themanji 25 Posted January 13, 2020 Share Posted January 13, 2020 (edited) https://metin2.download/picture/7Jl1zS81Yb8l0b7CaSf0qc7D762crEDw/.gif I've done for wings, it would be great if we run the animation on the character Please help Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 9 5 2 7 Link to comment Share on other sites More sharing options...
Morpheus™ 47 Posted June 28, 2020 Share Posted June 28, 2020 hi guys! Has anyone upgraded to a sash system yet? Link to comment Share on other sites More sharing options...
Management AZICKO 7339 Posted November 27, 2020 Management Share Posted November 27, 2020 Quote (if metin2dev will still exist in the new year) We survived the year 2020. We will live the year 2021 together! Did you continue to work on this system? It's really interesting! 1 1 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Honorable Member Distraught 5903 Posted November 30, 2020 Honorable Member Share Posted November 30, 2020 (edited) 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. Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 3 2 1 16 Link to comment Share on other sites More sharing options...
Management AZICKO 7339 Posted November 30, 2020 Management Share Posted November 30, 2020 @Gurgarath 1 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Management AZICKO 7339 Posted November 30, 2020 Management Share Posted November 30, 2020 #Saved Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19665 Posted December 1, 2020 Honorable Member Share Posted December 1, 2020 (edited) It all works with @Distraught codes, giant thanks to him. Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 1 12 Link to comment Share on other sites More sharing options...
Management AZICKO 7339 Posted December 1, 2020 Management Share Posted December 1, 2020 #Updated 3 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Contributor Toki.San 1963 Posted December 2, 2020 Contributor Share Posted December 2, 2020 (edited) Awesome System!! Here Metin2 Acce with animation Mega Download This is the hidden content, please Sign In or Sign Up ( Mega ) Edited December 2, 2020 by TokiSan 81 1 3 1 1 1 2 1 21 5 45 Link to comment Share on other sites More sharing options...
Management AZICKO 7339 Posted December 4, 2020 Management Share Posted December 4, 2020 https://metin2.dev/board/forum/108-gr2-animation/ Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Contributor Toki.San 1963 Posted January 19, 2021 Contributor Share Posted January 19, 2021 Is possible make dynamic object? Like elevators or flying platforms? Link to comment Share on other sites More sharing options...
Tiburon 22 Posted February 22, 2021 Share Posted February 22, 2021 Help me!!! Severity Code Description Project File Line Status suppressed Error C2664 'void CGrannyModelInstance :: SetMotionPointer (const std :: shared_ptr <CGrannyMotion>, float, int, float)': Argument 1 cannot be converted from 'CGrannyMotion *' to 'const std :: shared_ptr <CGrannyMotion>' gamelib D : \ Binary \ Binary \ Client \ GameLib \ ActorInstanceAttach.cpp 253 On 12/2/2020 at 9:52 AM, TokiSan said: Awesome System!! Here Metin2 Acce with animation Mega Download This is the hidden content, please Sign In or Sign Up ( Mega ) Could you pass me your ActorInstanceAttach.cpp, to compare with mine and see what I am placing wrong? 8 1 2 2 4 Link to comment Share on other sites More sharing options...
arlinamid 1130 Posted March 21, 2021 Share Posted March 21, 2021 (edited) Thanks All, easily expanded to sash https://metin2.download/picture/MB9ZNiq678Ny7I1Yz6pDiTYAT2iWoQ1N/.gif Edited September 11, 2022 by Metin2 Dev Core X - External 2 Internal 3 2 2 5 2 4 Best regards, Arlinamid Link to comment Share on other sites More sharing options...
Fryxion 2 Posted March 22, 2021 Share Posted March 22, 2021 On 2/22/2021 at 12:27 PM, Tiburon said: Help me!!! Severity Code Description Project File Line Status suppressed Error C2664 'void CGrannyModelInstance :: SetMotionPointer (const std :: shared_ptr <CGrannyMotion>, float, int, float)': Argument 1 cannot be converted from 'CGrannyMotion *' to 'const std :: shared_ptr <CGrannyMotion>' gamelib D : \ Binary \ Binary \ Client \ GameLib \ ActorInstanceAttach.cpp 253 Could you pass me your ActorInstanceAttach.cpp, to compare with mine and see what I am placing wrong? Hello, I have the same problem... Anyone can help? Link to comment Share on other sites More sharing options...
Tiburon 22 Posted March 22, 2021 Share Posted March 22, 2021 (edited) 21 hours ago, arlinamid said: Thanks All, easily expanded to sash https://metin2.download/picture/MB9ZNiq678Ny7I1Yz6pDiTYAT2iWoQ1N/.gif Could you please give me help with the code? I get errors and I don't know why, Edited September 11, 2022 by Metin2 Dev Core X - External 2 Internal 3 1 1 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts