With this particular game possible to control Camera XYZ coords, which is global (not relevant to player coords), camera vertical and horizontal rotation (in radian) and speed by XYZ directions. Speed by XYZ means that if you go, for example, to NE, than X and Y value will increase. If you run at the same direction - it will increase more and if you go vice versa (SW) speed will have negative value. And if you stop, it equal zero. In this particular game i'm do not remember which direction have positive/negative value, just as explanation. But i decide do not to use XYZ speed because if player model stay at wall at North, for example, it will not allow to increase X direction speed. So using Camera XYZ coordinates and angles is give all-time possibility to move your camera in any direction. Nop what write to camera and main character XYZ coordinations and the only problem after this - calculations.
And here few links that help me to figure out how to make it and i think that making it in LUA is just bit easier:
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
And code by itself, in case if table in attachments is lost because of any reason (it is not great and it can be really improved, so just to see logic):
Code: Select all
globalalloc(speedmult,8)
speedmult:
db CD CC CC 3D
{$lua}
[ENABLE]
function checkKeys(timer)
local camx = readFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+90") -- Camera X
local camy = readFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+98") -- Camera Y
local camz = readFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+94") -- Camera Z
local radh = readFloat("[[[[ACOrigins.exe+4B139F0]+A8]+0]+340]+C4") -- Horizontal rotation in Rad
local mult = readFloat("speedmult") -- speed multiplier
local sinh = math.sin(radh)
local cosh = math.cos(radh)
if isKeyPressed(VK_W) then -- move Forward
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+90", camx - (sinh * mult))
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+94", camz - (cosh * mult))
end
if isKeyPressed(VK_S) then -- move Back
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+90", camx + (sinh * mult))
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+94", camz + (cosh * mult))
end
if isKeyPressed(VK_A) then -- Move Right
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+90", camx + (cosh * mult))
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+94", camz - (sinh * mult))
end
if isKeyPressed(VK_D) then -- Move Left
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+90", camx - (cosh * mult))
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+94", camz + (sinh * mult))
end
if isKeyPressed(VK_R) then -- Move Up
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+98", camy + (mult * 0.5))
end
if isKeyPressed(VK_F) then -- Move Down
writeFloat("[[[ACOrigins.exe+4B139F0]+A8]+0]+98", camy - (mult * 0.5))
end
if isKeyPressed(VK_SHIFT) then
writeFloat("speedmult", readFloat("speedmult") + 0.01) -- Hold Shift for keep incresing speed
elseif isKeyPressed(VK_CONTROL) then
writeFloat("speedmult", 0.01) -- Hold Ctrl for decrease speed
else
writeFloat("speedmult", 0.15) -- When no Ctrl or Shift pressed, normal speed
end
end
t=createTimer(nil)
timer_setInterval(t, 10)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)
[DISABLE]
timer_setEnabled(t, false)
Note that you can do things like this in LUA:
Code: Select all
local rad = readFloat("address_of_rotations_in_rads")
local deg2 = readFloat("deg")
writeFloat("deg2", rad * (180 / math.pi))
If you found rotations in rads, than this will convert it in degrees and put calculated value in "deg2" address value.
Code: Select all
local sinval = math.sin(math.rad(rotH))
Convert degrees rotations in radian and calculate it sinus.
Code: Select all
local rad = readFloat("address_of_rotations_in_rad")
local rotH = rad * (180 / math.pi)
local sinval = math.sin(math.rad(rotH))
This will put address_of_rotations_in_rad in local rad;
convert it in degrees and put in local rotH;
Convert it back to rads and calculate it sinus value and put it in local sinval
Code: Select all
{$asm}
[ENABLE]
globalalloc(sinh,8)
sinh:
dq 0
{$lua}
... some code ...
local radh = readFloat("address_of_rotations_in_rad")
local sinh = math.sin(radh)
writeFloat("sinh", sinh)
If you want to see what some calculations are in your LUA, this will allocate sinh address, so you can add it to your cheat table manually. Press "Add Address Manually" and fill "Address" with
sinh . After enabling the script, you will see what sinh equal in your LUA script. In this particular case this will show what is equal sinus of horizontal rotation in rads value.
And don't forget to use
{$lua} and
{$asm} in your script if you want to work with the ASM and LUA code in the same script.