Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Heroes of Might and Magic V - Resources and Free Movement

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Auto Assemble scripts
View previous topic :: View next topic  
Author Message
Recifense
I post too much
Reputation: 123

Joined: 17 Mar 2008
Posts: 2572
Location: Recife - Pernambuco - Brazil

PostPosted: Tue Jul 01, 2008 10:33 am    Post subject: Heroes of Might and Magic V - Resources and Free Movement Reply with quote

Hi guys,

Somebody posted a request for a table for Heroes of Might and Magic V. So I´ve writen the following script and I want to share it with you guys.

Code:

// Heroes of Might and Magic V
// Game Version  : 1.0
// Script Version: 1.0
// CE Version    : 5.4
// Resource e MP
// 29-Jun-2008

[ENABLE]
alloc(MyCode,1024)

label(_Resource)
label(_MovePoint)
label(_Res1)
label(_Res2)
label(_MovP1)
label(_BackR)
label(_BackMP)
label(_ExitR)
label(_ExitMP)
label(pOwner)
label(pLastOne)
label(pTroops)

registersymbol(MyCode)
registersymbol(pLastOne)
registersymbol(pTroops)

//=============================
// Hacking Points
H5_Game.exe+59ef98:
 jmp _Resource
_BackR:

H5_Game.exe+463d6d:
 jmp _MovePoint
 nop
_BackMP:

MyCode:
//=========================================
// # Bullet can increase, but not decrease
// base + 0x3c = iWood
// base + 0x40 = iOre
// base + 0x44 = iMercury
// base + 0x48 = iCrystal
// base + 0x4c = iSulfur
// base + 0x50 = iGems
// base + 0x54 = iGold
_Resource:
 mov ecx,eax
 mov eax,[ecx]        // Read ptr to player

 mov [pOwner],eax     // save pointer for further use

 push ecx
 push ebx

 mov ecx,00001388             // 5000
 mov ebx,6                    // # of resource

_Res1:
 or ebx,ebx                   // Is it over?
 jz _Res2                     // Jump if true

 dec ebx
 cmp ecx,[eax+ebx*4+0000003c] // Res < 5000 ?
 jle _Res1                    // Jump if not

 mov [eax+ebx*4+0000003c],ecx // Make Res = 5000
 jmp _Res1                    // Check next resource

_Res2:
 mov ecx,0000c350             // 50000
 cmp ecx,[eax+00000054]       // Gold < 50000 ?
 jle _ExitR                   // Jump if not

 mov [eax+00000054],ecx       // Make Gold = 5000

_ExitR:
 pop ebx
 pop ecx
 ret                          // back to main code

//=========================================
// Free Movement
_MovePoint:
 mov [ecx+000000e0],eax  // Update Move Point

 mov eax,[ecx+000000dc]  // read the pointer to the hero´s owner
 cmp eax,[pOwner]        // Is it one of player´s heroes?
 jne _ExitMP             // Jump if false

 mov eax,[ecx+000000c4]  // read pointer
 or eax,eax              // Is there a pointer to troop´s structure ?
 jz _MovP1               // Jump if false

// Update pointer list of all hero´s slots for troop
 push ebx
 mov ebx,[eax]
 mov [pTroops],ebx
 mov ebx,[eax+04]
 mov [pTroops+04],ebx
 mov ebx,[eax+08]
 mov [pTroops+08],ebx
 mov ebx,[eax+0c]
 mov [pTroops+0c],ebx
 mov ebx,[eax+10]
 mov [pTroops+10],ebx
 mov ebx,[eax+14]
 mov [pTroops+14],ebx
 mov ebx,[eax+18]
 mov [pTroops+18],ebx
 pop ebx

_MovP1:
 mov eax,[ecx+000000e4]  // read max move point
 mov [ecx+000000e0],eax  // make current MP = max MP

 mov [pLastOne],ecx      // update pointer to last hero that moved

_ExitMP:
 jmp _BackMP             // back to main code

//=========================================
// Variables
pOwner:
 dd 0                    // pointer to player
pLastOne:
 dd 0                    // pointer to last hero that moved
pTroops:
 dd 0,0,0,0,0,0,0        // pointers to 7 slots for hero´s troops

//=========================================
// structure Troop
// base + 0x00 = 0x000DEE08
// base + 0x1C = itype (values from 01h to 56h)
// base + 0x20 = iqtd

// Type Exemples:
// 01 = Peasant
// 02 = Conscript
// 03 = Archer
// 04 = Marksman
// 05 = Footman
// 06 = Squire
// 07 = Griffin
// 08 = Imperial Griffin
// 09 = Priest
// 0A = Inquisitor
// 0B = Cavalier
// 0C = Paladin
// 0D = Angel
// 0E = Archangel
// and so on :)
//=========================================
// Original Codes

[DISABLE]
H5_Game.exe+59ef98:
 mov ecx,eax
 mov eax,[ecx]
 ret

H5_Game.exe+463d6d:
 mov [ecx+000000e0],eax

dealloc(MyCode)
unregistersymbol(MyCode)
unregistersymbol(pLastOne)
unregistersymbol(pTroops)


Cheers.



HMM5_Resource_MP.CEA
 Description:

Download
 Filename:  HMM5_Resource_MP.CEA
 Filesize:  3.69 KB
 Downloaded:  989 Time(s)

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Auto Assemble scripts All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)