Honorable Member Tatsumaru 5260 Posted January 31, 2020 Honorable Member Share Posted January 31, 2020 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) When a player or monster is poisoned, a poisoning effect will appear in the life bar. The idea belongs to Whistlee from the Turkish forum. However, in Whistlee version this system does not work for monsters and has no connection with the source code, so the effect is visible only to us. I don't know if I can give a specific place where the original comes from, so I won't do it, but I put here github Whistlee's, where you can find the original code. GITHUB: This is the hidden content, please Sign In or Sign Up Special thanks for helping me with this code for Intern,VegaS™ and HITRON. ////////// CLIENT GAME Spoiler 01. Open taskbar.py (root/locale/?????/ui) and find this: { "name" : "HPRecoveryGaugeBar", "type" : "bar", "x" : 0, "y" : 0, "width" : 95, "height" : 13, "color" : 0x55ff0000, }, { "name" : "HPGauge", "type" : "ani_image", "x" : 0, "y" : 0, "delay" : 6, "images" : ( "D:/Ymir Work/UI/Pattern/HPGauge/01.tga", "D:/Ymir Work/UI/Pattern/HPGauge/02.tga", "D:/Ymir Work/UI/Pattern/HPGauge/03.tga", "D:/Ymir Work/UI/Pattern/HPGauge/04.tga", "D:/Ymir Work/UI/Pattern/HPGauge/05.tga", "D:/Ymir Work/UI/Pattern/HPGauge/06.tga", "D:/Ymir Work/UI/Pattern/HPGauge/07.tga", ), }, and under add this: { "name" : "HPPoisonRecoveryGaugeBar", "type" : "bar", "x" : 0, "y" : 0, "width" : 95, "height" : 13, "color" : 0x55008000, }, { "name" : "HPPoisonGauge", "type" : "ani_image", "x" : 0, "y" : 0, "delay" : 6, "images" : ( "D:/Ymir Work/UI/Pattern/HPPoisonGauge/01.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/02.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/03.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/04.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/05.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/06.tga", "D:/Ymir Work/UI/Pattern/HPPoisonGauge/07.tga", ), }, 02. Open ui.py (root/) and at the end of the class: class Gauge(Window): add this: if app.ENABLE_POISON_GAUGE_EFFECT: def SetGaugeColor(self, color): if self.imgGauge: self.imgGauge.LoadImage("d:/ymir work/ui/pattern/gauge_" + color + ".tga") 03. Open uiparty.py (root/) and at the beginning of the file add this: Attention! Don't add an import app if it's already in the file! import app if app.ENABLE_POISON_GAUGE_EFFECT: import chr import chrmgr find this: hpPercentage = max(0, hpPercentage) and above add it: if app.ENABLE_POISON_GAUGE_EFFECT: if chrmgr.HasAffectByVID(self.GetCharacterVID(), chr.AFFECT_POISON): self.gauge.SetGaugeColor("lime") else: self.gauge.SetGaugeColor("red") 04. Open uiplayergauge.py (root/) and at the beginning of the file add this: Attention! Don't add an import app if it's already in the file! import app if app.ENABLE_POISON_GAUGE_EFFECT: import chrmgr find this: self.SetPercentage(self.curHP, self.maxHP) and above add it: if app.ENABLE_POISON_GAUGE_EFFECT: if chrmgr.HasAffectByVID(player.GetMainCharacterIndex(), chr.AFFECT_POISON): self.SetGaugeColor("lime") else: self.SetGaugeColor("red") 05. Open uitarget.py (root/) and at the beginning of the file add this: Attention! Don't add an import app if it's already in the file! import app if app.ENABLE_POISON_GAUGE_EFFECT: import chrmgr find this: hpGauge = ui.Gauge() hpGauge.SetParent(self) hpGauge.MakeGauge(130, "red") hpGauge.Hide() and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: hpPoisonGauge = ui.Gauge() hpPoisonGauge.SetParent(self) hpPoisonGauge.MakeGauge(130, "lime") hpPoisonGauge.SetPosition(175, 17) hpPoisonGauge.SetWindowHorizontalAlignRight() hpPoisonGauge.Hide() find this: self.hpGauge = None Attention! There may be more these self.hpGauge = None lines in the file. If yes, make changes under all. and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge = None find this: self.hpGauge = hpGauge and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge = hpPoisonGauge find this: self.hpGauge.Hide() and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge.Hide() find this: self.hpGauge.SetPercentage(hpPercentage, 100) and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge.SetPercentage(hpPercentage, 100) find this: def OnUpdate(self): and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: if self.hpGauge and self.hpGauge.IsShow(): if chrmgr.HasAffectByVID(self.GetTargetVID(), chr.AFFECT_POISON): self.hpPoisonGauge.Show() else: self.hpPoisonGauge.Hide() 06. Open uitaskbar.py (root/) and at the beginning of the file add this: Attention! Don't add an import app if it's already in the file! import app if app.ENABLE_POISON_GAUGE_EFFECT: import chr import chrmgr find this: self.spRecoveryGaugeBar = self.GetChild("SPRecoveryGaugeBar") and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge = self.GetChild("HPPoisonGauge") self.hpPoisonRecoveryGaugeBar = self.GetChild("HPPoisonRecoveryGaugeBar") self.hpPoisonGauge.Hide() self.hpPoisonRecoveryGaugeBar.Hide() find this: self.spRecoveryGaugeBar = None and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge = None self.hpPoisonRecoveryGaugeBar = None find this: self.SetHP(curHP, recoveryHP, maxHP) and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: if chrmgr.HasAffectByVID(player.GetMainCharacterIndex(), chr.AFFECT_POISON): self.hpGauge.Hide() self.hpPoisonGauge.Show() else: self.hpPoisonGauge.Hide() self.hpGauge.Show() find this: self.hpGauge.SetPercentage(curPoint, maxPoint) and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonGauge.SetPercentage(curPoint, maxPoint) in function: def SetHP(self, curPoint, recoveryPoint, maxPoint): find this: if 0 == recoveryPoint: and under add this: if app.ENABLE_POISON_GAUGE_EFFECT: self.hpPoisonRecoveryGaugeBar.Hide() find this: self.hpRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT) self.hpRecoveryGaugeBar.Show() and above add it: if app.ENABLE_POISON_GAUGE_EFFECT: if chrmgr.HasAffectByVID(player.GetMainCharacterIndex(), chr.AFFECT_POISON): if self.hpRecoveryGaugeBar.IsShow(): self.hpRecoveryGaugeBar.Hide() self.hpPoisonRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT) self.hpPoisonRecoveryGaugeBar.Show() return else: if self.hpPoisonRecoveryGaugeBar.IsShow(): self.hpPoisonRecoveryGaugeBar.Hide() 07. Ddd to our game this: This is the hidden content, please Sign In or Sign Up ////////// SOURCE BIN Spoiler 01. Open locale_inc.h (client\UserInterface) and add to the file: #define ENABLE_POISON_GAUGE_EFFECT 02. Open PythonApplicationModule.cpp (client\UserInterface) and find this: #ifdef USE_OPENID PyModule_AddIntConstant(poModule, "USE_OPENID", 1); and above add it: #ifdef ENABLE_POISON_GAUGE_EFFECT PyModule_AddIntConstant(poModule, "ENABLE_POISON_GAUGE_EFFECT", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_POISON_GAUGE_EFFECT", 0); #endif 03. Open PythonCharacterManagerModule.cpp (client\UserInterface) and find this: void initchrmgr() and above add it: #ifdef ENABLE_POISON_GAUGE_EFFECT PyObject * chrmgrHasAffectByVID(PyObject * poSelf, PyObject * poArgs) { int iVID, iAffect; if (!PyTuple_GetInteger(poArgs, 0, &iVID)) return Py_BadArgument(); if (!PyTuple_GetInteger(poArgs, 1, &iAffect)) return Py_BadArgument(); CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance(); CInstanceBase * p = rkChrMgr.CPythonCharacterManager::GetInstancePtr(iVID); if (p) return Py_BuildValue("i", p->IsAffect(iAffect)); return Py_BuildNone(); } #endif find this: { NULL, NULL, NULL }, and above add it: #ifdef ENABLE_POISON_GAUGE_EFFECT { "HasAffectByVID", chrmgrHasAffectByVID, METH_VARARGS }, #endif Edited December 1, 2021 by Tatsumaru 135 1 1 1 2 1 1 31 7 81 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10276 Posted January 31, 2020 Forum Moderator Share Posted January 31, 2020 (edited) You don't need server source for this, you can do it directly via source client. For being in real time you'll need to do a boolean variable inside of CInstanceBase class which is updated from RecvAffectAddPacket, RecvAffectRemovePacket for each instance. So with that you could do a function like chrmgr.IsPoisoned(self.GetTargetVID()) which will result the status of poison for specific vid and check it in OnUpdate. Btw, the implementation is very bad, if i would want to do this, i don't touch the hpGauge, just add a new gauge bar over the hpGauge and hide/show it, that's all, could be done just with few lines, without the python. This is the hidden content, please Sign In or Sign Up Edited December 3, 2020 by VegaS™ 94 1 2 2 1 20 2 38 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
HITRON 695 Posted January 31, 2020 Share Posted January 31, 2020 (edited) 1 hour ago, VegaS™ said: You don't need server source for this, you can do it directly via source client. For being in real time you'll need to do a boolean variable inside of CInstanceBase class which is updated from RecvAffectAddPacket, RecvAffectRemovePacket for each instance. So with that you could do a function like chrmgr.IsPoisoned(self.GetTargetVID()) which will result the status of poison for specific vid and check it in OnUpdate. Btw, the implementation is very bad, if i would want to do this, i don't touch the hpGauge, just add a new gauge bar over the hpGauge and hide/show it, that's all, could be done just with few lines, without the python. Or you can simply use chrmgr.HasAffectByVID(self.GetTargetVID(), chr.AFFECT_POISON) in Python instead to add this new functions that is not really needed to check if the vid is poisoned and you can change it also to AFFECT_BLEEDING, AFFECT_FIRE etc less code and the SetPoison etc is not really needed cause the OnUpdate will update it anyways in every player that have selected the vid thats is poisoned and sow on. Function: HasAffectByVID PyObject * chrmgrHasAffectByVID(PyObject * poSelf, PyObject * poArgs) { int iVID, iAffect; if (!PyTuple_GetInteger(poArgs, 0, &iVID)) return Py_BadArgument(); if (!PyTuple_GetInteger(poArgs, 1, &iAffect)) return Py_BadArgument(); CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance(); CInstanceBase * p = rkChrMgr.CPythonCharacterManager::GetInstancePtr(iVID); if (p) return Py_BuildValue("i", p->IsAffect(iAffect)); return Py_BuildNone(); } Edited January 31, 2020 by HITRON 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10276 Posted January 31, 2020 Forum Moderator Share Posted January 31, 2020 (edited) 12 minutes ago, HITRON said: Or you can simply use chrmgr.HasAffectByVID(self.GetTargetVID(), chr.AFFECT_POISON) in Python instead to add new code in c++ to check if the vid is poisoned and you can change it also to AFFECT_BLEEDING, AFFECT_FIRE etc less code. You're wrong, i don't know from where you copy-paste this function, this isn't by default in metin2 source. Could be done this very easily too, but here we talked about the poisoning, why i should do something general for affects, this is another subject. @xP3NG3Rx Already shared this but is implemented via CPythonPlayer, which means is just for your client instance, you've to implement it in CInstanceBase for each of player instance and will work fine or try to use IsAffect as well. Edited January 31, 2020 by VegaS™ 1 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
HITRON 695 Posted January 31, 2020 Share Posted January 31, 2020 1 minute ago, VegaS™ said: You're wrong, i don't know from where you copy-paste this function, this isn't by default in metin2 source. Could be done this very easily too, but here we talked about the poisoning, why i should do something general for affects, this is another subject. @xP3NG3Rx Already shared this but is implemented via CPythonPlayer, which means is just for your client instance, you've to implement it in CInstanceBase for each of player instance and will work fine. If you mean that the Poisoning is not updating in all characters that have clicked on the Target after or before then you are wrong, the function that i did long time ago that i don't even remember that is not existing in the metin2 source by default, is working pretty fine. 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10276 Posted January 31, 2020 Forum Moderator Share Posted January 31, 2020 (edited) 8 minutes ago, HITRON said: If you mean that the Poisoning is not updating in all characters that have clicked on the Target after or before then you are wrong I didn't mentioned anything about this. I said just you're wrong because you told me, "use this instead of adding new code in c++", and i told you that this function from module doesn't exist in source, but you edited the topic when i replied and you added a new function, it's fine. Let's chill, you take it too seriously. Edited January 31, 2020 by VegaS™ 3 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5260 Posted February 5, 2020 Author Honorable Member Share Posted February 5, 2020 (edited) CODE UPDATE! Now the code is shorter and more accurate than the previous version. There is no problem with the poisoning effect on the monster's life bar. General, I did not notice any problems in the operation of the poisoning effect after adding the new version. Special thanks for helping me with this code for Intern, VegaS™ and HITRON. Edited February 5, 2020 by Tatsumaru 4 Link to comment Share on other sites More sharing options...
MentaLL 12 Posted February 5, 2020 Share Posted February 5, 2020 8 minutes ago, Tatsumaru said: CODE UPDATE! Now the code is shorter and more accurate than the previous version. There is no problem with the poisoning effect on the monster's life bar. General, I did not notice any problems in the operation of the poisoning effect after adding the new version. Special thanks for helping me with this code for Intern and VegaS™ Good job and thanks for sharing! 1 mindset Link to comment Share on other sites More sharing options...
ridetpro 116 Posted February 13, 2020 Share Posted February 13, 2020 (edited) This is how the SetHP() part should look. # uiTaskbar.py # def SetHP(self, curPoint, recoveryPoint, maxPoint): if app.ENABLE_POISON_GAUGE_EFFECT: if chrmgr.HasAffectByVID(player.GetMainCharacterIndex(), chr.AFFECT_POISON): if self.hpRecoveryGaugeBar.IsShow(): self.hpRecoveryGaugeBar.Hide() self.hpPoisonRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT) self.hpPoisonRecoveryGaugeBar.Show() else: if self.hpPoisonRecoveryGaugeBar.IsShow(): self.hpPoisonRecoveryGaugeBar.Hide() else: self.hpRecoveryGaugeBar.Show() Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Bizzy 101 Posted February 14, 2020 Share Posted February 14, 2020 (edited) https://metin2.download/picture/5SzDwCdRsGylcBlU01h4HnLLVXem75KY/.png ?? i have it fixed but i never used taskbar.py i think is not possible for use this system/effect Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 2 1 Link to comment Share on other sites More sharing options...
Cripplez 40 Posted February 19, 2020 Share Posted February 19, 2020 The metin stone will have the green bar even if they can't be poisoned, do you have a fix for this? Thank you Link to comment Share on other sites More sharing options...
Bizzy 101 Posted February 20, 2020 Share Posted February 20, 2020 (edited) @Cripplez Look mob_proto like: 8001 is STUN,SLOW,CURSE,TERROR make it to STUN,SLOW,CURSE,TERROR,POISON Control -> lenght.h EImmuneFlags like https://metin2.download/picture/O29kmI54cbrMhpk6qPlgR1dyyk9KwYum/.png and ItemData.h -> is the same Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 1 2 Link to comment Share on other sites More sharing options...
alexghinet 11 Posted February 25, 2020 Share Posted February 25, 2020 (edited) A little bug afther poison dissapear from character it remains on party just for self do someone know how to fix it? Thanks in advance! Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
nosacz 2 Posted March 20, 2020 Share Posted March 20, 2020 (edited) how to fix this? checked all the code and I think i added it correctly... Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Natox 18 Posted April 8, 2020 Share Posted April 8, 2020 Thanks, the system is fonctional Link to comment Share on other sites More sharing options...
Defacer35 21 Posted April 22, 2020 Share Posted April 22, 2020 @Tatsumaru I have a little issue, while attacking Lucifer if he poisoning he's hp bar getting low but hp is almost full like this ; Also when the poisoning gone HP bar back to normal state. How to fix this ? Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted April 24, 2020 Share Posted April 24, 2020 1. Quote 0327 16:45:24836 :: uiParty:283: RuntimeWarning: tp_compare didn't return -1 or -2 for exception 0327 16:45:24836 :: Traceback (most recent call last): 0327 16:45:24836 :: File "game.py", line 1266, in UpdatePartyMemberInfo 0327 16:45:24836 :: File "interfaceModule.py", line 1140, in UpdatePartyMemberInfo 0327 16:45:24836 :: File "uiParty.py", line 669, in UpdatePartyMemberInfo 0327 16:45:24836 :: File "uiParty.py", line 283, in SetCharacterHP 0327 16:45:24836 :: TypeError 0327 16:45:24836 :: : 0327 16:45:24836 :: an integer is required 0327 16:45:24838 :: when making party and the leader go offline appear this in syser and i understand is because of this. 2. still problem with poison bar on stone metin. any fix? 1 Link to comment Share on other sites More sharing options...
Xaleas 1 Posted May 12, 2020 Share Posted May 12, 2020 On 4/24/2020 at 5:45 PM, SorinSmon said: 1. when making party and the leader go offline appear this in syser and i understand is because of this. 2. still problem with poison bar on stone metin. any fix? Same Problem here. Link to comment Share on other sites More sharing options...
SorinSmon 494 Posted May 14, 2020 Share Posted May 14, 2020 any help guys? Link to comment Share on other sites More sharing options...
Bizzy 101 Posted August 3, 2020 Share Posted August 3, 2020 (edited) little problem when leader is still online https://metin2.download/picture/W493l36DrXnkyLql6E3cYAPslse9Xxqw/.png hp bar dont refreash pls help Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 2 1 1 Link to comment Share on other sites More sharing options...
Artix96it 2 Posted November 30, 2021 Share Posted November 30, 2021 The system seems incomplete. There are issues relating to the location of the Poison Bar at the time of poisoning, as well as issues relating to the party. Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5260 Posted November 30, 2021 Author Honorable Member Share Posted November 30, 2021 1 hour ago, Artix96it said: The system seems incomplete. There are issues relating to the location of the Poison Bar at the time of poisoning, as well as issues relating to the party. After 22 months, someone discovered that the system was incomplete. Doesn't that seem a little weird to you? Link to comment Share on other sites More sharing options...
Artix96it 2 Posted November 30, 2021 Share Posted November 30, 2021 4 minutes ago, Tatsumaru said: After 22 months, someone discovered that the system was incomplete. Doesn't that seem a little weird to you? I replied to the Thread because it interested me, regardless of the posting time. I noticed that other users had already stated that the System was not complete. In fact, the problems are different and quite annoying. I wonder why after a long time from publication, it still hasn't been fixed Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5260 Posted November 30, 2021 Author Honorable Member Share Posted November 30, 2021 (edited) 1 hour ago, Artix96it said: I replied to the Thread because it interested me, regardless of the posting time. I noticed that other users had already stated that the System was not complete. In fact, the problems are different and quite annoying. I wonder why after a long time from publication, it still hasn't been fixed Because I do not experience the problems that people write about in this topic. Edited November 30, 2021 by Tatsumaru Link to comment Share on other sites More sharing options...
Artix96it 2 Posted November 30, 2021 Share Posted November 30, 2021 4 minutes ago, Tatsumaru said: Because I do not experience the problems that people write about in this topic. If you want, I can show you the various problems in private. Maybe redoing the installation from scratch Link to comment Share on other sites More sharing options...
Recommended Posts