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 


Generall ways of making a charachter shoot/attack

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Sun Oct 12, 2014 12:03 pm    Post subject: Generall ways of making a charachter shoot/attack Reply with quote

Hey everyone,

what is the general way to make a charachter in a shooter shoot, without sending a click event to the game ?.

I managed to get Charachters walk across the map by reverse engineering and finding out what triggers the walking procedures. But I do have problems finding Variables that I need to change in order for the game to think "ok I have to send an fire command now" (Like "0x042323 is 1" so left mouse has been pressed ie.).

I tried using ultimap, and checking for all functions that have been executed the X time i have fired, going back in these functions to see where and why they were called, but I didnt have any luck yet.

Any help or general ideas would be appreciated.
Back to top
View user's profile Send private message
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 4:25 am    Post subject: Reply with quote

penpenpen wrote:
But I do have problems finding Variables

You maybe just didnt search right. There will definitely be a variable that changes on a specific keypress to indicate you are shooting. Try with "All" datatypes and go ahead with "Changed/Unchaged" filtering. You will find plenty of addresses (recoil, spread, animations, ammo ...) and then have to manually find out which one is the right one... IMO it will be a smaller number.

Good luck.
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 6:04 am    Post subject: Reply with quote

Thanks for the reply.
Can you elaborate this a bit ?

I think the variable that says I'm shooting will switch back to its old value immediately after sending the command to fire (left click ie.).

So I have no clue how to find such variable that is changing immediately back, after action has been performed.
Back to top
View user's profile Send private message
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 6:43 am    Post subject: Reply with quote

penpenpen wrote:
I think the variable that says I'm shooting will switch back


That won't work technically. There has to be a value that says "shooting or not". Some pseudo-code:

Code:

while(true) {
    if(event.shooting) {
        gun.drawShootingAnimation();
        gun.ammo = gun.ammo - 1;
        gun.calculateRecoil();
        gun.calculateSpread();
    }
}


Ofcourse this is shown way easier than it is in realitiy, but the core is the if statement containing the "shooting" flag. ASAP this flag is true, the player will start shooting with all the stuff coming along this event (recoil, spread, animations). You will find addresses of this stuff, too, when scanning in the way I mentioned above.

So your excercise is to find this "shooting" flag in the memory and manipulate it to the value, so the if statement return "true" and your shooting start.
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 7:46 am    Post subject: Reply with quote

The way the game works is.

If I hold MouseLeft, one shoot is fired.
When I release the Mouse and Click Again another shoot is fired.

So the MouseClick Triggers the firing but the variable that says firing will change back to its old value until the mouse is released and clicked again.
Actualy there may be more than one variable important for the game to trigger the fire event.
Back to top
View user's profile Send private message
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 8:29 am    Post subject: Reply with quote

Sorry my fault. Was expacting an automatic rifle^^ Very Happy

Well, do you have some ammunition? If you've, than search for the ammunition and find out what writes to it. If you found the code that writes to it, you are a step closer to your function that is responsibe for shooting. Trace back from there until you found the real "shooting" function, which you can CALL then like you want (watch out for the params).
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 8:55 am    Post subject: Reply with quote

Hey.
Yeah I found that quite easily.

But the function that refreshes the ammo after you fire is called in like 200 locations in memory.

Any Idea how i could find the right call, besides testing them one by one ?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Oct 13, 2014 9:39 am    Post subject: Reply with quote

it doesn't 'have' to be a variable
it could also be a call to "get(async)keystate" for the left mouse button, and if it returns positive (state changed since last check or currently down) call the "FireGun()" method

In that case you could do a hook on get(async)keystate and make it return what you wish it to be

_________________
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
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 9:52 am    Post subject: Reply with quote

Yeah this might be, because there are probably xxx guns/magazines around you and every gun/magazin has its own call to decreasing the amount of its storing ammo. (Well, I'm not sure if this is really the case Razz Just a thought I had.) You should probably look for a CALL of this method close to your ammo address.
Which game are we talking about btw? Smile

Edit: Or try the easy way DB mentioned Razz Very Happy This sounds very legit to me. =)


Last edited by zm0d on Mon Oct 13, 2014 9:55 am; edited 1 time in total
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 9:54 am    Post subject: Reply with quote

Thanks for your input DarkByte.

The game never calls getasynckeystate.
And GetKeyState is only called if you jump out of the game.

I just went through all of the 200 adresses where the Function that decreases the ammo is called, with no luck. None of them seems to trigger the event.

So its maybe called in another dll file. Cause I did only dissect code for the main.exe.

e: Game is blades of time, you can get it for $1, if you wanna try Very Happy. Its pretty fun. The translation is lame though.
Back to top
View user's profile Send private message
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 9:58 am    Post subject: Reply with quote

So if it's in a DLL try to find it with "Enumerate DLL's and Symbols" in the Cheat Engine "Memory View". Just search for some fitting function names.
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 10:17 am    Post subject: Reply with quote

Well I dont know what it is.
I Found a function that is called whenever you shoot you can also edit some
stuff inside it to make it shoot whereever you want it.

The Function enters here:
Code:
xxxx.exe+C0C30 - 55                    - push ebp


Dissect code told me about this place in memory:
Code:
xxxx.exe+C2BA1 - 68 300C4C00           - push xxxx.exe+C0C30


But this is also not where its called.

I did also use Search -> Find assembly code to search for "call 004C0C30" with zero results.

Any Idea how to figure out where and when the function is called ?
Back to top
View user's profile Send private message
zm0d
Master Cheater
Reputation: 7

Joined: 06 Nov 2013
Posts: 423

PostPosted: Mon Oct 13, 2014 10:26 am    Post subject: Reply with quote

look a little below PUSH. PUSH well, pushes, parameter onto the stack to access them within a function, so most likely after push statements, there comes a CALL.
Back to top
View user's profile Send private message
penpenpen
Cheater
Reputation: 0

Joined: 23 Feb 2014
Posts: 39

PostPosted: Mon Oct 13, 2014 10:36 am    Post subject: Reply with quote

I think its just initializing the function or so.

It's written to some sort of list in memory. Because when i search in CE for the address(in hex) (game.exe+C0C30) I find some results.

When I search what accesses them I find functions on some of the results.

Those must be what call the "shoot" function.

The problem is that they are triggered so very often that its hard to keep track.

edit:
I found where the Shooting function is called.
It looks like this:

Code:
xxxx.exe+C8816 - 56                    - push esi
xxxx.exe+C8817 - FF 55 08              - call dword ptr [ebp+08]

When i change variables within this function it will shoot somewhere else.

But when i nop this function it still shoots.

So confusing.

Anyone with any ideas ?

Edit2:
I got it working Smile.

Easier than I thought. Just searching for what changes when the mousekey is down leads to the right things.

Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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)   Twitter
Third party websites