Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Entity type


arielnmz
 Share

Recommended Posts

Okay, i've got this function (made by wesser) which returns the colision point, distance and ENTITY (struct) of the "thing" it collided with... but, is there a way to know whether it is a solid/ped/car/object...????

 

This is such function: (getCollisionBetweenPoints)

 

 

{

FUNCTIONS INCLUDED:

 

-  getAimPoint

    Type: GET

      Description: Get the point where player is looking/aiming at.

 

-  getLaserPoint

    Type: GET

      Description: Get laser point between 2 points.

 

-  getCollisionBetweenPoints

    Type: GET

      Description: Get the collision point coords between 2 points.

 

-  getLocalVarOffset

    Type: GET

      Description: Get local var offset from thread pointer.

}

 

{$CLEO}

 

0000: NOP

 

0A8C: write_memory 0xC1704C size 1 value 105 virtual_protect 0 // 60fps

 

// Disable crosshair

0A8C: write_memory 0x58FBBF size 4 value 0x90909090 virtual_protect 1

0A8C: write_memory 0x58FBC3 size 1 value 0x90 virtual_protect 1

 

while true

wait 0

0470: [email protected] = actor $PLAYER_ACTOR current_weapon

[email protected] *= 0x70

[email protected] += 0xC8AAB8

[email protected] += 0x8

0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range

00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]

0AB1: call_scm_func @getAimPoint 4 range [email protected] from [email protected] [email protected] [email protected] camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]

0AB1: call_scm_func @getLaserPoint 6 from [email protected] [email protected] [email protected] to [email protected] [email protected] [email protected] store_to [email protected] [email protected] [email protected]

04D5: create_corona_at [email protected] [email protected] [email protected] radius 0.05 type 0 flare 0 RGB 255 0 0

end

 

:getAimPoint

{

Parameters:

  Passed:

    [email protected] - aiming range

    [email protected] - start point X

    [email protected] - start point Y

    [email protected] - start point Z

  Result:

    [email protected] - camera point X

    [email protected] - camera point Y

    [email protected] - camera point Z

    [email protected] - aim point X

    [email protected] - aim point Y

    [email protected] - aim point Z

 

Example:

  0AB1: call_scm_func @getAimPoint 4 range 20.0 from 0.0 0.0 0.0 camera_to [email protected] [email protected] [email protected] point_to [email protected] [email protected] [email protected]

}

0A9F: [email protected] = current_thread_pointer

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 4 store_to [email protected]

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 7 store_to [email protected]

0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint [email protected] pCamera [email protected] fOriginZ [email protected] fOriginY [email protected] fOriginX [email protected] fRange [email protected] // CCamera__Find3rdPersonCamTargetVector

0AB2: ret 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

 

:getLaserPoint

{

Parameters:

  Passed:

    [email protected] - start point X

    [email protected] - start point Y

    [email protected] - start point Z

    [email protected] - end point X

    [email protected] - end point Y

    [email protected] - end point Z

  Result:

    [email protected] - middle point X

    [email protected] - middle point Y

    [email protected] - middle point Z

 

Example:

  0AB1: call_scm_func @getLaserPoint 6 from 0.0 0.0 0.0 to 1.0 0.0 0.0 store_to [email protected] [email protected] [email protected]

}

0A96: [email protected] = actor $PLAYER_ACTOR struct

0AB1: call_scm_func @getCollisionBetweenPoints 17 from [email protected] [email protected] [email protected] to [email protected] [email protected] [email protected] solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity [email protected] see_through 0 camera_objects 0 shoot_through 0 store_to [email protected] [email protected] [email protected] distance_to [email protected] entity_to [email protected]

0AB2: ret 3 [email protected] [email protected] [email protected]

 

//-----GetCollisionBetweenPoints

 

:getCollisionBetweenPoints

{

Parameters:

  Passed:

    [email protected] - start point X

    [email protected] - start point Y

    [email protected] - start point Z

    [email protected] - end point X

    [email protected] - end point Y

    [email protected] - end point Z

    [email protected] - is solid

    [email protected] - is car

    [email protected] - is actor

    [email protected] - is object

    [email protected] - is particle

    [email protected] - is car tyre

    [email protected] - is water

    [email protected] - entity to ignore (offset)

    [email protected] - no see-through stuff

    [email protected] - no camera objects

    [email protected] - no shoot-through stuff

  Result:

    [email protected] - collision point X

    [email protected] - collision point Y

    [email protected] - collision point Z

    [email protected] - distance

    [email protected] - entity

 

Example:

  0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0.0 0.0 0.0 to 1.0 0.0 0.0 solid 0 car 1 actor 0 object 0 particle 0 cartyre 1 water 0 ignore_entity 0x0 see_through 0 camera_objects 0 shoot_through 0 store_to [email protected] [email protected] [email protected] distance_to [email protected] entity_to [email protected]

}

if

[email protected] <> 0x0

then

0A8C: write_memory 0xB7CD68 size 4 value [email protected] virtual_protect 0

end

0A8C: write_memory 0xB7CD70 size 1 value [email protected] virtual_protect 0

0A9F: [email protected] = current_thread_pointer

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected]

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 3 store_to [email protected]

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 17 store_to [email protected]

0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 21 store_to [email protected]

0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff [email protected] bIgnoreSomeObjectsForCamera [email protected] bIgnoreSeeThroughStuff [email protected] bDummy [email protected] bObject [email protected] bActor [email protected] bCar [email protected] bBuilding [email protected] pEntity [email protected] pPoint [email protected] pTarget [email protected] pOrigin [email protected] bReturn [email protected] // CWorld__ProcessLineOfSight

if

[email protected] <> 0x0

then

