| View previous topic :: View next topic |
| Author |
Message |
Magusmarisa Newbie cheater
Reputation: 0
Joined: 03 May 2015 Posts: 10
|
Posted: Mon Jun 20, 2022 10:12 pm Post subject: Lua script to calculate floats |
|
|
Hi. I start by saying that I really suck with lua and math and I have no idea how to even implement what I'm trying to achieve.
I'm trying to have a teleport tool but the game uses weird system where teleporting by just with 12 bytes of XYZ is not "possible". Instead need to calculate difference and write this value to player XYZ.
So script is going to have label where we put desired 12 bytes of player coordinates.
Then script would read current player position from: [[[[[BaseA]+B658]+0*10]+190]+68]+70
and then it would add X, Y, Z of player position to to the pasted X, Y, Z and then write final value to the pointer above.
So example: player coordinates are:
X: 100
Y: 5
Z: 200
The desired destination:
X:500
Y:10
Z:300
So after map the result would be:
X:600
Y:15
Z:500.
Then write a new value [[[[[BaseA]+B658]+0*10]+190]+68]+70
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Jun 21, 2022 6:04 am Post subject: |
|
|
Well, with Lua you can just use arithmetic operators.
| Code: |
local x = 100.0
local y = 5.0
local z = 200.0
local x2 = 500
local y2 = 10.0
local z2 = 300.0
function addValues(a,b)
local n1 = a
local n2 = b
if a == nil or b == nil then return end
return n1 + n2
end
print('X = ' .. addValues(x,x2))
print('Y = ' .. addValues(y,y2))
print('Z = ' .. addValues(z,z2))
|
Output:
| Code: |
X = 600.0
Y = 15.0
Z = 500.0
|
|
|
| Back to top |
|
 |
|