Jump to content

Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

Hey guys,

 

It was really a long ago I did any activity on a forum so I decided to release a small but usefull class.

This can be used to place functions you want to run on every frame for a period of time with a progress on a "timeline". This can be used for example to roll the yang up or down when changing it (a normal way and not creating threads or wtf others doing) or anything else when you animating something in code.

So add this 2 files (download link at the end of this post) to your project and go to PythonApplication.cpp and find the Process function.

Add this line after like OnUIUpdate();:


Timeline::GetInstance()->DoEvents();

 

You can add functions like (it's an example for the mentioned yang stuff):


            auto currentGold = rkPlayer.GetStatus(POINT_GOLD);
            auto goldChange = PointChange.value - currentGold;
            Timeline::GetInstance()->AddFunction(0.5f, 
                [currentGold, goldChange](float p)
                {
                    CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
                    rkPlayer.SetStatus(POINT_GOLD, currentGold + (goldChange * p));
                },
                [currentGold, goldChange]()
                {
                    CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
                    rkPlayer.SetStatus(POINT_GOLD, currentGold + goldChange);
                }
            );

Download: https://distraught.hu/download/m2dev/Timeline.rar

 

Good luck!

 

 

-----------------------

Oh and if you can't compile it because the compiler does not find ModernSingleton then here it is:


template<typename T>
struct ModernSingleton
{
    static T* GetInstance()
    {
        static T _instance;
        return &_instance;
    }
};

(just add it to like singleton.h)

  • Metin2 Dev 6
  • Angry 1
  • Good 2
  • Love 6

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

Link to comment
https://metin2.dev/topic/24312-functions-on-timeline/
Share on other sites

On 7/12/2020 at 8:31 PM, Distraught said:

Hey guys,

It was really a long ago I did any activity on a forum so I decided to release a small but usefull class.

This can be used to place functions you want to run on every frame for a period of time with a progress on a "timeline". This can be used for example to roll the yang up or down when changing it (a normal way and not creating threads or wtf others doing) or anything else when you animating something in code.

So add this 2 files (download link at the end of this post) to your project and go to PythonApplication.cpp and find the Process function.

Add this line after like OnUIUpdate();:


Timeline::GetInstance()->DoEvents();

 

You can add functions like (it's an example for the mentioned yang stuff):


            auto currentGold = rkPlayer.GetStatus(POINT_GOLD);
            auto goldChange = PointChange.value - currentGold;
            Timeline::GetInstance()->AddFunction(0.5f, 
                [currentGold, goldChange](float p)
                {
                    CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
                    rkPlayer.SetStatus(POINT_GOLD, currentGold + (goldChange * p));
                },
                [currentGold, goldChange]()
                {
                    CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
                    rkPlayer.SetStatus(POINT_GOLD, currentGold + goldChange);
                }
            );

Download: https://distraught.hu/download/m2dev/Timeline.rar

 

Good luck!

 

 

-----------------------

Oh and if you can't compile it because the compiler does not find ModernSingleton then here it is:

 


template<typename T>
struct ModernSingleton
{
    static T* GetInstance()
    {
        static T _instance;
        return &_instance;
    }
};

 

(just add it to like singleton.h)

where did you put the POINT_GOLD function ?

Edited by Mafuyu
Link to comment
https://metin2.dev/topic/24312-functions-on-timeline/#findComment-130366
Share on other sites

  • Honorable Member

That was just an example, it's not a tutorial for that specific stuff.

But put it in CPythonNetworkStream::RecvPointChange in the if (PointChange.Type == POINT_GOLD) condition.

  • Love 1

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

Link to comment
https://metin2.dev/topic/24312-functions-on-timeline/#findComment-130383
Share on other sites

On 7/14/2020 at 4:56 PM, Distraught said:

That was just an example, it's not a tutorial for that specific stuff.

But put it in CPythonNetworkStream::RecvPointChange in the if (PointChange.Type == POINT_GOLD) condition.

yeah thats what i was trying but it didnt worked for me, it didnt change anything ingame.

can you show the full edit function how it would work? i tried some changes but no effect on it, so i dont know if i made mistaks or if the system doesnt work

Edited by Mafuyu
Link to comment
https://metin2.dev/topic/24312-functions-on-timeline/#findComment-130462
Share on other sites

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.