Honorable Member Distraught 5910 Posted July 12, 2020 Honorable Member Share Posted July 12, 2020 M2 Download Center This is the hidden content, please Sign In or Sign Up ( 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) 4 1 2 6 Link to comment Share on other sites More sharing options...
Mafuyu 51 Posted July 14, 2020 Share Posted July 14, 2020 (edited) 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 July 14, 2020 by Mafuyu Link to comment Share on other sites More sharing options...
Honorable Member Distraught 5910 Posted July 14, 2020 Author Honorable Member Share Posted July 14, 2020 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. 1 Link to comment Share on other sites More sharing options...
Mafuyu 51 Posted July 17, 2020 Share Posted July 17, 2020 (edited) 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 July 17, 2020 by Mafuyu Link to comment Share on other sites More sharing options...
Recommended Posts