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. After Hours
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. 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

Sign in to follow this  
4sinayousefi

Burst fire tutorial

Recommended Posts

4sinayousefi

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Strs

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.

 

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
Sign in to follow this  

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