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 


Changing Character ID Pool into NPC ID Pool?

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

Joined: 17 Mar 2020
Posts: 12

PostPosted: Mon Dec 05, 2022 10:07 am    Post subject: Changing Character ID Pool into NPC ID Pool? Reply with quote

I am playing a game wherein IDs #0-4 are male sprites and IDs #6-9 are female sprites, ID#10 and 11 are wooden base models of male and female, changing it more than 11 will crash the game

I was hoping I could change my character into a monster or an NPC but it turns out that there is a separate ID for NPCs according to the files, all the bosses and NPCs are located in the NPC ID (0 to 300) and Character IDs are for the character (0-11)

Is it possible to change a character into an NPC so it may access the NPC IDs instead of Character IDs (during character creation)?

here are some questions:

1.) Is this possible? it might be that there is a hardcoded limitation regarding character sprites? (character only for character IDs, NPC for NPC IDs), is there a way to bypass this limitation?

2.) would it likely break the game? (not being able to hit other enemies, not being able to move around, crashing etc.)

3.) how should I start?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Dec 10, 2022 4:52 am    Post subject: Reply with quote

The answer will depend on the target and how the data is being handled. Newer, 3D games will typically be much more difficult (compared to older, 2D games, for example).

It will also depend on what you are trying to achieve. For example, simply swapping character skins is much easier than swapping the entirety of a character (e.g. animations/moves, health, strength and everything else that may fall under character base structure).

As mentioned, you may face many challenges, one being A.I. control. Because of this, most people typically try to focus on skin swapping, or, resort to mods where actual game files are replaced, but that typically requires game unpacking.

1. Possible, but may not be easy.
2. Breaks can be fixed and/or avoided with proper knowledge.
3. A LOT of time and effort, trial & error.

Asking questions can help speed things up, but character swapping is not a beginner-level task, so, if you are just starting out, expect that things may not be very easy.
Back to top
View user's profile Send private message
Haru
Newbie cheater
Reputation: 0

Joined: 17 Mar 2020
Posts: 12

PostPosted: Tue Dec 13, 2022 4:40 am    Post subject: Reply with quote

Thank you Xotic and Methos, these are valuable information, I will look more into it

The game I am currently playing is Terraria with the wooden base models, although my grand goal is actually Nier Automata (9s' Hacking ability, playing as baby godzilla or other Yorha units with their own move sets) I decided to practice with Terraria's sprites first since 3d games are harder to cheat and the entity must exist in the area as what Xotic stated, which may be too advanced for my level.

Methos stated that if it is skins or move sets, for now, I am currently happy if it is only a skin swap for Terraria's sprites, while working my way up in the future

I have tried this with other games, usually they only have one pool for characters and npcs so seeing how they are separated is confusing for me, I will look if an AI switch exist in terraria as it might be the solution

Question:
1.) How do I look for enemy ID adresses more efficiently? atm I look for health values and browse them, I scroll either up or down but I am unsure where in the memory region, then I compare them in photoshop until I find something that works, I was wondering if there is a more efficient way to do this?

2.) are there other ways to look for an AI switch? the health method might not be reliable for other games wherein character and npc structure is different

I am happy I got a reply, this type of cheat is very rare, any help will be appreciated! I think these type of hacks are the most fun
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Dec 13, 2022 5:56 am    Post subject: Reply with quote

1. Use the data structure dissection tool to analyze, compare, freeze structures etc.. You can also try the structure spider tool for deeper analysis.

2. This will depend heavily on the target and how the data is being handled. Some targets may not give any indication as to what you are looking at, whilst others may clearly identify the purpose of each function.

If you were doing something easy, such as creating an infinite ammo cheat, then the same steps can be easily applied across multiple targets. When you start dealing with more advanced features, the step-by-step processes start to become murky since the data may be handled differently across targets. So the answer usually becomes 'it depends'.

