Jump to content

Havana Outfit Fix


spaceeinstein

Recommended Posts

spaceeinstein

Introduction

Havana Outfit Fix is a modification for Grand Theft Auto: Vice City utilizing the CLEO Library. It checks for the misplacement of the Havana outfit pickup and repositions it to the correct location. After completing "Two Bit Hit", the Havana outfit pickup is created in a clothing shop in Little Havana. But doing "Cop Land" or "No Escape?" afterwards causes the game to misplace the pickup behind an invisible barrier. This can normally be avoided if those missions are completed before "Two Bit Hit" but with this mod you can complete the missions in whatever order you want without the pickup being misplaced.

 

Installation

  • Download the mod at GTAGarage. If you are unable to open SEHavana.rar, rename the file to SEHavana.zip. Download the mod from my website.
  • Download CLEO for Vice City at http://cleo.li/.
  • From the CLEO download, copy VC.CLEO.asi into Vice City's folder.
  • If CLEO.asi already exists in the folder, you must delete that file.
  • From this mod download, place the CLEO folder containing SEHavana.cs into Vice City's folder.

This mod has been tested only on VC v1.00 US.

 

Source

 

Sanny Builder


const
STRUCT_BEGIN = 0x945D30
STRUCT_SIZE = 0x34
INDEX = 0@
TEMP_VAR = 1@
PICKUP_LOCATION = 2@
STRUCT_ELEMENT = 3@
PICKUP_AMMO = 4@
TEMP_FVAR = 5@
end

var
INDEX : int
PICKUP_LOCATION : int
STRUCT_ELEMENT : int
PICKUP_AMMO : int
end

0000:
while true
    wait 250
    if
        048C:   pickup_at -1024.5 -433.9 10.9 available_or_will_respawn
    then
        INDEX = 0
        while if INDEX < 335
            STRUCT_ELEMENT = INDEX
            STRUCT_ELEMENT *= STRUCT_SIZE
            STRUCT_ELEMENT += STRUCT_BEGIN
            // get pickup location
            PICKUP_LOCATION = STRUCT_ELEMENT
            0A8D: TEMP_FVAR = read_memory PICKUP_LOCATION size 4 virtual_protect 0
            if and
                TEMP_FVAR > -1025.0
                TEMP_FVAR < -1024.0
            then
                PICKUP_LOCATION += 4
                0A8D: TEMP_FVAR = read_memory PICKUP_LOCATION size 4 virtual_protect 0
                if and
                    TEMP_FVAR > -434.0
                    TEMP_FVAR < -433.0
                then
                    PICKUP_LOCATION += 4
                    0A8D: TEMP_FVAR = read_memory PICKUP_LOCATION size 4 virtual_protect 0
                    if and
                        TEMP_FVAR > 10.0
                        TEMP_FVAR < 11.0
                    then
                        // get pickup ammo
                        PICKUP_AMMO = STRUCT_ELEMENT
                        PICKUP_AMMO += 0x18
                        0A8D: TEMP_VAR = read_memory PICKUP_AMMO size 4 virtual_protect 0
                        if
                            TEMP_VAR == 5
                        then
                            // set location
                            PICKUP_LOCATION = STRUCT_ELEMENT
                            0A8C: write_memory PICKUP_LOCATION size 4 val -1025.2 virtual_protect 0
                            PICKUP_LOCATION += 4
                            0A8C: write_memory PICKUP_LOCATION size 4 val -429.2 virtual_protect 0
                            PICKUP_LOCATION += 4
                            0A8C: write_memory PICKUP_LOCATION size 4 val 10.8 virtual_protect 0
                        end
                    end
                end
            end
            INDEX += 1
        end
    end
end

GTA3Script


LVAR_INT index, temp_var, pickup_location, struct_element, pickup_ammo
LVAR_FLOAT temp_fvar

NOP
havana_loop:
    WAIT 250
    IF IS_ANY_PICKUP_AT_COORDS -1024.5 -433.9 10.9
        index = 0
        WHILE index < 335
            struct_element = index * 0x34
            struct_element += 0x945D30
            // get pickup location
            pickup_location = struct_element
            READ_MEMORY pickup_location 4 0 temp_fvar
            IF temp_fvar > -1025.0
            AND temp_fvar < -1024.0
                pickup_location += 4
                READ_MEMORY pickup_location 4 0 temp_fvar
                IF temp_fvar > -434.0
                AND temp_fvar < -433.0
                    pickup_location += 4
                    READ_MEMORY pickup_location 4 0 temp_fvar
                    IF temp_fvar > 10.0
                    AND temp_fvar < 11.0
                        // get pickup ammo
                        pickup_ammo = struct_element + 0x18
                        READ_MEMORY pickup_ammo 4 0 temp_var
                        IF temp_var = 5
                            // set location
                            pickup_location = struct_element
                            WRITE_MEMORY pickup_location 4 -1025.2 0
                            pickup_location += 4
                            WRITE_MEMORY pickup_location 4 -429.2 0
                            pickup_location += 4
                            WRITE_MEMORY pickup_location 4 10.8 0
                        ENDIF
                    ENDIF
                ENDIF
            ENDIF
            index += 1
        ENDWHILE
    ENDIF
    GOTO havana_loop

 

 

