Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

gtav_clover

[LUA|MoonLoader] Weapon Recoil

Recommended Posts

gtav_clover
Posted (edited)

Recoil

for Grand Theft Auto: San Andreas

 

This is a script written in LUA,  causing weapons to recoil when shot. Works with all weapons that can be aimed.

 

Features:

Spoiler

Recoil:  The crosshair will not stay in the same place when shooting a weapon now. It will move, making it difficult to shoot.

There is an option to choose whether the weapon uses the global recoil value, value based on its accuracy, a specific value,  even disable recoil for said weapon, or for every weapon except specific weapons!

Also an option to choose whether the recoil is upwards, or in any direction.

The recoil is independent of in-game mouse sensitivity.

 

Camera shake: The camera will now shake when shooting a weapon. It will shake, making it difficult to shoot.

There is an option to choose whether the weapon uses the global camshake value,  a specific value, even disable camshake for said weapon, or for every weapon except specific weapon!

 

Fall: There is now a chance to fall when shooting a weapon. It also works with ragdoll.

There is an option to choose whether the weapon uses the global fallchance value, a specific value, even disable fallchance for said weapon, or for every weapon except specific weapon!

 

Option to set in percent how much the recoil and camshake decreases when standing still or crouching!

 

Option to set in percent how much the fallchance decreases when crouching!

 

Global Multiplier: The global multiplier multiplies the recoil and camshake values, so you don't have to edit every value manua

 

No crosshair spread: A .lua file provided disabled the game crosshair from spreading. Use it if you think spreading and recoil combined are too difficult.

 

NOTE: Also works with added weapons, but they use the global values if not adapted.

 

 

Install Instructions:

Spoiler

Requires MoonLoader:

https://gtaforums.com/topic/890987-moonloader/

 

1. Download MoonLoader

2. Install MoodLoader (Instruction should be given in MoonLoader Topic)

3. Drag and Drop 'Recoil.lua file into 'moonloader' in GTA SA directory.

4. Drag and Drop 'NoCrosshairSpread.lua' file into 'moonloader' in GTA SA directory, BUT ONLY if you want to disable crosshair from spreading when shooting.

 

Adapting / Editing Weapons Settings:

Spoiler

Many weapons have been already added in the default .ini file. Follow their examples to add/edit weapons settings. If any help is needed, feel free to send me a PM.

 

Download link:

V8 - V7 - V6 - V5 - V4 - V3 - V2 - V1

 

Credits:

Spoiler

FYP - MoonLoader

gtav_clover - Recoil Script

Opcode.exe - Camera Move function memory addresses (Previous mouseMove function was also by him)

Deji - Camera IDs table

DK22Pac - Plugin-SDK SA structs

FYP - RapidFire Example and FFI struct of CWeapon

MKKJ - Crosshair spread memory address

Oksu - Camera ID memory address

 

Changelog: (Also given in archive)

Spoiler

