Quantcast

Jump to content

» «
Photo

Change Motorcyle body

3 replies to this topic
Odyne
  • Odyne

    Player Hater

  • Members
  • Joined: 17 Jul 2011

#1

Posted 21 October 2013 - 02:14 PM

Hello,

 

is it possible to change the motorcycle body with a cleo script?

For example the BF-400 has 3 versions, streetfighter (no fairing), half fairing and full fairing. 

 

Spoiler

 

Maybe with a menu where you can select the type?

 

Possible or not?

 

Thanks


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#2

Posted 21 October 2013 - 06:32 PM Edited by Wesser, 31 October 2013 - 11:31 AM.

I'll prepare the script tomorrow. The idea is hiding all of the current vehicle's extras and make only those desired visible. Stay tuned. :)
 
//Edit: I apologize for not keeping my promise completely but better late than never:
{$CLEO}

0000: NOP

const
    CARCOMPS_EXTRA1 = 2
    CARCOMPS_EXTRA2 = 4
end
const
    PAD1           = 0
end
const
    LEFTSHOULDER1  = 4
end
const
    MODELTYPE_BOAT = 5
    MODELTYPE_BIKE = 9
    MODELTYPE_BMX  = 10
end
const
    _HOOK_004C96F5_CModelCars__cloneData = [email protected]
    _HOOK_004C9763_CModelCars__cloneData = [email protected]
    _getModelPtr                         = 0x00403DA0
    _rwFrameClone                        = [email protected]
    _rwFrameAddChild                     = [email protected]
    _rwFrameDestroy                      = [email protected]
    _rwFrameFindNodeByName               = 0x004C5400
    _rwFrameGetNodeName                  = 0x0072FB30
    _rpClumpAddAtomic                    = [email protected]
    _rpClumpRemoveAtomic                 = [email protected]
    _rpClumpFindFrameById                = 0x004C53C0
    _rpAtomicClone                       = [email protected]
    _rpAtomicSetFrame                    = [email protected]
    _rpAtomicDestroy                     = [email protected]
    _rpAtomicSetCarMatFX                 = 0x004C9410
end

0A9F: [email protected] = current_thread_pointer
0A8E: [email protected] = [email protected] + 0x10 // CScriptThread.m_iBaseAddress
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0

0A8F: _HOOK_004C96F5_CModelCars__cloneData = [email protected] - @HOOK_004C96F5_CModelCars__cloneData
0A8F: _HOOK_004C9763_CModelCars__cloneData = [email protected] - @HOOK_004C9763_CModelCars__cloneData
0A8E: [email protected] = 0x00537338 + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rwFrameClone = [email protected] + [email protected]
0A8E: [email protected] = 0x004C9269 + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rwFrameAddChild = [email protected] + [email protected]
0A8E: [email protected] = 0x004C4473 + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rwFrameDestroy = [email protected] + [email protected]
0A8E: [email protected] = 0x004C6CC1 + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rpClumpAddAtomic = [email protected] + [email protected]
0A8E: [email protected] = 0x004C6CBA + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rpClumpRemoveAtomic = [email protected] + [email protected]
0A8E: [email protected] = 0x004C44EE + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rpAtomicClone = [email protected] + [email protected]
0A8E: [email protected] = 0x004C450A + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rpAtomicSetFrame = [email protected] + [email protected]
0A8E: [email protected] = 0x004C446D + 0x01
0A8E: [email protected] = [email protected] + 0x04
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 1
0A8E: _rpAtomicDestroy = [email protected] + [email protected]

