need help: changing parameters of mono method call

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
Eurochron
Noobzor
Noobzor
Posts: 6
Joined: Mon Jul 26, 2021 4:37 pm
Reputation: 0

need help: changing parameters of mono method call

Post by Eurochron »

Game: Mini Motorways

goals:
  • trying to "create" a kind of creativity mode
  • being able to control the placement/type/rotation of buildings and houses.

I will start by saying, that I am a newbie and never worked with Mono while using CE.
My knowledge is limited to changing health/money/some easy to find values.
I know how pointers work and am able to do AOB scans / code injections for very basic stuff.


I have looked into this game over the last few days and did not get very far with my basic knowledge.
So I am looking for help / guidance with my goal to manually change the parameters of a mono-method call.

---

What I have found so far, that seems useful:

Mono class: Motorways.Processes:BuildingSpawningProcess
method name: SpawnBuilding
Parameters: System.Void (Motorways.BuildingPlacer/Placement placement, Motorways.Models.CityPlanModel/ScheduledBuilding building, Engine.Server.ISimulation simulation)

Setting a breakpoint for that method will indeed stop the game at the right moment.
I can also confirm that this is only called once for each new building spawn. (does not spawn the houses tho)


But my knowledge is to limited to understand what else I can do from here.
I have tried to understand the instructions but can not make sense of them, because I don't know what to look for.


I want to be able to control when the building is spawned, where it is spawned and what color (group?) it has.

I am also still looking for a method that will spawn the houses.


Looking for someone with more experience to point me towards the right direction.
Would appreciate a detailed explanation, as I want to learn and understand what I am doing, while I am at it. ;)

Thank you.

User avatar
EpicBirdi
Fearless Donors
Fearless Donors
Posts: 64
Joined: Sat Jul 21, 2018 2:22 pm
Reputation: 59

Re: need help: changing parameters of mono method call

Post by EpicBirdi »

I'd start by grabbing objects (buildings) that get spawned via that function and figure out what their fields are (coordinates, color, etc.) then check the function & trace registers to see what may be writing to what. From there you can debug custom values to fully customize it.

This may require you to look through multiple function calls. You can use the Step Up function with regular breakpoints to find calling functions.

Eurochron
Noobzor
Noobzor
Posts: 6
Joined: Mon Jul 26, 2021 4:37 pm
Reputation: 0

Re: need help: changing parameters of mono method call

Post by Eurochron »

Well, yes. I understand what the next steps would be.
The problem is, I do not have the knowledge to even understand what I am looking for.

I mean: How do I even figure out, which value is for coordinates/color/driveway direction?
As I said in my OP, I am a total newbie and know just some basic stuff - this is far too advanced for me to grasp what to look for.

---

I just did some more sniffing around and found OptionsDebugMenuand InGameDevTool
Both of them were seemingly used during development of the game.
Activating them will do just what I wanted. But again: how? :mellow:

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: need help: changing parameters of mono method call

Post by LeFiXER »

Don't try to run before you can walk. People here are willing to help others but at the very least you have to show what you have tried. Debug stuff is 100% used during development and is more often than not, disabled in the release build.

Invoking functions is not something a beginner should attempt to do without at least having a firm understanding of basic game hacking, ASM and programming.

User avatar
EpicBirdi
Fearless Donors
Fearless Donors
Posts: 64
Joined: Sat Jul 21, 2018 2:22 pm
Reputation: 59

Re: need help: changing parameters of mono method call

Post by EpicBirdi »

Your first step is simply identifying the base object and analyzing its structure to find values you can discern to be coordinates/rotation, and work from there. It's not an easy step but you can do it.
Use the mono functions to help you out.. making scripts to make debugging easier will help a ton if you plan on doing guesswork and likely crash a lot.

Eurochron
Noobzor
Noobzor
Posts: 6
Joined: Mon Jul 26, 2021 4:37 pm
Reputation: 0

Re: need help: changing parameters of mono method call

Post by Eurochron »

Well, since posting this initial topic I have learned about the existence of dnSpy.
Which basically enabled me to see the entire Sourcecode for Mini Motorways in C#.
So you can consider this topic solved.

---

I understand that it is difficult to help a total newbie.
But I guess at some point, we all have been in a situation where we wanted something
and did not have the time to spent hours/days or even weeks to learn about it.
I can't spent the time to learn the basics right now - not enough free time and not a free mind right now.

Anyway, I feel sad about not being able to solve the problem with CE,
but I at least learned about the existence of a very useful tool for Unity Games.

cheers

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 489
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 251

Re: need help: changing parameters of mono method call

Post by LeFiXER »

It's not that it's difficult per-se, but more so the fact that spoonfeeding doesn't solve anything. It helps to achieve that obstacle but you learn nothing by it. Nudging people that need help in the right direction and guiding them to the answer is much more effective and that little bit more satisfying for the person being helped when they achieve what they set out to do.

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 21

Re: need help: changing parameters of mono method call

Post by ShyTwig16 »

Eurochron wrote:
Mon Aug 02, 2021 12:54 pm
...
I can't spent the time to learn the basics right now - not enough free time and not a free mind right now.
...
Thus you're counting on someone to be in the mood and have time to do it for you, so you greatly limited the pool of people to help. And there is a request section, the rest of the forum you'll tend to find people expect you to do the work and put in the time.
Eurochron wrote:
Mon Aug 02, 2021 12:54 pm
...
but I at least learned about the existence of a very useful tool for Unity Games.
...
Awesome; always be willing to use the best tool for the job, even if it's new. I mean, I can cut down a tree with a butter knife but a saw works a lot better.

Eurochron
Noobzor
Noobzor
Posts: 6
Joined: Mon Jul 26, 2021 4:37 pm
Reputation: 0

Re: need help: changing parameters of mono method call

Post by Eurochron »

ShyTwig16 wrote:
Mon Aug 02, 2021 10:43 pm
Awesome; always be willing to use the best tool for the job, even if it's new.
In this case it was a perfect match, because I already know how to program with C#.
So all I had to do was find the right functions and then apply my knowledge to see where I can call them from.

I was able to solve my problem with C#, instead of using CE's mono features.
And now I can customize everything to my liking - I would count that as a win. :mrgreen:
Maybe someday I will have the time and a free mind to learn about CE's mono feature, too. I will see about that.

cheers

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 21

Re: need help: changing parameters of mono method call

Post by ShyTwig16 »

Eurochron wrote:
Wed Aug 04, 2021 1:04 pm
ShyTwig16 wrote:
Mon Aug 02, 2021 10:43 pm
Awesome; always be willing to use the best tool for the job, even if it's new.
In this case it was a perfect match, because I already know how to program with C#.
So all I had to do was find the right functions and then apply my knowledge to see where I can call them from.

I was able to solve my problem with C#, instead of using CE's mono features.
And now I can customize everything to my liking - I would count that as a win. :mrgreen:
Maybe someday I will have the time and a free mind to learn about CE's mono feature, too. I will see about that.

cheers
For the mono features it will be a combination of using the CE mono tools and Lua for most of the more complex things. You can do simple injections to change how values are set, but to call functions you'll want to use Lua. So when you get the time do some poking around with Lua. And check the "celua.txt" file in the CE directory for documentation.

Post Reply

Who is online

Users browsing this forum: No registered users