Jump to content

Armor Effects with Python


Recommended Posts

  • Premium
On 9. 6. 2016 at 3:52 PM, Sonitex said:

 

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);
}
 
 

SOS :P

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...
  • Management

I have this error:

	0923 10:17:16255 :: Traceback (most recent call last):
	0923 10:17:16255 ::   File "networkModule.py", line 239, in SetGamePhase
	0923 10:17:16255 ::   File "game.py", line 89, in __init__
	0923 10:17:16255 :: NameError
0923 10:17:16255 :: : 
0923 10:17:16255 :: global name 'effecttable' is not defined
0923 10:17:16255 :: 

raw

raw

Link to comment
Share on other sites

Announcements



×
×
  • 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.