0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0

end

if

[email protected] <> 0

then

if and

  [email protected] <> 0.0

  [email protected] <> 0.0

  [email protected] <> 0.0

then

  050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected]

  if

    [email protected] == 1

  then

    0A9F: [email protected] = current_thread_pointer

    0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 27 store_to [email protected]

    0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint [email protected] fTargetZ [email protected] fTargetY [email protected] fTargetX [email protected] fOriginZ [email protected] fOriginY [email protected] fOriginX [email protected] bResult [email protected] // CWorld__TestLineAgainstWater

    if

      [email protected] <> 0 

    then

      0087: [email protected] = [email protected]

      0087: [email protected] = [email protected]

      0087: [email protected] = [email protected]

      050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected]

    end

  end

  0AB2: ret 5 [email protected] [email protected] [email protected] [email protected] [email protected]

end

end

0AB2: ret 5 [email protected] [email protected] [email protected] 0.0 0x0

 

//-----GetLocalVarOffsetCollisionMode

 

:getLocalVarOffset

{

Parameters:

  Passed:

    [email protected] - thread pointer

    [email protected] - var number

  Result:

    [email protected] - var value

 

Example:

  0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected]

}

if

[email protected] <> 0

then

[email protected] *= 0x4

0A8E: [email protected] = [email protected] + 0xDC // mission flag

if

  [email protected] == 1

then

  [email protected] += 0xA48960 // mission locals

else

  005A: [email protected] += [email protected]

  [email protected] += 0x3C

end

else

[email protected] = 0

end

0AB2: ret 1 [email protected]

 

 

Thanks!!!

Link to comment
Share on other sites

Or to check the vtable adress, which would be faster but less compatible.

Link to comment
Share on other sites

okay... I found this:

 

 

CPlaceable (vmt=0x863C40, size=0x18):  CCamera (vmt=0x8630E8, size=unknown)  CEntity (vmt=0x863928, size=0x38):      CBuilding (vmt=0x8585C8, size=0x38)          CTreadable (vmt=0x8639B0, size=0x38)      CDummy (vmt=0x8638C0, size=0x38)          CDummyObject (size=0x38)          CDummy_86C198 (vmt=0x86C198, size=unknown, unused)      CPhysical (vmt=0x863BA0, size=0x138)          CObject (vmt=0x866F60, size=0x17C)              CHand (vmt=0x866EE0, size=0x18C) // actor's hand in cutchenes              CProjectile (vmt=0x867030, size=0x17C)              CCutsceneObject (vmt=0x868A60, size=0x19C)          CPed (vmt=0x86C358)              CCivilianPed (vmt=0x86C0A8, size=0x79C)               CCopPed (vmt=0x86C120, size=0x7C4)               CEmergencyPed (vmt=0x86C200, size=0x79C)               CPlayerPed (vmt=0x86D168, size=0x7A4)           CVehicle (vmt=0x871E80)              CAutomobile (vmt=0x871120, size=0x988)                  CHeli (vmt=0x871680, size=0xA18)                  CMtruck (vmt=0x8717D8, size=0x99C)                  CPlane (vmt=0x871948, size=0xA04)                  CQuad (vmt=0x871AE8, size=0x9BC)                  CTrailer (vmt=0x871C28, size=0x9F4)              CBike (vmt=0x871360, size=0x814)                  CBmx (vmt=0x871528, size=0x838)              CBoat (size=0x8721A0, size=0x7E8)               CTrain (vmt=0x872370, size=0x6AC)

 

 

Specifically this caught my attention:

 

 

CPed (vmt=0x86C358)              CCivilianPed (vmt=0x86C0A8, size=0x79C)               CCopPed (vmt=0x86C120, size=0x7C4)               CEmergencyPed (vmt=0x86C200, size=0x79C)               CPlayerPed (vmt=0x86D168, size=0x7A4) 

 

 

And I found this, too:

 

 

PedestriansGeneral0xB6F5F0 - Player pointer (CPed)0xB7CD98 - Player pointer, direct offset to the ped pool start (CPed)0xB74498 - CPeds maximum number (normally 140)0xB74490 - Contains a pointer to a main struct belowThis struct:+0 = Contains a pointer to the first element in the pool+4 = Contains a pointer to a byte map indicating which elements are in use+8 = [dword] Is the maximum number of elements in the pool+12 = [dword] Is the current number of elements in the poolEach ped object is 1988 (0x7C4) bytes.

 

 

I think I need to compare the address of the entity with the CPed vmt... what I dont know is how confused.gif...

 

And for the second method, Should I do a "for" from 0 to the current number of elements in the pool, then see if the address is present?

 

I think I've got the idea, but I dont know how to do this specifically...

Link to comment
Share on other sites

and then compare it with this?

 

 

CPed (vmt=0x86C358)CCivilianPed (vmt=0x86C0A8, size=0x79C) CCopPed (vmt=0x86C120, size=0x7C4) CEmergencyPed (vmt=0x86C200, size=0x79C) CPlayerPed (vmt=0x86D168, size=0x7A4) 

 

 

Right? (something like: [email protected] == 0x86C358) To see if it is a ped...

 

And what about the other method? the one of the data pools?? you it was more "sensible" and "compatible"...

Link to comment
Share on other sites

thanks, deji, i just took the first three digits of the VMT of the obtained entity then compare them if they match with the first three digits of the VMT type I want to handle... that did the trick wink.gif... btw how to call the function or how to get the id of the CEntityInfo type that you posted on that thread??

Edited by arielnmz
Link to comment
Share on other sites

I hate GTAForums' flood control.

 

 

00000036 info            db ?                  ; object type (low 3 bits: 0 - object, 1 - building...

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.