I made a script to get the position of the player and set pixel position via the target coords.
The getpixelpoz - gets the value of the selected target and passes it into the setcharacterpoz to teleport to the targetQuote:
GameFunctions::getpixelpoz getpixelpoz{};
/* GameFunctions::getpixelpoz GameFunctions::PixelPosition(long vid) {
PyObject* pixelpoz = PyObject_GetAttrString(gf.chr, "GetPixelPosition");
PyObject* args = PyTuple_Pack(1, PyInt_FromLong(vid));
PyObject* ppoz = PyObject_Call(pixelpoz, args, NULL);
getpixelpoz ppozstruct{};
ppozstruct.x = PyInt_AsLong(PyTuple_GetItem(ppoz, 0));
ppozstruct.y = PyInt_AsLong(PyTuple_GetItem(ppoz, 1));
Py_XDECREF(ppoz);
Py_XDECREF(args);
Py_XDECREF(pixelpoz);
return ppozstruct;
}; */
GameFunctions::setplayerpoz setplayerpoz{};
/*
void GameFunctions::setcharacterpoz(long x, long y, long z)
{
PyObject* PixelPozSet = PyObject_GetAttrString(gf.chr, "SetPixelPosition");
PyObject* args = PyTuple_Pack(3, PyLong_FromLong(x), PyLong_FromLong(y), PyLong_FromLong(z));
PyObject* set_result = PyObject_CallObject(PixelPozSet, args);
Py_XDECREF(args);
Py_XDECREF(set_result);
Py_XDECREF(PixelPozSet);
};
GameFunctions gamefunc;
Calling the function:
Sometimes it works sometimes it returns a crash. can you advice me in increasing the performance of the script?Quote:
int targetid = gamefunc.GetTargetVid();
gamefunc.setcharacterpoz(getpixelpoz.x +10, abs(getpixelpoz.y),1);
packet.SendAttackPacket((void*)packet.networkA4, 0, targetid);
Additionally i wanted to get all the mobs around the player but cannot figure it how to do it so I took this aproach:
But it returns in a crash because of the computation time i think, so its not a good aproach.Quote:
int index = gamefunc.GetMainPlayerIndex();
for (long i = index - 200000; i < index + 100000; i += 2)
{
float distance= functions.GetCharacterDistance(i);
if (distance> 0 && distance < 1000 && gamefunc.IsEnemy == 1 && gamefunc.GetInstanceType == 0)
{
packet.SendAttackPacket((void*)vb.networkA4, 0, i);
}
}