Swapping skins is usually much easier because you can bypass a lot of the issues that may occur with AI control, map accessibility and even basic character functions (e.g. functionality that main character can perform, but NPC's cannot, which can cause the game to break or create brick wall scenarios).

As such, (and as a general rule of thumb) I would recommend starting with an easier approach until you have a better understanding and can navigate some of the more advanced stuff without pulling your hair out (or quitting).
Back to top
View user's profile Send private message
Haru
Newbie cheater
Reputation: 0

Joined: 17 Mar 2020
Posts: 12

PostPosted: Fri Dec 16, 2022 2:09 am    Post subject: Reply with quote

Thank you for the reply Xotic and Methos

I will look more into the spider thing, I'll try learning it!

for now I was able to find how to change the Sprites, but it only works for their respective pools (Item for item, NPC for NPC, Character for Character) ex. item value 3 is different from NPC value 3 and Character value 3, I think the reason why it is not in the same pool, is because the character is actually like clothes instead of Character, since we can change the hair and skin, like if it is in Dead or Alive, it would be similar to changing clothes


the NPCs can be changed into any ID even if they are not present thankfully, same for items, NPCs that are not in the area, not spawnable or unused can be chosen, but NPC IDs that are removed from the game via updates will crash the game (deleted from files I think), on another note, there are two identical IDs, one might be the entity ID and other is the sprite ID, changing the first ID changes the drops and name, if it is a boss, the boss bar will appear at the bottom, the second ID changes the sprite,

however, the character ID is very far from the health value, unlike the NPC and Item Pool, around -400-ish bytes from health address (it might be because this is the body sprite ID, near it are the hair sprite ID and character color), NPC and Item IDs are only 4-16 bytes apart from health address, this worries me

I do not know what dynamic memory allocations are, but the addresses change whenever the games closes and opens, sometimes, the health values of NPCs become unusable (being able to change the value but after a while, the address no longer works and I need to find the value again, unsure why this happens)


I was still unable to change the character into an NPC, but I think I have an idea why


some guesses:

1.) Player is only limited to these 11 sprites I think if it is in code, it would be something like CharBodyType: 10 or something instead of NPC ID: 10, which might be why I cant access the NPC pool, I am unsure if cheat engine can change a parameter like that or make it seem that CharBodyType is accessing NPC ID

2.) Player might not be too different, just need to find the value responsible for telling the game if it is a 1) player, 2) NPC, 3) Item, but I still have no idea where to look or what their value is in the memory or if such a thing exist in the code


I'll still try some things, if you have any ideas, please let me know

edit:

Update

I dissected the structures, it showed some variables:

For .Player, There is "SkinVariant" (this is the one I want to change)
For .NPC, There is "Type" as well as "NetID" (both have the same number, must be the sprite and name ID)

as I have guessed, it is too different for the sprite to call the NPC Type into SkinVariant, I can't find a way to do this

but one thing caught my eye, there is a variable called "WhoAmI", Character is always set to 0, enemies have it at 4 (not sure yet), value cant be changed, it automatically reverts back to its designated value, there is also a variable called EntityID, but the NPC and character had its value set to 0 so it must not be related


Aside from that, I can't think of a way to get around this ID separation
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Dec 16, 2022 6:40 am    Post subject: Reply with quote

Just to add a few things...

Basic injection can usually overcome DMA issues. Emulators can be more difficult, depending on which one you are dealing with.

I would not worry too much if the player structure differs in size since it may have more data associated with it. Just be sure that you are looking at the correct structure(s).

If you are trying to change a value and it reverts back, check to see what is writing to the value and try to NOP the instruction(s) to test.

Some games may require a (re)loading/(re)spawning of some type for certain changes to be realized.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Dec 16, 2022 9:47 am    Post subject: Reply with quote

Xx XoTiC V1 xX wrote:
It can but I usually prefer pointers just for the easiness and being able to change value when needed, I don't really know how to make a script that lets you choose what ID you want to replace with or otherwise I'd do that.
-I understand. I highly recommend taking the time to learn injection, though, as it is the superior solution, by far. Once learned, you will find that it is also easy... and faster, more reliable, more powerful et al..
Back to top
View user's profile Send private message
Haru
Newbie cheater
Reputation: 0

Joined: 17 Mar 2020
Posts: 12

PostPosted: Fri Dec 16, 2022 2:04 pm    Post subject: Reply with quote