Edited by spaceeinstein
Link to comment
Share on other sites

Blackbird88

Wow it actually works on existing save games! I guess you keep forcing the coords or something. Source please? Curious to see what you did.

  • Like 2
Link to comment
Share on other sites

Wow it actually works on existing save games! I guess you keep forcing the coords or something. Source please? Curious to see what you did.

I guess it checks if the player passed these two missions then if Pickup was created then Destroy it and create another one in the correct position. ( since it's stored in one global variable after all )

Edited by Crspy
  • Like 3
Link to comment
Share on other sites

spaceeinstein

That wouldn't work if you failed the missions, which also cause the pickups to be misplaced. Want to make another guess? Blackbird88's guess is closer.

Edited by spaceeinstein
Link to comment
Share on other sites

That wouldn't work if you failed the missions, which also cause the pickups to be misplaced. Want to make another guess? Blackbird88's guess is closer.

Okay another guess , Check if the pickup at the wrong position is available or will respawn (048C) , then destroy the pickup and create it in the correct position...... i presume that should work correctly ?

Link to comment
Share on other sites

Igor Bogdanoff

is it done the same way as silent moved save in amdd dogg's house?

Link to comment
Share on other sites

spaceeinstein

I did use 048C to check for the pickup's existence at the location but I didn't delete and recreate the pickup. I went through all the pickups in the game to find the matching pickup and just changed its coordinates. I've updated my post with the source code.

Edited by spaceeinstein
Link to comment
Share on other sites

  • 9 months later...
Savannahpaige

I just went threw over half the game, and did copland first before the others.. And i got the glitch! I was so glad to find a real fix.. Then i realized GTA Garage is still down after over a week.. Is there anywhere else to download this?

Link to comment
Share on other sites

  • 10 months later...

Hey man i just downloaded this and installed it just as it says, but it doesn't seem to be working :/ I checked CLEO's log in the game files and it appears to be detecting it and applying it(?) but the glitch is still there.

I'm using the steam version (with silent's patch to make it playable) so that may be the problem, but still, can you help me in anyway?

Link to comment
Share on other sites

  • 2 weeks later...
On 4/20/2019 at 1:36 AM, NanoBarAr said:

Hey man i just downloaded this and installed it just as it says, but it doesn't seem to be working :/ I checked CLEO's log in the game files and it appears to be detecting it and applying it(?) but the glitch is still there.

I'm using the steam version (with silent's patch to make it playable) so that may be the problem, but still, can you help me in anyway?

Nevermind that, i just did this and it worked, you just have to run the testapp.exe instead of the steam executable for the mods to apply

Link to comment
Share on other sites

  • 2 years later...
EyeballMaster3

This didn't work. I did everything correctly and it said that there was one script but 0 plugins loaded.

 

Link to comment
Share on other sites

  • 1 year later...
strejda603

Thank you @spaceeinstein for the source code!

 

I'm trying to convert this code into universal function for CLEO Redux (which with I could then move any pickup from its original location to somewhere else)... Right now I ended up with this code:

/**
 * @param {obj} oPos
 * @param {obj} nPos
 * @returns {Pickup}
 */
function movePickup(oPos, nPos) {
  let index = 0; // @0

  while (index < 335) {
    let element = index * 0x34; // STRUCT_ELEMENT @3
    element += 0x945d30; // STRUCT_BEGIN CPickupVC
    let loc = element; // @2
    let pickup_ammo = element + 0x18; // @4

    // let temp_fval = Memory.Read(loc, 4, false); // @5
    let pos = {
      x: Memory.Read(loc, 4, false),
      y: Memory.Read(loc + 4, 4, false),
      z: Memory.Read(loc + 8, 4, false),
    };
    let temp_val = Memory.Read(pickup_ammo, 4, false); // @1 - Where TF you belong?!
    if (
      pos.x < oPos.x + 1.0 &&
      pos.x > oPos.x - 1.0 &&
      pos.y < oPos.y + 1.0 &&
      pos.y > oPos.y - 1.0 &&
      pos.z < oPos.z + 1.0 &&
      pos.z > oPos.z - 1.0
    ) {
      Memory.Write(loc, 4, nPos.x, false);
      Memory.Write(loc + 4, 4, nPos.y, false);
      Memory.Write(loc + 8, 4, nPos.z, false);
    }
    index++;
  }
}

... but I have no idea, where I should put the "pickup_ammo" variable (or if I even need to use it, if I want to move i.g. save marker location)..

 

Does anyone have some idea?

 

Thank you.

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
  • 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.