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 


New to Cheat Engine
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Sat Jul 23, 2011 4:52 pm    Post subject: New to Cheat Engine Reply with quote

I know of an easy way to find all the Weapons in any zone/chapter of Fear 3
I know how to set Infinite Ammo & No Reload on any of these weapons with out fear of crashing the game.

What I need help with, is getting Cheat Engine to create a Trainer to do this instead of manually changing the values.

In a nut shell, I search fear 3 process for Text string Reload_State
I then look at each address -74h for a Text string (see list below)
Assault_Rifle
CAS
Handgun
SMG
Sniper
UZI
RocketLauncher
Flechette

if the address -74h has one of these strings at -74h it's one of the 2 weapons equiped or one that can be picked up in this zone.
if -74h does have one of these strings skip that address

Reload_State = address found
Reload_State - 74h = weapon type
Reload_State -12Ch = spare ammo low ammo trigger
Reload_State -130h = loaded low ammo warning trigger
Reload_State -134h = 01h = Reload 00h = no reload
Reload_State -138h = spare ammo (max = max clip ammo times max clips)
Reload_State -140h = max clips you can carry
Reload_State -144h = loaded ammo
Reload_State -150h = max ammo per clip

Once I know that -74h is a weapon I can edit -134h to 00h to give no reload for that weapon

I never need to change any ammo value risking a game crash
game crashes happen when values listed above don't match up q:

Is there a way to write a LUA script to search for Reload_State
then search -74 for weapons type & if true
edit -134h to 00
& do this with each address found?

if so I can then create a trainer that will enable Infinite Ammo with Infinite Symbol displayed on screen inplace of spare ammo value q:
Along with setting all Weapons to No Reload or setting weapons by type to these values

Thanks for any help given
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Sat Jul 23, 2011 7:17 pm    Post subject: Reply with quote

easiest method: Convert the text "Reload_State" to an array of byte and use lua's AOBScan function

then traverse the list and for each address use readString(address-offset, charcount) and check if the string is what it should be

if not, try another result of the aobscan...

alternatively, use the MemScan and FoundList classes for full blown CE memory scanning, but I really suggest you try the aobscan method first

Currently don't have much time to write this whole script for you, but look up these functions and experiment, and ask specific questions. Or someone else can implement this

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Jul 23, 2011 8:32 pm    Post subject: Reply with quote

Here's a function I wrote to convert a string to its bytes:

Code:

function string.tobytes( str )
    if str == nil then return nil; end

    local end_string = "";

    for n = 1, #str do
        local sChar = string.sub( str, n, n );
        local sByte = string.byte( sChar );
        end_string = end_string .. string.format( '%02X', sByte );
        if n ~= #str then end_string = end_string .. ' '; end;
    end

    return end_string;
end


Which you can use like this:
Code:
local str = string.tobytes( 'Reload_State' );



Edit --


Here's a bit more in depth example, I'm using winmine.exe as my test since I don't have Fear so you can change winmine.exe to fear3.exe or whatever the executable is called:

Code:

function string.tobytes( str )
    if str == nil then return nil; end

    local end_string = "";

    for n = 1, #str do
        local sChar = string.sub( str, n, n );
        local sByte = string.byte( sChar );
        end_string = end_string .. string.format( '%02X', sByte );
        if n ~= #str then end_string = end_string .. ' '; end;
    end

    return end_string;
end

-- Set process..
local autoattach = getAutoAttachList();
strings_add( autoattach, 'winmine.exe' ); -- Add your process here..

-- Scan for word..
local scan = AOBScan( string.tobytes( 'Minesweeper' ) );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        print( addr ); -- SEE BELOW!!
    end
    object_destroy( scan );
end


The line I marked 'SEE BELOW!!' is where you will have the ability to use the scan results. addr contains the current address found within the scan's stringlist.

You can adjust the address to the -74h there and read the bytes at the new address to compare to the other strings and such. Be sure that object_destroy gets called on the scan results though.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Sun Jul 24, 2011 12:44 am    Post subject: Reply with quote

The script works great & will return the same 34 address that I get with a text search in cheat engine for Reload_State
now I just have to work out the rest of it & I'm good to go

Thanks
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Mon Jul 25, 2011 12:28 am    Post subject: Reply with quote

I might be in over my head with this, so I'll give the info needed to set Infinite Ammo with Infinite Symbol displayed on the screen in hopes someone can use it.
From Reload_State -158h you should see the byte 69h or 68h (sometimes on a handgun it will be 2Fh) change that byte to 2Ah to enable the ingame Infinite Ammo & display the Infinite Symbol in place of the spare ammo value.
the game will not allow you to set this value back to the normal value!

