ShuzZzle 28 Posted April 13, 2014 Share Posted April 13, 2014 Hey Guys, Since this is my first post i want to release a little module i wrote 5 minutes ago. First of all this is for everybody who hates sockets(like me) and don't want to use item_proto for Shinings/Effects whatever. The Code is quiet "crappy" but it is working flawlessly. So lets get started. You wanna create something like this where you declare your maps to store the vnum and effectfilepath #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Make also sure you start your function in UserInterface.cpp bool RunMainScript(CPythonLauncher& pyLauncher, const char* lpCmdLine){ //Otherfunctions initShining(); } AND in stdafx.h add this void initShining(); After that open up your InstanceBase.cpp and define your early declared maps also include boost algorithm Just copy this at the start of the file #include "boost/algorithm/string.hpp" std::map<int, char*> shiningdata; std::map<int, char*>::iterator shiningit; Then search for if (12010 <= vnum && vnum <= 12049) and copy the following code after the if-clause if(!shiningdata.empty()){ for (shiningit=shiningdata.begin(); shiningit!=shiningdata.end(); shiningit++) if (shiningit->first == vnum) { std::string substr(shiningit->second); std::vector<string> chars; boost::split(chars, substr, boost::is_any_of("#")); for(std::vector<string>::size_type i = 0; i != chars.size(); i++) { __AttachEffectToArmours(chars[i]); } } } } This will split after a # for multiple shining attached to one amour. Then you need to declare and define a function in InstanceBaseEffect.cpp and InstanceBase.h InstanceBaseEffect.cpp DWORD CInstanceBase::__AttachEffectToArmours(string effectfilename) { const char * effectpath = effectfilename.c_str(); CEffectManager::Instance().RegisterEffect(effectpath, false, false); return m_GraphicThingInstance.AttachEffectByName(0, "Bip01", effectpath); } Again if you wish you can modify it. I already hardcoded the bonename and the boneindex. In InstanceBase.h Search for this: protected: DWORD __AttachEffect(UINT eEftType); DWORD __AttachEffectToArmours(string effectfilename); void __DetachEffect(DWORD dwEID); Replace with this: protected: DWORD __AttachEffect(UINT eEftType); DWORD __AttachEffectToArmours(string effectfilename); DWORD __AttachEffect(char filename[128]); void __DetachEffect(DWORD dwEID); Oh Yeah watch out that your filename is no longer than 128 characters. Last but not least: Create a Python Script in your root Folder (call it whatever you like) import Shining ##Modded Version # Implemented Delim for C++ # delimiter : # EffectTable = { 11290 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11291 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11292 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11293 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11294 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11295 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11296 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11297 : ["d:/ymir work/pc/common/effect/armor/grun_shining.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11298 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11299 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11259 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11269 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"] } def LoadEffectTable(): for effect in EffectTable: for i in range(len(EffectTable[effect])): vnum = effect effectpath = EffectTable[effect][i] Shining.Add(vnum, effectpath) As you can see 2 Shinings are seperated with an "#". Last but no least import your file in your game and add the following line under the python constructor effecttable.LoadEffectTable() I Hope i didn't forgot anything 1 18 Link to comment Share on other sites More sharing options...
mrrylisma1337 1 Posted April 13, 2014 Share Posted April 13, 2014 Nice good job Link to comment Share on other sites More sharing options...
Mehti 76 Posted April 13, 2014 Share Posted April 13, 2014 I go add my client. Thanks for share! 1 Link to comment Share on other sites More sharing options...
Honorable Member .plechito' 7774 Posted May 16, 2014 Honorable Member Share Posted May 16, 2014 Nice, but i don't understand to last step: where i must put this? Thanks effecttable.LoadEffectTable() Link to comment Share on other sites More sharing options...
ShuzZzle 28 Posted May 16, 2014 Author Share Posted May 16, 2014 In your game.py under the python constructor Link to comment Share on other sites More sharing options...
Honorable Member .plechito' 7774 Posted May 16, 2014 Honorable Member Share Posted May 16, 2014 Yeah, but i don't understand to - Python constructor.. my english is bad sorry Link to comment Share on other sites More sharing options...
ShuzZzle 28 Posted May 16, 2014 Author Share Posted May 16, 2014 def __init__(self): is the python constructor def __del__(self): is the python deconstructor 1 Link to comment Share on other sites More sharing options...
Monkey Dungeon 40 Posted May 16, 2014 Share Posted May 16, 2014 i dont know what u mean.. any screens pls? Link to comment Share on other sites More sharing options...
ShuzZzle 28 Posted May 16, 2014 Author Share Posted May 16, 2014 (edited) I extended that shit massively tho As you can see i also did it for the weapons Screen(This Version would only enable to you do the armor shining without prototype or item_proto): Edited August 15, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Kori 170 Posted May 19, 2014 Share Posted May 19, 2014 Hey Guys, Since this is my first post i want to release a little module i wrote 5 minutes ago. First of all this is for everybody who hates sockets(like me) and don't want to use item_proto for Shinings/Effects whatever. The Code is quiet "crappy" but it is working flawlessly. So lets get started. You wanna create something like this where you declare your maps to store the vnum and effectfilepath #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Make also sure you start your function in UserInterface.cpp bool RunMainScript(CPythonLauncher& pyLauncher, const char* lpCmdLine){ //Otherfunctions initShining(); } AND in stdafx.h add this void initShining(); After that open up your InstanceBase.cpp and define your early declared maps also include boost algorithm Just copy this at the start of the file #include "boost/algorithm/string.hpp" std::map<int, char*> shiningdata; std::map<int, char*>::iterator shiningit; Then search for if (12010 <= vnum && vnum <= 12049) and copy the following code after the if-clause if(!shiningdata.empty()){ for (shiningit=shiningdata.begin(); shiningit!=shiningdata.end(); shiningit++) if (shiningit->first == vnum) { std::string substr(shiningit->second); std::vector<string> chars; boost::split(chars, substr, boost::is_any_of("#")); for(std::vector<string>::size_type i = 0; i != chars.size(); i++) { __AttachEffectToArmours(chars[i]); } } } } This will split after a # for multiple shining attached to one amour. Then you need to declare and define a function in InstanceBaseEffect.cpp and InstanceBase.h InstanceBaseEffect.cpp DWORD CInstanceBase::__AttachEffectToArmours(string effectfilename) { const char * effectpath = effectfilename.c_str(); CEffectManager::Instance().RegisterEffect(effectpath, false, false); return m_GraphicThingInstance.AttachEffectByName(0, "Bip01", effectpath); } Again if you wish you can modify it. I already hardcoded the bonename and the boneindex. In InstanceBase.h Search for this: protected: DWORD __AttachEffect(UINT eEftType); DWORD __AttachEffectToArmours(string effectfilename); void __DetachEffect(DWORD dwEID); Replace with this: protected: DWORD __AttachEffect(UINT eEftType); DWORD __AttachEffectToArmours(string effectfilename); DWORD __AttachEffect(char filename[128]); void __DetachEffect(DWORD dwEID); Oh Yeah watch out that your filename is no longer than 128 characters. Last but not least: Create a Python Script in your root Folder (call it whatever you like) import Shining ##Modded Version # Implemented Delim for C++ # delimiter : # EffectTable = { 11290 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11291 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11292 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11293 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11294 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11295 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11296 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse"], 11297 : ["d:/ymir work/pc/common/effect/armor/grun_shining.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11298 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11299 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11259 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"], 11269 : ["d:/ymir work/pc/common/effect/armor/armor-4-2-2.mse#d:/ymir work/pc/common/effect/armor/armor-4-2-1.mse"] } def LoadEffectTable(): for effect in EffectTable: for i in range(len(EffectTable[effect])): vnum = effect effectpath = EffectTable[effect][i] Shining.Add(vnum, effectpath) As you can see 2 Shinings are seperated with an "#". Last but no least import your file in your game and add the following line under the python constructor effecttable.LoadEffectTable() I Hope i didn't forgot anything can help me ? pls Link to comment Share on other sites More sharing options...
ShuzZzle 28 Posted May 19, 2014 Author Share Posted May 19, 2014 @Kori Where is your problem? I thought its pretty straight forward. Link to comment Share on other sites More sharing options...
Risan 115 Posted June 29, 2014 Share Posted June 29, 2014 not works, i have problem on compile... Sorry Link to comment Share on other sites More sharing options...
morion 60 Posted November 30, 2014 Share Posted November 30, 2014 same thing can be used for weapon? Link to comment Share on other sites More sharing options...
HellBoy 200 Posted November 30, 2014 Share Posted November 30, 2014 Why would i waste time dooing all that when i can do it in 5 seconds with socket? Just curious Link to comment Share on other sites More sharing options...
morion 60 Posted November 30, 2014 Share Posted November 30, 2014 Why would i waste time dooing all that when i can do it in 5 seconds with socket? Just curious i can do it with socket_pct? Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted November 30, 2014 Premium Share Posted November 30, 2014 Why would i waste time dooing all that when i can do it in 5 seconds with socket? Just curious i can do it with socket_pct? Wow, and thanks to this script we can do this ? Link to comment Share on other sites More sharing options...
HellBoy 200 Posted November 30, 2014 Share Posted November 30, 2014 Thats awsome you can make 1 bow with unexisting .gr2 then add the effect at socket_pct and done ^ just an ideea but in theory should work 1 Link to comment Share on other sites More sharing options...
Former Staff Shisui 492 Posted December 31, 2014 Former Staff Share Posted December 31, 2014 Where do I put this? #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Link to comment Share on other sites More sharing options...
socressor 0 Posted January 3, 2015 Share Posted January 3, 2015 I got this error: 0103 14:06:26506 :: Traceback (most recent call last): 0103 14:06:26507 :: File "networkModule.py", line 237, in SetGamePhase 0103 14:06:26507 :: File "system.py", line 130, in __pack_import 0103 14:06:26507 :: File "system.py", line 110, in _process_result 0103 14:06:26507 :: File "game.py", line 53, in ? 0103 14:06:26507 :: File "system.py", line 130, in __pack_import 0103 14:06:26507 :: File " 0103 14:06:26507 :: <string> 0103 14:06:26507 :: ", line 0103 14:06:26507 :: 14 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: Shining.Add(vnum, effectpath) 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: ^ 0103 14:06:26508 :: SyntaxError 0103 14:06:26508 :: : 0103 14:06:26508 :: invalid syntax 0103 14:06:26508 :: Can you help me? Thank's Link to comment Share on other sites More sharing options...
Premium Lufbert 20 Posted January 4, 2015 Premium Share Posted January 4, 2015 I got this error: 0103 14:06:26506 :: Traceback (most recent call last): 0103 14:06:26507 :: File "networkModule.py", line 237, in SetGamePhase 0103 14:06:26507 :: File "system.py", line 130, in __pack_import 0103 14:06:26507 :: File "system.py", line 110, in _process_result 0103 14:06:26507 :: File "game.py", line 53, in ? 0103 14:06:26507 :: File "system.py", line 130, in __pack_import 0103 14:06:26507 :: File " 0103 14:06:26507 :: <string> 0103 14:06:26507 :: ", line 0103 14:06:26507 :: 14 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: Shining.Add(vnum, effectpath) 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26507 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: 0103 14:06:26508 :: ^ 0103 14:06:26508 :: SyntaxError 0103 14:06:26508 :: : 0103 14:06:26508 :: invalid syntax 0103 14:06:26508 :: Can you help me? Thank's You wrong place TAB Link to comment Share on other sites More sharing options...
Former Staff Shisui 492 Posted January 4, 2015 Former Staff Share Posted January 4, 2015 Where do I put this? #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Link to comment Share on other sites More sharing options...
Former Staff Shisui 492 Posted January 25, 2015 Former Staff Share Posted January 25, 2015 Where do I put this? #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Link to comment Share on other sites More sharing options...
Draeth 0 Posted October 8, 2015 Share Posted October 8, 2015 (edited) Not working for me.. I cannot seen any shining on my costume but on normal Armor is works.Help? My Skype: -EDIT- Edited October 9, 2015 by Shisui Skype ID removed (Read Board Rules) Link to comment Share on other sites More sharing options...
Slade 1 Posted May 15, 2016 Share Posted May 15, 2016 Can someone help me? Link to comment Share on other sites More sharing options...
Silver Sonitex 1444 Posted June 9, 2016 Silver Share Posted June 9, 2016 Where do I put this part of the code? You wanna create something like this where you declare your maps to store the vnum and effectfilepath #include <map> #ifndef ShiningSettings_H #define ShiningSettings_H 1 extern std::map<int, char*> shiningdata; extern std::map<int, char*>::iterator shiningit; #endif Then you wanna create your function for your python module #include "StdAfx.h" #include "ShiningSettings.h" PyObject* addEffect(PyObject* poSelf, PyObject* poArgs) { int vnum; char* effectpath; if(!PyTuple_GetInteger(poArgs, 0, &vnum)) { return Py_BuildException(); } if(!PyTuple_GetString(poArgs, 1, &effectpath)) { return Py_BuildException(); } if(!shiningdata.count(vnum)){ shiningdata[vnum] = effectpath; } return Py_BuildNone(); } void initShining() { static PyMethodDef s_methods[] = { { "Add", addEffect, METH_VARARGS }, { NULL, NULL }, }; Py_InitModule("Shining", s_methods); } Link to comment Share on other sites More sharing options...
Recommended Posts