rscaerzx Posted April 30, 2017 Share Posted April 30, 2017 Hi, I wanted to know if it's possible to get a specific car's tyre position or offsets with CLEO script by reading memory addresses ? Perhaps even more parts like gas tanks and such. Something like this but able to access the offsets directly in-game: https://pastebin.com/rKDAhRkv Thanks Link to comment Share on other sites More sharing options...
DK22Pac Posted April 30, 2017 Share Posted April 30, 2017 (edited) Yes, it's possible. You should follow this logic: CVector GetCarWheelOffset(CVehicle *vehicle, int componentId) { if (vehicle->m_dwVehicleSubClass == VEHICLE_AUTOMOBILE) { // (vehicle +0x594) == 0 CAutomobile *car = reinterpret_cast<CAutomobile *>(vehicle); if (car->m_aCarNodes[componentId]) { // (car +(0x648+4*componentId)) RwV3d *offset = &car->m_aCarNodes[componentId]->modelling.pos; // frame +0x40 return { offset->x, offset->y, offset->z }; // (vec +0x0, +0x4, +0x8) } } return { 0.0f, 0.0f, 0.0f };} Edited April 30, 2017 by DK22Pac Wesser and rscaerzx 2 Link to comment Share on other sites More sharing options...
rscaerzx Posted April 30, 2017 Author Share Posted April 30, 2017 Thank you, it works perfectly! 03C0: [email protected] = actor $PLAYER_ACTOR car0A97: [email protected] = car [email protected] struct000A: [email protected] += 0x6480006: [email protected] = 40012: [email protected] *= componentId005A: [email protected] += [email protected] // (int)0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x400A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // x000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // y000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // z0AD1: show_formatted_text_highpriority "Offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected] But how about bikes? I tried to read the xyz offsets just like above but it doesn't seem to work CBike + 0x5B0 = [dword] wheel_front Component (RwFrame) CBike + 0x5B4 = [dword] wheel_rear Component (RwFrame) Also I've read your blogspot about the component ids http://dk22pac.blogspot.my/p/sa-hirerarchy-automobile.html I'd like to get the offsets of the petrol cap component but I believe it has a different structure. I would really appreciate if you could help me access the offsets.. thanks! Link to comment Share on other sites More sharing options...
DK22Pac Posted April 30, 2017 Share Posted April 30, 2017 Yes, bike wheels are placed inside other components in hierarchy, so you should additionally transform wheel offset by multiplying it with 'parent' matrices. CVector GetBikeWheelPosition(CBike *bike, int componentId) { if (bike->m_aBikeNodes[componentId]) { // (bike +0x5A0+4*componentId) RwV3d offset = bike->m_aBikeNodes[componentId]->modelling.pos; // frame +0x40 RwFrame *parentNode = reinterpret_cast<RwFrame *>(bike->m_aBikeNodes[componentId]->object.parent); // (frame+0x4) while (parentNode && parentNode->object.parent) { RwV3dTransformPoint(&offset, &offset, &parentNode->modelling); // 0x7EDD60 parentNode = reinterpret_cast<RwFrame *>(parentNode->object.parent); } return { offset.x, offset.y, offset.z }; // (vec +0x0, +0x4, +0x8) } return { 0.0f, 0.0f, 0.0f };} Bike components I'd like to get the offsets of the petrol cap component but I believe it has a different structure. I would really appreciate if you could help me access the offsets.. thanks! CVector GetVehicleDummyOffset(CVehicle *vehicle, int dummyId) { CVehicleModelInfo *vehModel = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::GetModelInfo(vehicle->m_wModelIndex)); // 0x403DA0 if (vehModel && vehModel->m_pVehicleStruct) // (vehModel +0x5C) return vehModel->m_pVehicleStruct->m_avDummyPosn[dummyId]; // vehModelStruct +0x0+12*dummyId return { 0.0f, 0.0f, 0.0f };}Dummy IDs (CAutomobile) 0 headlights1 taillights2 headlights23 taillights24 ped_frontseat5 ped_backseat6 exhaust7 engine8 petrolcap9 hookup10 ped_arm11 miscpos_c12 miscpos_d13 miscpos_a14 miscpos_b Dummy IDs (CBike) 0 headlights1 taillights2 headlights23 taillights24 ped_frontseat5 ped_backseat6 exhaust7 engine8 petrolcap9 hookup10 bargrip11 miscpos_a12 miscpos_b Note: It's really necessary to check vehicle type before accessing components/dummies tables. Wesser and rscaerzx 2 Link to comment Share on other sites More sharing options...
rscaerzx Posted May 1, 2017 Author Share Posted May 1, 2017 (edited) AwesomeeThank you so much ...const componentId = 4 // BIKE_WHEEL_FRONT dummyId = 8 // petrolcapend...03C0: [email protected] = actor $PLAYER_ACTOR car0A97: [email protected] = car [email protected] struct000A: [email protected] += 0x5A00006: [email protected] = 40012: [email protected] *= componentId005A: [email protected] += [email protected] // (int)0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 00085: [email protected] = [email protected] // (int)000A: [email protected] += 0x400A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x100AA5: call_method 0x7EDD60 num_params 3 pop 3 [email protected] [email protected] [email protected]: show_formatted_text_highpriority "Wheel Offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected]: [email protected] = car [email protected] model0AA7: call_function 0x403DA0 num_params 1 pop 1 [email protected] [email protected]: [email protected] += 0x5C0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 00006: [email protected] = 120012: [email protected] *= dummyId005A: [email protected] += [email protected] // (int) 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // x000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // y000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // z0AD1: show_formatted_text_highpriority "Petrolcap offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected] Note: It's really necessary to check vehicle type before accessing components/dummies tables. Alright I'll keep that in mind Edited May 1, 2017 by rscaerzx Link to comment Share on other sites More sharing options...