#1 12-08-2009 18:04

Wesser
From: Matera, Italy
Registered: 12-08-2009
Posts: 10

[QST] Removing auto-reload

Hi, there. This is my first post which I've ever made here. I was thinking if there's a way to remove the annoying auto-reload thing when CJ changes his weapon.

This is my script which reloads the current weapon by pressing "R", of course. tongue

Deleted...

Hope someone can give me a solution by nopping something. wink

Last edited by Wesser (15-08-2009 11:40)

Offline

#2 15-08-2009 11:39

Wesser
From: Matera, Italy
Registered: 12-08-2009
Posts: 10

Re: [QST] Removing auto-reload

Sorry for the double post, but I think I found a workable way. blush

The code I've already posted is a bit incorrect for some reasons. Here is the code which works as I want but only when the player isn't in a car, because the game automatically removes the reload. sad

{$CLEO}

0000: NOP

while true
  wait 0 
  if 
  0256:  player $PLAYER_CHAR defined
  then
    if 
    8118:  not actor $PLAYER_ACTOR dead
    then
      if 
      8449:  not actor $PLAYER_ACTOR in_a_car
      then
        gosub @NoReloadAnimFix 
        if 
        0AB0:  key_pressed 0x52 // R
        then
          gosub @GetCurrentSlot 
          gosub @GetClipAmmo 
          gosub @GetCurrentWeapon 
          gosub @GetCurrentAmmo 
          0062: 3@ -= 5@ // (int) 
          if 
            3@ > 0 
          then
            if 
            803B:  not 2@ == 5@ // (int) 
            then
              000E: 0@ -= 0x04 
              0A8C: write_memory 0@ size 4 value 2 virtual_protect 0 
              gosub @GetWeapGroup 
              7@(6@,13i) = 0 
              repeat
                wait 0 
                0A8D: 10@ = read_memory 0@ size 4 virtual_protect 0 
              until 10@ <> 2 
            end
          end
        end
      end
    end
  end
  gosub @GetCurrentWeapon 
  gosub @GetWeapGroup 
  gosub @GetMaxClipAmmo 
  gosub @GetCurrentSlot 
  gosub @GetClipAmmo 
  if 
  803B:  not 2@ == 5@ // (int) 
  then
    0085: 7@(6@,13i) = 5@ // (int) 
  end
  if and
    7@(6@,13i) <> 0 
  803B:  not 7@(6@,13i) == 5@ // (int) 
  then
    0062: 2@ -= 5@ // (int) 
    gosub @GetCurrentAmmo 
    005A: 3@ += 2@ // (int) 
    017B: set_actor $PLAYER_ACTOR weapon 1@ ammo_to 3@ 
    0A8C: write_memory 0@ size 4 value 7@(6@,13i) virtual_protect 0 
  end
end

:NoReloadAnimFix
if 
80E1:  not player 0 pressed_key 6 
then
  if 
  00E1:  player 0 pressed_key 17 
  then
    repeat
      wait 0 
      if or
      00E1:  player 0 pressed_key 5 
      00E1:  player 0 pressed_key 7 
      then
        break
      end
    until 03EE:  player $PLAYER_CHAR controllable
  end
end
return 

:GetCurrentWeapon
0470: 1@ = actor $PLAYER_ACTOR current_weapon
return 

:GetMaxClipAmmo
0085: 0@ = 1@ // (int) 
0012: 0@ *= 0x70 
000A: 0@ += 0xC8AAB8 
000A: 0@ += 0x20 
0A8D: 2@ = read_memory 0@ size 2 virtual_protect 0 
return 

:GetCurrentAmmo
041A: 3@ = actor $PLAYER_ACTOR weapon 1@ ammo
return 

:GetCurrentSlot
0A96: 0@ = actor $PLAYER_ACTOR struct
000A: 0@ += 0x718 
0A8D: 4@ = read_memory 0@ size 1 virtual_protect 0 
return 

:GetClipAmmo
0A96: 0@ = actor $PLAYER_ACTOR struct
000A: 0@ += 0x5A0 
4@ *= 0x1C 
005A: 0@ += 4@ // (int) 
000A: 0@ += 0x08 
0A8D: 5@ = read_memory 0@ size 4 virtual_protect 0 
return 

:GetWeapGroup
0782: get_weapon_with_ID 1@ weapon_group_to 6@ 
return

Thanks however. tongue

Offline

Board footer

Powered by FluxBB