Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Forum Support

    3. Suggestions

Burst fire tutorial


JohnDoe4444
 Share

Recommended Posts

ITNOG.

Hello guys and girls. As you have noticed, I'm gonna show you how to make a script which enables you to fire a weapon in bursts. Burst fire as most of you know is a firing mode that enables you to shoot a predetermined number bullets with each pull of trigger for example 3 as seen in most firearms in videogames. Let me be honest with you from the beginning. It has a few bugs but anyway gets the job done.

Here's the code I used to make my AR15 type rifle shoot in bursts of 3.

:LABEL_2wait 0if02D8:   actor $PLAYER_ACTOR current_weapon == 31jf @LABEL_2if02E0:   actor $PLAYER_ACTOR firing_weaponjf @LABEL_2wait 1300881: set_player $PLAYER_CHAR able_to_shoot_weapons 0wait 3000881: set_player $PLAYER_CHAR able_to_shoot_weapons 1jump @LABEL_1 

02D8 is there to check which weapon are you holding (in this case the "M4")

02E0 is simply used to check if the player is firing

wait 130 and the first 0881 is used to check whether enough cartridges have been fired (or better to say "how much time was the weapon being fired) or not and then stop the playa from shootin'

and wait 300 and the last 0881 is used to enable the player to fire another burst of bullets. The wait 300 is essentially the delay between the bursts. Set to lower or higher offsets if you wish.

 

NOTE: The wait 130 I used is to check how much time the weapon has been fired not to check how many cartridges have been fired. Since my modified weapon.dat int animLoop start, end, fire is set to 6 8.5 7 (which gives the weapon a higher rate of fire than the normal offsets), I struggled with the number to set the script execute the code within 0.130 sec, when approximately but not essentially accurately it had fired 3 bullets. I haven't tested the normal 6 10 7 offsets which makes the weapon fire slower than my own modified one.

 

There are a few known bugs:

1. It's not much realistic. If you start firing the weapon and quickly stop firing, not firing enough bullets to full a single burst (firing 1 or 2 bullets instead of for example 3 bursts), the script is not applied to the following bullet(s) of that "burst" as opposed to some real life designs where if you fire e.g. a M16 in a way that only 1 or 2 bullets are fired, the other 1 or 2 bullets from that burst must be fired to set the next burst. Although such mechanism does not apply to all burst fire weapons.

2. When not aiming and simply shooting without pressing the aim button it causes a small animation bug where after firing a burst, the player will start the animation of drawing one's weapon. This problem is not caused if you aim and shoot.

3. Not actually a bug. Like I said the script simply checks how much time the weapon has been fired not how many bullets. Thus, the script doesn't accurately examine the number of bullets fired. However it wasn't much of a problem to me after struggling with the numbers.

Edited by 4sinayousefi
Link to comment
Share on other sites

  • 10 months later...
Gian_Yagami

Nice tutorial, I've tried to find out something like this. I want to make realistic control like tapping for semi auto gun rather than hold button all times.

 

Using scm script has many obstacles, as I know there's no opcodes which can count how many bullet has been shooted. I've thought about it and I got an idea, here:

1. check if player using selected weapon.

2. save clip value to an X variable.

3. while player starts shooting, compare current value to X variable (X - current value).

4. check if compared value has reach brust limit.

5. break looping steps number 3, and make player unable to fire.

6. wait Z time, there's a delay in brust fire right? CMIIW

7. Make player gun is able to shoot again.

 

I haven't hold scm coding again for time, I don't know if there is a command where player shoot without must press fire button. but this method will work without calculating wait time manually.

Link to comment
Share on other sites

  • 7 months later...

i like the idea i have done it :)

Using scm script has many obstacles, as I know there's no opcodes which can count how many bullet has been shooted. I've thought about it and I got an idea, here:

1. check if player using selected weapon.

2. save clip value to an X variable.

3. while player starts shooting, compare current value to X variable (X - current value).

4. check if compared value has reach brust limit.

5. break looping steps number 3, and make player unable to fire.

6. wait Z time, there's a delay in brust fire right? CMIIW

7. Make player gun is able to shoot again.

 

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
 Share

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