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 


Newbie needing advice on creating a table for Unity game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
SquishyPandaDev
How do I cheat?
Reputation: 0

Joined: 02 Sep 2019
Posts: 1

PostPosted: Mon Sep 02, 2019 11:47 am    Post subject: Newbie needing advice on creating a table for Unity game Reply with quote

So I decided that instead of waiting around or begging someone to make a cheat table, that I would take matters into my own hands and learn how to make cheat tables, how hard could it be? The answer, quite hard.

The game in question that I am working on is Shortest Trip to Earth, which use Unity. I am starting off by editing all the game resources save for fate points. Now, the catch is that I don't want to do infinite resources. What I would like to achieve is a table that allows me to easily set a resource to a given value.

In this game all resources are managed by the PlayerData class. All resources save for credits, it is just a simple field, is managed by PlayerResource class. This class has handy function to set the resource to a given value.

Is there a way I can create a cheat table that finds the PlayerData class and then change the resource values to a given amount that I input.

Edit:
Well I got somewhere. I went with using pointers to get the address of PlayerData class(idk how stable that is). I started writing up some scripts then my initialize script(called Start) crapped out by saying monopipe was nill. I called `LaunchMonoDataCollector` but at the end the "Activate mono features keep deselecting"

I have no idea what I am doing wrong

Edit Edit:
I have traced the problem to 'mono_method_get_parameters'. Using 'mono_method_getName' returns the right name, so I think that methodId is right.

Edit Edit Edit:
Well I am an idiot and well writing this script completely forgot how pointers worked. With the fixes to get the right address, I got it change the value of the resource, just not to what I inputted.

Code:

[ENABLE]
{$lua}
if syntaxcheck then return end

local offsets = {0x2B0, 0x908, 0x30, 0x58, 0x78, 0x18}

local moduleAddr = getAddress("mono-2.0-bdwgc.dll")
local baseAddr   = moduleAddr + 0x4A3290

local pointerChain = baseAddr
local i
for i=1, #offsets do
  local pointer = readPointer(pointerChain)

  print("P" .. i ..": " .. string.format("%x", pointer))

  pointerChain = pointer + offsets[i]
end

print("P7: " .. string.format("%x", pointerChain))

playerDataAddr = readPointer(pointerChain)

print("PlayerData Addr: " .. string.format("%x", playerDataAddr))

local methodId = mono_findMethod("Assembly-CSharp", "PlayerResource", "Set")
local params   = mono_method_get_parameters(methodId)

function SetResource(offset, value)
  local args_t = {}

  --- Amount
  args_t[1]    = {}
  args_t[1].type  = monoTypeToVartypeLookup[parms.parameters[1].type]
  args_t[1].value = value

  -- Reason
  args_t[2]    = {}
  args_t[2].type  = monoTypeToVartypeLookup[parms.parameters[2].type]
  args_t[2].value = "Cheat Engine"

  local addr         = playerDataAddr + offset
  local instanceAddr = readPointer(addr)

  print("Instance Addr: " .. string.format("%x", instanceAddr))

  print("Type: " .. args_t[1].type .. " & Value: " .. args_t[1].value)

   local r = mono_invoke_method("Assembly-CSharp", methodId, instanceAddr, args_t)
   return r
end

function Prompt(resource)
   local response = inputQuery(resource, "Enter " .. resource .. " Amount:", "")

   local value = tonumber(response)
   return value
end

[DISABLE]

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 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