// Make CModelCars__cloneData cloning the primary extra frame to copy also the node name.
0A8E: [email protected] = 0x004C96F5 + 0x05
0A8F: [email protected] = _HOOK_004C96F5_CModelCars__cloneData - [email protected]
0A8C: write_memory 0x004C96F5 size 1 value 0xE9 virtual_protect 1
0A8C: write_memory 0x004C96F6 size 4 value [email protected] virtual_protect 1
0A8E: [email protected] = _HOOK_004C96F5_CModelCars__cloneData + 0x08
0A8E: [email protected] = [email protected] + 0x04
0A8F: [email protected] = _rwFrameClone - [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 1
0A8E: [email protected] = _HOOK_004C96F5_CModelCars__cloneData + 0x0F
0A8E: [email protected] = [email protected] + 0x04
0A8F: [email protected] = 0x004C9715 - [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 1
0A8C: write_memory 0x004C971F size 1 value 0x24 virtual_protect 1
0A8C: write_memory 0x004C972A size 1 value 0x28 virtual_protect 1
0A8C: write_memory 0x004C9735 size 1 value 0x34 virtual_protect 1
0A8C: write_memory 0x004C9738 size 1 value 0x20 virtual_protect 1
// Do the same thing for the secondary extra frame.
0A8E: [email protected] = 0x004C9763 + 0x05
0A8F: [email protected] = _HOOK_004C9763_CModelCars__cloneData - [email protected]
0A8C: write_memory 0x004C9763 size 1 value 0xE9 virtual_protect 1
0A8C: write_memory 0x004C9764 size 4 value [email protected] virtual_protect 1
0A8E: [email protected] = _HOOK_004C9763_CModelCars__cloneData + 0x08
0A8E: [email protected] = [email protected] + 0x04
0A8F: [email protected] = _rwFrameClone - [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 1
0A8E: [email protected] = _HOOK_004C9763_CModelCars__cloneData + 0x0F
0A8E: [email protected] = [email protected] + 0x04
0A8F: [email protected] = 0x004C9783 - [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 1
0A8C: write_memory 0x004C978D size 1 value 0x24 virtual_protect 1
0A8C: write_memory 0x004C9798 size 1 value 0x28 virtual_protect 1
0A8C: write_memory 0x004C97A3 size 1 value 0x34 virtual_protect 1
0A8C: write_memory 0x004C97A6 size 1 value 0x20 virtual_protect 1

while true
    if
    00DD:  actor $PLAYER_ACTOR driving_car_with_model #BF400
    then
        03C0: [email protected] = actor $PLAYER_ACTOR car
        0441: [email protected] = car [email protected] model
        if
        00E1:  player PAD1 pressed_key LEFTSHOULDER1 // Secondary Fire
        then
            0AA7: call_function _getModelPtr num_params 1 pop 1 iId [email protected] pclInfo [email protected]
            [email protected] += 0x5C // CModelCars.m_paclVehicleStruct
            0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
            0A8E: [email protected] = [email protected] + 0x030C // CVehicleStruct.m_iNumExtras
            0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
            if
                [email protected] > 0
            then
                0A8E: [email protected] = [email protected] + 0x3C // CModelCars.m_eType
                0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                0A97: [email protected] = car [email protected] struct
                0A8E: [email protected] = [email protected] + 0x0018 // CVehicle.m_clEntity.m_pstRpClump
                0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                if and
                    [email protected] >= MODELTYPE_BOAT
                    [email protected] <> MODELTYPE_BIKE
                    [email protected] <> MODELTYPE_BMX
                then
                    0A8E: [email protected] = [email protected] + 0x04 // SRpClump.m_stObject.m_pstParent
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                else
                    0AA7: call_function _rpClumpFindFrameById num_params 2 pop 2 iHierarchyId 1 pstRpClump [email protected] pstRwFrame [email protected]
                    if
                        [email protected] == 0x00000000
                    then
                        0A8E: [email protected] = [email protected] + 0x04 // SRpClump.m_stObject.m_pstParent
                        0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    end
                end
                0A8E: [email protected] = [email protected] + 0x02F4 // CVehicleStruct.m_apstExtraAtomics (array_sizeof = 6)
                0A8E: [email protected] = [email protected] + 0x0438 // CVehicle.m_cPrimaryExtraId
                0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
                if
                88B7:  not test [email protected] bit 7
                then
                    0A90: [email protected] = [email protected] * 0x04 // sizeof(SRwFrame *)
                    005A: [email protected] += [email protected]
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    0A8E: [email protected] = [email protected] + 0x04 // SRpAtomic.m_stObject.m_stObject.m_pstParent
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    if
                        [email protected] <> 0x00000000
                    then
                        0AA7: call_function _rwFrameGetNodeName num_params 1 pop 1 pstRwFrame [email protected] pszNodeName [email protected]
                        0AA7: call_function _rwFrameFindNodeByName num_params 2 pop 2 pszNodeName [email protected] pstRwFrame [email protected] pstRwFrame [email protected]
                        if
                            [email protected] <> 0x00000000
                        then
                            0A8E: [email protected] = [email protected] + 0x90 // SRwFrame.m_stAtomicList.m_pstNext
                            0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                            [email protected] -= 0x08 // SRpAtomic
                            0AA5: call _rpClumpRemoveAtomic num_params 2 pop 2 pstRpAtomic [email protected] pstRpClump [email protected]
                            0AA5: call _rpAtomicDestroy num_params 1 pop 1 pstRpAtomic [email protected]
                            0AA5: call _rwFrameDestroy num_params 1 pop 1 pstRwFrame [email protected]
                        end
                    end
                end
                0A90: [email protected] = CARCOMPS_EXTRA1 * 0x04 // sizeof(SRwFrame *)
                005A: [email protected] += [email protected]
                0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                if
                    [email protected] <> 0x00000000
                then
                    0A8E: [email protected] = [email protected] + 0x04 // SRpAtomic.m_stObject.m_stObject.m_pstParent
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    0AA7: call_function _rpAtomicClone num_params 1 pop 1 pstRpAtomic [email protected] pstRpAtomic [email protected]
                    0AA7: call_function _rwFrameClone num_params 1 pop 1 pstRwFrame [email protected] pstRwFrame [email protected]
                    0AA5: call _rpAtomicSetFrame num_params 2 pop 2 pstRwFrame [email protected] pstRpAtomic [email protected]
                    0AA5: call _rpClumpAddAtomic num_params 2 pop 2 pstRpAtomic [email protected] pstRpClump [email protected]
                    0AA5: call _rwFrameAddChild num_params 2 pop 2 pstRwChild [email protected] pstRwFrame [email protected]
                    0AA5: call _rpAtomicSetCarMatFX num_params 2 pop 2 iMaterialId 0 pstRpAtomic [email protected]
                    0A8C: write_memory [email protected] size 1 value CARCOMPS_EXTRA1 virtual_protect 0
                end
                0A8E: [email protected] = [email protected] + 0x0439 // CVehicle.m_cSecondaryExtraId
                0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
                if
                88B7:  not test [email protected] bit 7
                then
                    0A90: [email protected] = [email protected] * 0x04 // sizeof(SRwFrame *)
                    005A: [email protected] += [email protected]
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    if
                        [email protected] <> 0x00000000
                    then
                        0A8E: [email protected] = [email protected] + 0x04 // SRpAtomic.m_stObject.m_stObject.m_pstParent
                        0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                        0AA7: call_function _rwFrameGetNodeName num_params 1 pop 1 pstRwFrame [email protected] pszNodeName [email protected]
                        0AA7: call_function _rwFrameFindNodeByName num_params 2 pop 2 pszNodeName [email protected] pstRwFrame [email protected] pstRwFrame [email protected]
                        if
                            [email protected] <> 0x00000000
                        then
                            0A8E: [email protected] = [email protected] + 0x90 // SRwFrame.m_stAtomicList.m_pstNext
                            0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                            [email protected] -= 0x08 // SRpAtomic
                            0AA5: call _rpClumpRemoveAtomic num_params 2 pop 2 pstRpAtomic [email protected] pstRpClump [email protected]
                            0AA5: call _rpAtomicDestroy num_params 1 pop 1 pstRpAtomic [email protected]
                            0AA5: call _rwFrameDestroy num_params 1 pop 1 pstRwFrame [email protected]
                        end
                    end
                end
                0A90: [email protected] = CARCOMPS_EXTRA2 * 0x04 // sizeof(SRwFrame *)
                005A: [email protected] += [email protected]
                0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                if
                    [email protected] <> 0x00000000
                then
                    0A8E: [email protected] = [email protected] + 0x04 // SRpAtomic.m_stObject.m_stObject.m_pstParent
                    0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
                    0AA7: call_function _rpAtomicClone num_params 1 pop 1 pstRpAtomic [email protected] pstRpAtomic [email protected]
                    0AA7: call_function _rwFrameClone num_params 1 pop 1 pstRwFrame [email protected] pstRwFrame [email protected]
                    0AA5: call _rpAtomicSetFrame num_params 2 pop 2 pstRwFrame [email protected] pstRpAtomic [email protected]
                    0AA5: call _rpClumpAddAtomic num_params 2 pop 2 pstRpAtomic [email protected] pstRpClump [email protected]
                    0AA5: call _rwFrameAddChild num_params 2 pop 2 pstRwChild [email protected] pstRwFrame [email protected]
                    0AA5: call _rpAtomicSetCarMatFX num_params 2 pop 2 iMaterialId 0 pstRpAtomic [email protected]
                    0A8C: write_memory [email protected] size 1 value CARCOMPS_EXTRA2 virtual_protect 0
                end
            end
            while 00E1:  player PAD1 pressed_key LEFTSHOULDER1 // Secondary Fire
                wait 0
            end
        end
    end
    wait 0
end

:HOOK_004C96F5_CModelCars__cloneData
hex
    8B0C24      // mov     ecx, dword ptr [esp]
    8B51 04     // mov     edx, [ecx+SRpAtomic.m_stObject.m_stObject.m_pstParent]
    52          // push    edx
    E8 00000000 // call    rwFrameClone
    8BF8        // mov     edi, eax
    E9 00000000 // jmp     4C9715h
end

:HOOK_004C9763_CModelCars__cloneData
hex
    8B0C24      // mov     ecx, dword ptr [esp]
    8B51 04     // mov     edx, [ecx+SRpAtomic.m_stObject.m_stObject.m_pstParent]
    52          // push    edx
    E8 00000000 // call    rwFrameClone
    8BF8        // mov     edi, eax
    E9 00000000 // jmp     4C9783h
end
  • Silent likes this

Odyne
  • Odyne

    Player Hater

  • Members
  • Joined: 17 Jul 2011

#3

Posted 22 October 2013 - 10:39 AM Edited by Odyne, 22 October 2013 - 10:49 AM.

I found the opcode it's: 0506: set_vehicle_model #nrg500 next_variation 0 0

 

See sannybuilder help > scm documentation > gta sa > car variations

 

But how do you use it?

 

 

EDIT:

 

Got it. My question is answered.


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#4

Posted 30 October 2013 - 05:33 PM

You should have specified that you were also accepting to change the extra components of a new vehicle, it's far simpler.

By the way, if anyone is interested, I updated my previous post by showing the script for setting the primary and secondary extra components of a spawned vehicle.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users