View previous topic :: View next topic |
Author |
Message |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Tue Mar 22, 2022 12:20 pm Post subject: [C]Get float from game function |
|
|
i wanted to make a teleporter to waypoint but the problem is that i need get z ground so player won't fall off from the map or die when player coords is higher than ground one
|
|
Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Wed Mar 23, 2022 12:00 pm Post subject: |
|
|
anyone ?
._.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4697
|
Posted: Wed Mar 23, 2022 12:17 pm Post subject: |
|
|
Easiest way is to disable fall damage and just teleport the player high up.
Maybe the waypoint also has a z-coordinate you can use?
I guess you could do a scanline going down from high up and detect when it hits the ground. This would involve reverse engineering the game's floor collision detection system- a process that would take a large amount of effort on your part and can't be explained in a forum post or two.
Maybe the game has a function that returns the height of the ground at a certain point, but good luck finding it.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Wed Mar 23, 2022 1:31 pm Post subject: |
|
|
ParkourPenguin wrote: | Easiest way is to disable fall damage and just teleport the player high up.
Maybe the waypoint also has a z-coordinate you can use?
I guess you could do a scanline going down from high up and detect when it hits the ground. This would involve reverse engineering the game's floor collision detection system- a process that would take a large amount of effort on your part and can't be explained in a forum post or two.
Maybe the game has a function that returns the height of the ground at a certain point, but good luck finding it. |
well i'm want to call one:
Code: | CWorld::FindGroundZForCoords(CVector2D pos)
{
//bla bla bla
}//taken from IDA |
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Wed Mar 23, 2022 8:59 pm Post subject: |
|
|
You're missing half of that output if you took that from IDA. What's the return value? Is the function static as well or is it a __thiscall?
Look for references to that function as well to see how it is being called in the actual disassembly. Since it is taking a CVector2D, that could be simplified to just two float/doubles being pushed or moved into the floating point registers or it may be a pointer to an object of that type.
Hard for us to really go off just part of the prototype.
_________________
- Retired. |
|
Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Thu Mar 24, 2022 12:35 am Post subject: |
|
|
atom0s wrote: | You're missing half of that output if you took that from IDA. What's the return value? Is the function static as well or is it a __thiscall?
Look for references to that function as well to see how it is being called in the actual disassembly. Since it is taking a CVector2D, that could be simplified to just two float/doubles being pushed or moved into the floating point registers or it may be a pointer to an object of that type.
Hard for us to really go off just part of the prototype. |
i just given an example, full function:
Code: | float __cdecl CWorld::FindGroundZForCoord(CVector2D posn)
{
double result; // st7
CVector v2[4]; // [esp+0h] [ebp-38h] BYREF
v2[0].x = posn.x;
v2[0].y = posn.y;
v2[0].z = 1000.0;
if ( CWorld::ProcessVerticalLine(v2, -1000.0, &v2[1], &posn, 1, 0, 0, 0, 1, 0, 0) )
result = v2[1].z;
else
result = 20.0;
return result;
} |
there's another but it needs CVector (x,y,z)
|
|
Back to top |
|
 |
TsTg Master Cheater
Reputation: 5
Joined: 12 Dec 2012 Posts: 340 Location: Somewhere....
|
Posted: Thu Mar 24, 2022 2:42 pm Post subject: |
|
|
so in that code it takes the 2D co-ordinate, then assume later the Z axis is 1000....
have you tried using that on the CVector(x,y,z) function tho ?
i agree with ParkourPenguin about disabling the fall damage during the teleport (then maybe disable that after), but as atom0s said, more digging is required into the code and how the methods are called in game.
|
|
Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Thu Mar 24, 2022 2:57 pm Post subject: |
|
|
Z is automatically becomes 1000.0 to get the highest coord like, if there's bridge in the game but you want to teleport exactly on the bridge it will give the exact z coord, and in game functions are using more arguments like:
Code: | float __cdecl blabla::bla(CVector pos, CVector retstr) |
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Thu Mar 24, 2022 11:29 pm Post subject: |
|
|
Frouk wrote: | atom0s wrote: | You're missing half of that output if you took that from IDA. What's the return value? Is the function static as well or is it a __thiscall?
Look for references to that function as well to see how it is being called in the actual disassembly. Since it is taking a CVector2D, that could be simplified to just two float/doubles being pushed or moved into the floating point registers or it may be a pointer to an object of that type.
Hard for us to really go off just part of the prototype. |
i just given an example, full function:
Code: | float __cdecl CWorld::FindGroundZForCoord(CVector2D posn)
{
double result; // st7
CVector v2[4]; // [esp+0h] [ebp-38h] BYREF
v2[0].x = posn.x;
v2[0].y = posn.y;
v2[0].z = 1000.0;
if ( CWorld::ProcessVerticalLine(v2, -1000.0, &v2[1], &posn, 1, 0, 0, 0, 1, 0, 0) )
result = v2[1].z;
else
result = 20.0;
return result;
} |
there's another but it needs CVector (x,y,z) |
Find references to that call and look at the actual disassembly to see how the parameters are handled and how the call is being made. Then just replicate that in your own code. Given that it is using objects (ie. CVector2D) it's hard to give you a straight answer that will absolutely work since there are countless ways that object could be constructed, or where it stores the actual X/Y/Z coords and so on in it.
But as is that looks very simple to implement once you look at a reference that already is calling it or making use of the same/similar objects and do similar.
_________________
- Retired. |
|
Back to top |
|
 |
|