To-do:
Add better checks for aiming and firing. (Only if bugs appear.)
Add a documentation. (Can't do now; still adding more features. Check out ini files instead.)
Find a way to make it work with First Person Mod. (Any help would be appreciated.)
Make recoil work when auto-aiming. (Honestly, I'm not sure because I don't think anyone who uses auto-aiming would want recoil anyway.)

v8:
1. Script completely rewritted. Now it is better, more optimized and cleaner.
2. Settings transferred to an .ini file.
3. Settings are applied as soon as they are edited and the file is saved.
4. Added option to disable camshake when in first-person cameras.
5. Added option to disable fallchance when crouching.
6. Added recoil multiplier for dual-wielded weapons.
7. Recoil does not work when auto-aiming.
8. Added option to set force when falling. It can be either a global value or a weapon-specific value.
9. Added recoil multiplier for weapons using shotgun animations. Only works with auto-recoil.
10. Now auto-recoil is calculated based on a weapon's accuracy, length (fireoffset x) and damage.
11. Added option to disable downwards recoil, removed option to enable only upwards recoil.
12. Added missing camera modes, causing recoil to not work with some camera modes.
13. Changed percentage based values to multipliers.
14. Added globall fallback force multiplier.
15. Added a table to define shotgun animgroup ids for auto-recoil. (Just in case)
16. Added a table to define heavy weapon (like minigun) animgroup ids for auto-recoil. (Just in case)
17. Added a recoil multiplier for heavy weapons. Only works with auto-recoil.
18. The standing still and crouching multipliers work seperately. (Meaning you can either have the standing still or the crouching multiplier in effect at once)
19. Changed auto-recoil trigger from -1 to A.
20. bDisableCrosshairSpread switch now takes effect instantly.
21. Added install instructions.

v7:
1. Replaced the mouseMove function with in-game camera movement function. Now it is supported by all operating systems and control types (previously onyl on Windows was supported)
2. Recoil is now completely equal accross all operating systems and control types.
3. Added customizable fallchance decrease when crouching.
4. Replaced bEnableFourWayRecoil with bEnableRecoilInAnyDirection. Enabling it will now cause recoil in infinite random directions.(Previously it was 8 random directions)
5. No longer works with First Person Mod.

v6:
1. Added option to choose weapon recoil based on its accuracy. (Looks weird, check out 'Weapon Settings.txt' for more info.)
2. Removed 'NoCrosshairSpread.lua', added option to disable crosshair spread in 'Recoil.lua'

v5: 
1. Mouse senstivity finally fixed. Previously it was a little inaccurate.
2. Now also works with joystick controls, though recoil is a little bit inaccurate. (At least I think so.)
3. Added option to switch recoil on/off when auto-aiming.

v4:
1. Add fallchance and fallchance switch. Fallchance is also compatible with ragdoll.
2. Tried to fix mouse senstivity.
3. Add customizable accuracy increase when standing still.

v3:
1. Camshake now also works even if player is not aiming.
2. Fixed mouse senstivity calculation.
3. Fixed a bug causing recoil to work with non-bullet and non-missile weapons (e.g, spraycan, fire extinguisher etc.).
4. Previously, recoil sometimes did not work. Now it will always work.
5. Added customizable accuracy increase when crouching.
3. Added option to choose whether the weapon recoil occurs only upwards or in all directions (four-way recoil).

v2:
1. Added camshake and camshake switch.
2. Added option for weapon-specific settings.
3. Added global multiplier.
4. Added mouse senstivity independency for recoil.

v1:
1. Added recoil.
2. Added recoil switch.

 

 

 

Edited by gtav_clover
Update

Share this post


Link to post
Share on other sites
thalilmythos

I did "something like this" in cleo, but this is a whole new level you should make a video about it, but the description for me is convincing enough, downloading

Share this post


Link to post
Share on other sites
B Dawg
Posted (edited)

This recoil mod is absolutely perfect. It doesn't automatically reset itself when you stop shooting like in your usual shooter games, and it's highly customizable.

Edited by B Dawg

Share this post


Link to post
Share on other sites
gtav_clover
Posted (edited)

Latest version up. All known bugs fixed. Post if any more bugs are found. Sorry, but I can't make a video. My PC is just too much of a toaster. If someone could make a video, I would appreciate it.

EDIT: Tried making a video, I'm surprised my PC didn't explode.

Edited by gtav_clover

Share this post


Link to post
Share on other sites
Vills SkyTerror

Good job. I am enjoying these LUA scripts more and more.

Share this post


Link to post
Share on other sites
gtav_clover

Latest version (V5) up. Read the end of post or change log given in download for update.

Share this post


Link to post
Share on other sites
Davve95

All features sounds pretty cool!

I don't know what recoil is though..

Share this post


Link to post
Share on other sites
LaDiDa

The bumping around of your crosshair when firing a gun, like kickback due to the force of a shot.

Share this post


Link to post
Share on other sites
gtav_clover
Posted (edited)

V6 up. Changelog also given in topic this time.

Edited by gtav_clover

Share this post


Link to post
Share on other sites
gtav_clover
Posted (edited)

V7 up. The biggest update so far! Read the changelog for more info.

 

Edit: I messed up. V7 Reuploaded because I forgot to turn off debug. Please redownload.

Edited by gtav_clover
Sorry for double post.

Share this post


Link to post
Share on other sites
gtav_clover

V8 up. Sorry I was inactive for so long.

Share this post


Link to post
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

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.