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 


call a function with a Vector3 parameter

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

Joined: 15 Jun 2025
Posts: 1

PostPosted: Mon Jun 16, 2025 10:12 am    Post subject: call a function with a Vector3 parameter Reply with quote

I experienced a crash while using Cheat Engine version 7.6, but it worked fine with version 7.5. This is my script.
Code:
local getPositionId = mono_findMethod('UnityEngine', 'Transform', 'get_position')
local getTransformId = mono_findMethod('UnityEngine', 'Component', 'get_transform')
local setPositionId = mono_findMethod('UnityEngine', 'Transform', 'set_position')

local ValDirector = mono_findClass('', 'ValuableDirector')
local ValDirectorInsAddr = mono_class_getStaticFieldAddress(mono_enumDomains()[1], ValDirector)
local ValList = ReadQword(ReadQword(ValDirectorInsAddr)+0x118)
local Items = ReadQword(ValList+0x10)
local size = ReadInteger(ValList+0x18)

local ControllerId = mono_findClass('', 'PlayerController')
local instanceAddr = mono_class_getStaticFieldAddress(mono_enumDomains()[1], ControllerId)
local positionPrevious = ReadQword(instanceAddr)+0x1c0

--printf("pre%x",positionPrevious)
--local testParam = {{type=12,value=positionPrevious}}
local params = mono_method_get_parameters(setPositionId)
local i
  local args_t={}
  for i=1, #params.parameters do
    args_t[i] = {}
    args_t[i].type = vtPointer
    args_t[i].value = positionPrevious
  end
for i = 1, size do
    ValObject = ReadQword(Items + 0x18 + i*0x8)
    local transformIns = mono_invoke_method('UnityEngine', getTransformId, ValObject,{})
    if transformIns == 0 then
       goto continue
    end
    --local re = mono_invoke_method('UnityEngine', getPositionId, transformIns,{})
    local r = mono_invoke_method('UnityEngine', setPositionId, transformIns,args_t)
    --printf("%x %f %f %f",transformIns,re.x,re.y,re.z)
    --printf("%f %f %f",re.x,re.y,re.z)
    ::continue::
end
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 Lua Scripting 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