int UnitToPtr(int unit)
parameter:
int unit
- valid id in native script of any unit.
returns
- unit struct pointer address
Native Script Code::
- Code: Select all
int ImportUnitToPtrFunc()
{
int arr[10], link;
if (!link)
{
arr[0] = 0x50725068; arr[1] = 0x2414FF00; arr[2] = 0x511B6068; arr[3] = 0x54FF5000; arr[4] = 0xC4830424;
arr[5] = 0x7230680C; arr[6] = 0xFF500050; arr[7] = 0x83042454; arr[8] = 0xC03108C4; arr[9] = 0x909090C3;
CancelTimer(FrameTimerWithArg(10, ImportUnitToPtrFunc, ImportUnitToPtrFunc));
link = GetMemory(GetMemory(0x75ae28) + (0x30 * GetMemory(GetMemory(0x83395c) + 8) + 0x1c));
}
return link;
}
int UnitToPtr(int unit)
{
int temp = GetMemory(0x5c336c), res;
SetMemory(0x5c336c, ImportUnitToPtrFunc());
res = Unknownb8(unit);
SetMemory(0x5c336c, temp);
return res;
}
You have to call 'ImportUnitToPtrFunc' function in MapInitialize before using.
Output:
Requirements::
- Nox Original (1.2b)
- script compiler with support memory read/write