Thank you for the replying Methos and Xotic

I'll try the finding what writes and NOPing the values of the WhoAmI functions

The character is easier to dissect than the NPCs or enemies, for some reason, NPC/enemy addresses changes whenever they interact with you or damage you, or for no reason at all, they suddenly go to another address

I can't find a way around the enemy HP addresses quickly changing so I just do it as fast as I can and hope it doesn't change, it seems like getting hit by the enemy is a guaranteed address change so I avoid being hit, I think I should study the Injection thing Methos is saying, I get too overwhelmed with injection stuff, but I'll try to slowly learn these things

also, after dissecting a couple of NPCs or enemies, the functions (sorry for calling them variables before, I'm still unfamiliar with the terms) may not appear for some reason, still unsure what causes this, only the first few ones are having named functions

some questions:

1.) How do I NOP a function? Is it by disassembling the address of the function and NOPing the code or is that a different NOPing? I have not done NOPs that much yet and it is confusing

and will it be able to send who writes to the address if it is a static/set value (ex WhoAmI function)

2.) how do I guarantee that text/functions appear when dissecting? sometimes, it is recognized and labeled and sometimes it only shows pointers


I'll try checking out common functions for Player and NPC, starting with WhoAmI, it might be what is telling if a thing is a player or an NPC, but I am still unsure about this and will update if I find anything
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Dec 16, 2022 3:32 pm    Post subject: Reply with quote

To NOP an instruction, first, add the address/value that you are interested in to your cheat table. Right-click on the address to see what is writing to it. A window should populate with instructions (depending upon the nature of the value, you may have to perform some action in-game for data to start populating the list).

From here, you can either NOP directly in this window, or, view each instruction in the disassembler window and NOP them there by right-clicking and selecting the appropriate option.

If you are having trouble with values or addresses changing quickly, you can try to use the speedhack feature to slow the process down to a crawl. That is the simple way of doing it, but there are better ways to approach this. You can also make duplicates of structures inside the dissection window and use the freeze option (or take snapshots etc.) for analysis.

When dissecting data structures, CE will make a best-guess when creating the structure tree. If you sometimes see readable text one time, and then something else later, it could simply be because CE has guessed wrong. You can change the data type to display what you want (e.g. as string type).
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Dec 16, 2022 7:23 pm    Post subject: Reply with quote

Xx XoTiC V1 xX wrote:
I just feel for character swapping and similar pointers are just the way for me.
-I understand. Pointers can work well for specific cases. At the end of the day, it will come down to each person and what they are trying to accomplish. For more complicated features, injection or some other, alternative methods may be necessary.

Xx XoTiC V1 xX wrote:
but I would want it to where I can change a value to anything at anytime.
-This can be done with injection.
Back to top
View user's profile Send private message
Haru
Newbie cheater
Reputation: 0

Joined: 17 Mar 2020
Posts: 12

PostPosted: Sat Dec 17, 2022 7:41 am    Post subject: Reply with quote

an Update

Thank you for guiding me Xotic and Methos

the health address moves a lot but I was able to dissect it again, this time, I NOPed the code that writes the address and I was able to change everything in the data structure (it no longer reverts back), interesting thing is it also stopped the address from moving into another address (still needs more testing to confirm)

some good news and bad news, good news is everything in the structure can now be changed (IsTownNPC, turn on Friendly, WhoAmI etc) bad news is WhoAmI did not do anything, atleast I think it didn't do anything, maybe it needed a restart for it to show results, but restarting reshuffles the addresses so it might be a problem

with NOPing in mind, I want to try and test WhoAmI on the Character instead of enemies

for now, I am a bit stuck, please tell me if you you guys have any ideas in mind
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Dec 17, 2022 9:23 am    Post subject: Reply with quote

1. Consider the possibility that you are looking in the wrong place until you can confirm otherwise.

2. Focus on the main character (in lieu of NPC), if possible, not only because the data may be more reliable (change less often), but also because it may be easier to become familiar with over time due to fewer variances.

3. NOPing the instruction that is writing to the values that you want to change may not always be the best approach. Consider the possibility that a preceding instruction (where the value is being determined) is a better starting point.
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