View previous topic :: View next topic |
Author |
Message |
GreatUnknown Cheater
Reputation: 0
Joined: 19 Oct 2014 Posts: 47
|
Posted: Sun Oct 19, 2014 11:51 pm Post subject: Rearding Infintie Ammo |
|
|
I've always thought, seeing as how GTA Vice City has tons of guns. Same for SR when I see infinite ammo did the creator have to use every weapon in finds its base etc.
Or did they use data strctures in some forms?
Thanks
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Oct 20, 2014 1:51 am Post subject: |
|
|
In most cases, you only have to find one address. From there, you can see which instructions access that address. There is usually one or more instructions that handle ALL ammo addresses. Easy.
|
|
Back to top |
|
 |
GreatUnknown Cheater
Reputation: 0
Joined: 19 Oct 2014 Posts: 47
|
Posted: Mon Oct 20, 2014 2:37 am Post subject: |
|
|
++METHOS wrote: | In most cases, you only have to find one address. From there, you can see which instructions access that address. There is usually one or more instructions that handle ALL ammo addresses. Easy. |
Ah I see so find the static address of a pistol, and find what access that address add it and lock it? Could you or anyone else eleabrate or link to a video or info about this. I've always wondered how to make a Inf Ammo hack but I knew there was no way someone went through 40 weapons.
|
|
Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Mon Oct 20, 2014 6:25 am Post subject: |
|
|
There are mostly 2 ways you can easy code such a thing:
1)
The game devs did something like this:
Code: |
public class Player {
private int health = 100;
private int someOtherRessource = 10;
[b][i]private Weapon playerGun = null;[/i][/b]
}
public class Ak47 : Weapon {
public Ak47() {
super.totalAmmo = 90;
super.magAmmo = 30;
}
}
|
The variable playerGun is inside the Player structure, so if you find the base address of the player structure you can always find the address of the current gun, the player is holding. Because you always can find this gun address, you also can find the ammo of the current gun, the player is holding So you simply have a pointer-chain, that you dereference.
2)
The second way would be you find which opcode decreases the ammo, that occurs when you shoot. Then simply NOPing it away and your ammo wouldnt decrease. But care, if this opcode handles all guns currently available, then you will make infinite ammo also for the NPCs. You need to compare some structures access by the opcode and then determine some flags that say "DECREASE PLAYER AMMO".
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Oct 20, 2014 12:01 pm Post subject: |
|
|
GreatUnknown wrote: |
Ah I see so find the static address of a pistol | -No. You don't have to find static anything. That's the beauty of code injection. Just find the ammo address for one of your weapons. Once you have found it, test it by changing the value to see if your ammo in-game changes and fire a few shots to be sure that it doesn't revert back to the original value. Once that is done, right-click on the ammo address that you found and check to see which instructions are accessing that address. From there, you can check to see which instruction accesses all of the ammo addresses. Once you have found one, inject some code and write your infinite ammo script.
If you need help with choosing the right instruction and/or writing your script etc., just post your question(s)/script here.
|
|
Back to top |
|
 |
GreatUnknown Cheater
Reputation: 0
Joined: 19 Oct 2014 Posts: 47
|
Posted: Fri Jan 23, 2015 4:51 am Post subject: |
|
|
Sorry forgot to say thanks, will give it a go! Make a lot of sense in terms of OOP. What about say if one weapons ammo is stored in float, would that impact it?
|
|
Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Fri Jan 23, 2015 5:36 am Post subject: |
|
|
GreatUnknown wrote: | What about say if one weapons ammo is stored in float |
Referencing to data structures, this wont make a real difference. Data is still positioned next to each other in-memory. However, if you are dealing with a float in code-injection, then there is a difference because floats get calculated with the FPU and use special instructions for this. Just inject some code right after the new calculated float ammo value gets moved to the memory destination. Looks somehow like this:
Code: |
Game decreases ammo value
Move new ammo value to memory
Jump to your code cave
Move your own ammo value to memory
Jump back to origin
Game executes code with your new given ammo value
|
|
|
Back to top |
|
 |
GreatUnknown Cheater
Reputation: 0
Joined: 19 Oct 2014 Posts: 47
|
Posted: Fri Jan 23, 2015 8:06 am Post subject: |
|
|
What if while firing weapons one gun is float such as an ak and one like a plasma gun is float. Would there still be a an instruction to access all ammo? I know from my bit of C++ floats convert to int if told to. Depends on how the developers made the game.
I find what writes to the pistol address, all weapons apart from plasa weapons do. However I'm confused on how I'm going to narrow it down?
|
|
Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Fri Jan 23, 2015 9:24 am Post subject: |
|
|
GreatUnknown wrote: | Would there still be a an instruction to access all ammo |
That's up to the gamedevelopers, how they implemented it...
GreatUnknown wrote: | all weapons apart from plasa weapons do |
Yeah, this plasma gun might use another function/algorithm that decreases the plasma ammo. The easiest way might be to find the plasma guns current ammo address with CE and the check what writes to this address, when you shoot with the plasma gun
|
|
Back to top |
|
 |
GreatUnknown Cheater
Reputation: 0
Joined: 19 Oct 2014 Posts: 47
|
Posted: Fri Jan 23, 2015 10:48 am Post subject: |
|
|
With Wolfenstein TNO all you have to do is nop the machine gun ammo and it works for all bullets based guns, I presume most games share the same instruction to access ammo (wishful thinking). But cheers Shame disarming enemies doesn't work, only works per room as the enemies spawn with different weapons, armour etc. Still experimenting is always fun One hit kill is an interesting one, as is invisibility.
Though how do people make a ghost hack such as A.I not seeing them, how would I find that for example? And also one hit kills what would I need to do into auto assembly.
A lot of questions I know
|
|
Back to top |
|
 |
|