Jump to content
Sign in to follow this  
noanshadow

How can edit Mobs/monster size

Recommended Posts

It's easy:

 

spacer.png

 

Source for this tools for ver GAME_13X_1:

#include <Windows.h>
#include <detours/detours.h>

#include "loader.h"

typedef struct _D3DVECTOR { float x; float y; float z; } D3DVECTOR;

typedef struct D3DXVECTOR3 : public D3DVECTOR
{
public:

	D3DXVECTOR3(FLOAT x, FLOAT y, FLOAT z);
	void SetNewScaleParam(FLOAT x = 1.0f, FLOAT y = 1.0f, FLOAT z = 1.0f) { this->x = x; this->y = y; this->z = z; };

} D3DXVECTOR3, * LPD3DXVECTOR3;

D3DXVECTOR3::D3DXVECTOR3(FLOAT fx, FLOAT fy, FLOAT fz)
{
	x = fx;
	y = fy;
	z = fz;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	return TRUE;
}

D3DXVECTOR3 newScaleAddr(1.0f, 1.0f, 1.0f);

const DWORD OldScaleStruct_Addr = 0x004D7A69;

const DWORD AddCharacter_Addr = 0x004D7690;
typedef void*(__thiscall* AddCharacter_Ptr)(void* This, int nScriptID);
AddCharacter_Ptr AddCharacter = (AddCharacter_Ptr)(void*)(AddCharacter_Addr);

void* __fastcall hooked_AddCharacter(void* This, void* NotUsed, unsigned int nScriptID) {

	if (nScriptID > 4)
		newScaleAddr.SetNewScaleParam(2.5f, 2.5f, 2.5f);
	else
		newScaleAddr.SetNewScaleParam();

	return AddCharacter(This, nScriptID);

}

void GetModInformation(mod_info& info)
{
	strcpy_s(info.name, "pkodev.mod.characterscale");
	strcpy_s(info.version, "1.0");
	strcpy_s(info.author, "Free Mod");
	info.exe_version = GAME_13X_1;
}

void Start(const char* path)
{

	DWORD OldProt;

	VirtualProtect((LPVOID)OldScaleStruct_Addr, 5, PAGE_EXECUTE_READWRITE, &OldProt);

	*(char*)0x004D7A69 = (char)0x68;
	*(DWORD*)((DWORD)OldScaleStruct_Addr + 1) = (DWORD) &newScaleAddr;

	VirtualProtect((LPVOID)OldScaleStruct_Addr, 5, OldProt, &OldProt);


	DetourRestoreAfterWith();
	DetourTransactionBegin();
	DetourAttach(&(PVOID&)AddCharacter, hooked_AddCharacter);
	DetourTransactionCommit();
  
}

void Stop()
{

	DetourTransactionBegin();
	DetourUpdateThread(GetCurrentThread());
	DetourDetach(&(PVOID&)AddCharacter, hooked_AddCharacter);
	DetourTransactionCommit();
    
}

 

  • Like 1

Share this post


Link to post
Share on other sites

Hello @noanshadow!
 

You have to compile this code into DLL library in Visual Studio. Send your Game.exe, I will help you with it. 


Share this post


Link to post
Share on other sites

Hello @noanshadow!

 

Here you are

 

1) Install mod loader for your client;

2) Put the file "pkodev.mod.mobsize.client.13x_3.dll" to the "mods" folder;

3) Start the game.

 

Project for Visual Studio 2019 Community is included in the archive. I think it also will be compatible with 2022 version.

 

You can change the size of necessary monster by it's ID in void* __fastcall hooked_AddCharacter(void* This, void* NotUsed, unsigned int nScriptID) function, for example:

void* __fastcall hooked_AddCharacter(void* This, void* NotUsed, unsigned int nScriptID)
{
	// Check that monster is the Piglet
	if (nScriptID == 237)
	{
		// Change Piglet's size
		newScaleAddr.SetNewScaleParam(2.5f, 2.5f, 2.5f);
	}
	else
	{
		// Do not change the size
		newScaleAddr.SetNewScaleParam();
	}
		
	return AddCharacter(This, nScriptID);
}

Do not forget to rebuild the mod after the changes.

  • Thanks 1

Share this post


Link to post
Share on other sites

address for game.exe 13x_0.

const DWORD OldScaleStruct_Addr = 0x004D7959;

const DWORD AddCharacter_Addr = 0x004D7580;

 

  • Thanks 2

Being better than others is for those who are weak; what matters is to be true to yourself.         

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...