Also you might want to try changing Reload_State -14Ch the byte is normally set to 01h changing that byte to 00h will cause that weapons loaded ammo to drop to 0 & reload an empty clip, each time the weapon is fired after that it will reload an empty clip, doesn't matter how much spare ammo the weapon has q:
Always a good joke to play on a frirend/roommate
setting that byte to 02h will force a double reload giving the weapon twice the normal ammo. setting to 03h or higher has the same effect as 02h only double reload.
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Wed Jul 27, 2011 3:38 am    Post subject: Reply with quote

I don't really need to convert the String to bytes, so this will work

Code:

local autoattach = getAutoAttachList();
strings_add( autoattach, 'F.E.A.R. 3.exe' );

local scan = AOBScan( "52 65 6C 6F 61 64 5F 53 74 61 74 65" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        print( addr );
        print ( readString( 0x0509FDF0 -0x74, 0x4 ) );
    end
    object_destroy( scan );
end


I know that 0509FDF0 is the first address returned & I know it's a Handgun
The above code will return
0509FDF0
Han

how do I prefex addr with 0x so that I can check each address found?

all I need to look at is the first 3 bytes for the different weapon types
Assault_Rifle
CAS
Flechette
Handgun
RocketLauncher
SMG
Sniper
UZI
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Wed Jul 27, 2011 9:13 am    Post subject: Reply with quote

tip:
you can also do:
print ( readString( "0509FDF0-74", 4 ) )

and also:
readString( addr.."-74", 4 )

but if you really want it as a number:
addr= tonumber( "0x" .. addr );

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Wed Jul 27, 2011 12:02 pm    Post subject: Reply with quote

thanks
print ( readString( addr.."-74", 4 ) );
works fine & keeps things simple

Code:

local autoattach = getAutoAttachList();
strings_add( autoattach, 'F.E.A.R. 3.exe' );

local scan = AOBScan( "52 65 6C 6F 61 64 5F 53 74 61 74 65" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        print( addr );
        print ( readString( addr.."-74", 4 ) );
    end
    object_destroy( scan );
end


this code will filter out address that are not weapons

Code:

local autoattach = getAutoAttachList();
strings_add( autoattach, 'F.E.A.R. 3.exe' );

local scan = AOBScan( "52 65 6C 6F 61 64 5F 53 74 61 74 65" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        if ( readString( addr.."-74", 4 ) ) == "Ass"
         then print (addr.."   Assault Rifle");
        elseif ( readString( addr.."-74", 4 ) ) == "CAS"
          then print (addr.."   Combat Assault Shotgun");
        elseif ( readString( addr.."-74", 4 ) ) == "Fle"
         then print (addr.."   Flechette");
        elseif ( readString( addr.."-74", 4 ) ) == "Han"
         then print (addr.."   Handgun");
        elseif ( readString( addr.."-74", 4 ) ) == "Roc"
         then print (addr.."   Rocket Launcher");
        elseif ( readString( addr.."-74", 4 ) ) == "SMG"
         then print (addr.."   Submachine gun");
        elseif ( readString( addr.."-74", 4 ) ) == "Sni"
         then print (addr.."   Sniper Rifle");
        elseif ( readString( addr.."-74", 4 ) ) == "UZI"
         then print (addr.."   Dual UZI's");
        elseif  print (addr.."   skip over") then
         end
    end
    object_destroy( scan );
end


each address is flagged by weapons type or flagged skip over
now just have to edit 1 byte at two offsets to enable:
Infinite Ammo -158h set to 2Ah to enable
No Reload -134h set to 00h to enable
for listed weapons
effects will follow weapon from zone to zone until you reload checkpoint/restrat mission or exit game (game does not save cheats).
if a new weapon is droped by an NPC that's not enabled, just run script again
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Thu Jul 28, 2011 1:53 pm    Post subject: Reply with quote

How do I write a byte to the process memory with a lua script?

writeByte( addr.."-158", "2A" )

gives an error if add to the script above
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Thu Jul 28, 2011 2:02 pm    Post subject: Reply with quote

try
writeBytes(addr.."-158", 0x2a)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Thu Jul 28, 2011 3:06 pm    Post subject: Reply with quote

Just a heads up, rather then reading multiple times, you should read once and use a local variable to do your if checks.

Like:
Code:

for n = 0, scan_num - 1 do
   local addr = strings_getString( scan, n );
   local val  = readString( addr .. "-74", 4 );

   if val == "Ass" then print( 'Assault rifle' );
   elseif val == "CAS" then print( 'Combat Assault Shotgun' );
   elseif val == "Fle" then print( 'Flechette' );
   elseif val == "Han" then print( 'Handgun' );
   elseif val == "Roc" then print( 'Rocket Launcher' );
   elseif val == "SMG" then print( 'Submachine Gun' );
   elseif val == "Sni" then print( 'Sniper Rifle' );
   elseif val == "UZI" then print( 'Dual UZIs' );
   else
      print( addr .. ': was skipped over' );
   end
end

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Thu Jul 28, 2011 3:16 pm    Post subject: This post has 1 review(s) Reply with quote

thanks that worked
knew it had to be something simple that I was over looking

This Lua script will set all weapons* to Inifinite Ammo & No Reload for
Retail steam single player Fear 3
Thanks to Dark Byte & Wiccaan for there help in writing this Script
Code:

local autoattach = getAutoAttachList();
strings_add( autoattach, 'F.E.A.R. 3.exe' );

local scan = AOBScan( "52 65 6C 6F 61 64 5F 53 74 61 74 65" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        if ( readString( addr.."-74", 4 ) ) == "Ass"
         then print (addr.."   Assault Rifle   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "CAS"
         then print (addr.."   Combat Assault Shotgun   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Fle"
         then print (addr.."   Flechette   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Han"
         then print (addr.."   Handgun   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Roc"
         then print (addr.."   Rocket Launcher   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "SMG"
         then print (addr.."   Submachine gun   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Sni"
         then print (addr.."   Sniper Rifle   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "UZI"
         then print (addr.."   Dual UZI's   "..( readString( addr.."-158", 2 ) ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-158", 0x2a)
        elseif  print (addr.."   skip over")
         then
          end
    end
    object_destroy( scan );
end


* weapons list is dinamic & changes as you play/kill npc's/pickup or drop weapons if you encounter a weapon that is not set to Infinite Ammo No Reload
just run script again

note that droping a weapon set to Infinite Ammo acts the same as droping
a weapon with 0 ammo. It will disapear.
equiped weapons should retain the Infinite Ammo No Reload when you change
zones.
after running this script 1 time you can turn off Cheat Engine & still have Infinite
Ammo No Reload on the weapons q:

the first time you run this script the AutoAttachList window shows a list
of Addresses where Reload_State was found, weapon type, & a character
/ * h or i
these were used in my testing of the script. I left them in because sometimes
you will note a / or an * those weapons are already set to Infinite Ammo by
the game you just need to find them q;
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Fri Jul 29, 2011 9:24 am    Post subject: Reply with quote

I've been playing around with this script to find the addresses for the Frag, Flash, & Zap Grenades (not fully tested yet)
It should set the grenades to the max you can carry & enable unlimited grenades
you might have to cycle though the grenades once to update the screen
The first 3 addresses will be for the ones equiped
the rest will be the addresses of grenades that can be picked up in the zone

Code:

local autoattach = getAutoAttachList();
strings_add( autoattach, 'F.E.A.R. 3.exe' );

local scan = AOBScan( "52 65 6C 6F 61 64 5F 53 74 61 74 65" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr = strings_getString( scan, n );
        if ( readString( addr.."-74", 4 ) ) == "Ass"
         then print (addr.."   Assault Rifle   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 24   max clips "..(readBytes( addr.."-140") ) );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x18)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "CAS"
         then print (addr.."   Combat Assault Shotgun   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 12   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x0c)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Fle"
         then print (addr.."   Flechette   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 12   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x0c)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Han"
         then print (addr.."   Handgun   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 12   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x0c)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Roc"
         then print (addr.."   Rocket Launcher   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 1   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x01)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "SMG"
         then print (addr.."   Submachine gun   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 35   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x23)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "Sni"
         then print (addr.."   Sniper Rifle   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 5   max clips "..(readBytes( addr.."-140") )  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x5)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "UZI"
         then print (addr.."   Dual UZI's   "..( readString( addr.."-158", 2 ) ).."   max ammo per clip 35   max clips "..(readBytes( addr.."-140") ).."   double values displayed on screen"  );
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x23)
              writeBytes( addr.."-158", 0x2a)
        elseif  print (addr.."   skip over")
         then
          end
    end
    object_destroy( scan );
end

local scan = AOBScan( "02 00 00 00 02 00 00 00 FF FF FF FF" );
if scan ~= nil and strings_getCount( scan ) > 0 then
    local scan_num = strings_getCount( scan );
    for n = 0, scan_num - 1 do
        local addr1 = strings_getString( scan, n );
        local max1 = ( readBytes( addr1.."+2c") );
        if ( readString( addr1.."+104", 6 ) ) == "FragG"
         then print (addr1.."   Frag Grenade     ".." found "..( readBytes( addr1.."+34") ).."   max allowed is "..( readBytes( addr1.."+2c") ) );
              writeBytes( addr1.."+34", max1)
              writeBytes( addr1.."+44", 0x00)
        elseif ( readString( addr1.."+104", 6 ) ) == "Flash"
         then print (addr1.."   Flash Grenade   ".." found "..( readBytes( addr1.."+34") ).."   max allowed is "..( readBytes( addr1.."+2c") ) );
              writeBytes( addr1.."+34", max1)
              writeBytes( addr1.."+44", 0x00)
        elseif ( readString( addr1.."+104", 6 ) ) == "Zap_G"
         then print (addr1.."   Zap Grenade   ".." found "..( readBytes( addr1.."+34") ).."   max allowed is "..( readBytes( addr1.."+2c") ) );
              writeBytes( addr1.."+34", max1)
              writeBytes( addr1.."+44", 0x00)
          end
    end
    object_destroy( scan );
end


(after a bit of testing, made a few changes to script for grenades)

is there any easy way to combine the first 2 searches into 1 search?
only the first character is different.
if I leave the first charter off, the search will give the same results as all 3 searches but made it harder to tell the address for equiped grenades
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Sat Aug 06, 2011 4:38 am    Post subject: Reply with quote

this script finds the second address of two address for the Phase Beam

Code:

local autoattach = getAutoAttachList();
strings_add(autoattach, 'F.E.A.R. 3.exe');

local scan = AOBScan("00000000FFFFFFFF34");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr2 = strings_getString(scan, n);
        if (readString(addr2.."+17", 2)) == "?"
         then print (addr2.."   Phase Beam   "
              .."   max charge = 3FF0000000000000   "
              .."addr2 +10 = current charge, 8 bytes");
          end
    end
    object_destroy( scan );
end


what needs to be changed/added to get these values returned in AutoAttachList box?

FFFFFFFF3499CD0603 array of bytes used to find address 1 -- addr2(-295) 9 bytes
06CDF8D0 Phase Beam address 1 -- first of 2 addresses returned when searching for above array of bytes & is 0C bytes before current charge
0781D25D Phase Beam address 2 -- is addr2 & is working in script
3FF0000000000000 max charge -- addr2(-259) 8 bytes on a x64 system
3Fxxxxxxxx000000 current charge -- addr2(-289) 8 bytes xxxxxxxx are the only bytes that change when weapon is fired on a x64 system

the 9 byte array & the adresses change every time game is started
max charge on a x32 system is 3F800000 from what I have been told
at some point I will install game on a x32 system to check this out & adjust the script to work with both x32 & x64 systems
Back to top
View user's profile Send private message
IceTeaMan
Newbie cheater
Reputation: 1

Joined: 23 Jul 2011
Posts: 19

PostPosted: Sat Aug 06, 2011 9:12 pm    Post subject: Reply with quote

still working on the laser weapon, Can now find the addresses for both Phase Beams on the Bridge where the Heavy Mech is.
The one that drops on top of the 18 wheeler uses a 64 bit floating point for 1.0
& the one droped near the Heavy Mech's control room uses a 32 bit floating point for 1.0
This script will give the addresses for both Phase Beams & change the 32 bit ones charge state from 1.0 to 1000.0 with no ill effects on the game even when changing zones

Code:

local autoattach = getAutoAttachList();
strings_add(autoattach, 'F.E.A.R. 3.exe');

local scan = AOBScan("52 65 6C 6F 61 64 5F 53 74 61 74 65");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr = strings_getString(scan, n);
        if ( readString( addr.."-74", 4 ) ) == "Ass"
         then print (addr.."   Assault Rifle   "..(readString(addr
              .."-158", 2)).."   max ammo per clip 24   max clips "
              ..(readBytes(addr.."-140")));
              writeBytes( addr.."-134", 0x00)
              writeBytes( addr.."-144", 0x18)
              writeBytes( addr.."-158", 0x2a)
        elseif ( readString( addr.."-74", 4 ) ) == "CAS"
         then print (addr.."   Combat Assault Shotgun   "..(readString(addr
              .."-158", 2)).."   max ammo per clip 12   max clips "
              ..(readBytes(addr.."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x0c)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "Fle"
         then print (addr.."   Flechette   "..(readString(addr.."-158", 2))
              .."   max ammo per clip 12   max clips "..(readBytes(addr
              .."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x0c)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "Han"
         then print (addr.."   Handgun   "..(readString(addr.."-158", 2))
              .."   max ammo per clip 12   max clips "..(readBytes(addr
              .."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x0c)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "Roc"
         then print (addr.."   Rocket Launcher   "
              ..(readString(addr.."-158", 2))
              .."   max ammo per clip 1   max clips "
              ..(readBytes(addr.."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x01)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "SMG"
         then print (addr.."   Submachine gun   "..(readString(addr.."-158", 2))
              .."   max ammo per clip 35   max clips "..(readBytes(addr
              .."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x23)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "Sni"
         then print (addr.."   Sniper Rifle   "..(readString(addr.."-158", 2))
              .."   max ammo per clip 5   max clips "..(readBytes(addr
              .."-140")));
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x5)
              writeBytes(addr.."-158", 0x2a)
        elseif (readString(addr.."-74", 4)) == "UZI"
         then print (addr.."   Dual UZI's   "..(readString(addr.."-158", 2))
              .."   max ammo per clip 35   max clips "..(readBytes(addr
              .."-140")).."   double values displayed on screen");
              writeBytes(addr.."-134", 0x00)
              writeBytes(addr.."-144", 0x23)
              writeBytes(addr.."-158", 0x2a)
        elseif  print (addr.."   skiped over")
         then
          end
    end
    object_destroy(scan);
end

local scan = AOBScan("02 00 00 00 02 00 00 00 FF FF FF FF");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr1 = strings_getString(scan, n);
        local max1 = (readBytes(addr1.."+2c"));
        if (readString(addr1.."+104", 6)) == "FragG"
         then print (addr1.."   Frag Grenade     ".." found "..(readBytes(addr1
              .."+34")).."   max allowed is "..(readBytes(addr1.."+2c")));
              writeBytes(addr1.."+34", max1)
              writeBytes(addr1.."+44", 0x00)
        elseif (readString(addr1.."+104", 6)) == "Flash"
         then print (addr1.."   Flash Grenade   ".." found "..(readBytes(addr1
              .."+34")).."   max allowed is "..(readBytes(addr1.."+2c")));
              writeBytes(addr1.."+34", max1)
              writeBytes(addr1.."+44", 0x00)
        elseif (readString(addr1.."+104", 6)) == "Zap_G"
         then print (addr1.."   Zap Grenade   ".." found "..(readBytes(addr1
              .."+34")).."   max allowed is "..(readBytes(addr1.."+2c")));
              writeBytes(addr1.."+34", max1)
              writeBytes(addr1.."+44", 0x00)
          end
    end
    object_destroy( scan );
end
local scan = AOBScan("00000000FFFFFFFF34"); -- returns 2 addresses both for same Phase Beam
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr2 = strings_getString(scan, n);
        if (readString(addr2.."+17", 2)) == "?"
         then print (addr2.."   Phase Beam 1   "
              .."   max charge = 3FF0000000000000   "
              .."addr2 +10 = current charge, 8 bytes");
          end
    end
    object_destroy( scan );
end
local scan = AOBScan("AA0400000000000100");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr3 = strings_getString(scan, n);
        if (readString(addr3.."+11", 2)) == "?"
         then print (addr3.."   Phase Beam 2"
              .."   max charge = 3F800000   "
              .."addr3 +0E = current charge, 4 bytes");
              writeBytes(addr3.."+0e", 0x00)
              writeBytes(addr3.."+0f", 0x00)
              writeBytes(addr3.."+10", 0x7a)
              writeBytes(addr3.."+11", 0x44)
              print (addr3.."   Phase Beam charge increased from 1.0 to 1000.0")
          end
    end
    object_destroy( scan );
end
local scan = AOBScan("AA0400000100000001");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr4 = strings_getString(scan, n);
        if (readString(addr4.."+11", 2)) == "?"
         then print (addr4.."   Phase Beam 2"
              .."   max charge = 3F800000   "
              .."addr4 +0E = current charge, 4 bytes");
              writeBytes(addr4.."+0e", 0x00)
              writeBytes(addr4.."+0f", 0x00)
              writeBytes(addr4.."+10", 0x7a)
              writeBytes(addr4.."+11", 0x44)
              print (addr4.."   Phase Beam charge increased from 1.0 to 1000.0")
          end
    end
    object_destroy( scan );
end
local scan = AOBScan("20680000000000000040316300");
if scan ~= nil and strings_getCount(scan) > 0 then
    local scan_num = strings_getCount(scan);
    for n = 0, scan_num - 1 do
        local addr5 = strings_getString(scan, n);
        if (readString(addr5.."+10", 2)) == "?"
         then print (addr5.."    Health floating point   "
              .."   max Health = 3F800000   "
              ..addr5.." +0D = current health, 4 bytes");
          end
    end
    object_destroy( scan );
end


add script to find address of Health
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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)   Twitter
Third party websites