#1 26-08-2010 01:05

Deji
From: UK
Registered: 09-11-2008
Posts: 189
Website

1st Person Driving (Snippet)

Thought I'd post this here too... Could maybe be the beggining of a coding snippets topic in this forum?


0x52B840 - Calls the function that allows the camera to change via script control or internal game control.

I made a simple script to stop the camera from changing to "behind vehicle mode" when you enter a car and turn the player invisible when he's entered it.

So basically, you can move the camera around in the car freely. It works best when your camera mode is set as close to CJ as possible before you get in the car! This will also prevent drivebys from being doable (without extra coding, that is) and quite possibly for stunt jump cams to not take effect.

'tis only a simple thing and I'd allow anyone to improve on it for good use smile

{$CLEO}

0000:

while true
    wait 0
    if
        0256:   player $PLAYER_CHAR defined
    then
        if
            09DE:   actor $PLAYER_ACTOR entering_car    // NOP has to be done before the camera switches.
        then
            if
                8039:   not 0@ == 1
            then
                0006: 0@ = 1
                
                // CLEO 3 compatible.
                0A8C: write_memory 0x52B840 size 4 value 0x90909090 virtual_protect 1     // NOP function
                0A8C: write_memory 0x52B844 size 1 value 0x90 virtual_protect 1     // NOP function Cont.
            end
        else
            if
                0039:   0@ == 1    // we've NOP'd the function and made the player invisible
            then
                if
                    8449:   not actor $PLAYER_ACTOR in_a_car
                then
                    0A8C: write_memory 0x52B840 size 4 value 0xFFC75BE8 virtual_protect 1    // restore function
                    0A8C: write_memory 0x52B844 size 1 value 0xFF virtual_protect 1    // resture function cont.
                    0337: set_actor $PLAYER_ACTOR visibility 1
                    0006: 0@ = 0
                else
                    0337: set_actor $PLAYER_ACTOR visibility 0    // NOP when he's in the car, so we can see past his head
                end
            end
        end
    end
end

Last edited by Deji (26-08-2010 01:06)

Offline

Board footer

Powered by FluxBB