Grand Theft Auto IV: The Complete Edition

Grand Theft Auto IV: The Complete Edition

35 hodnocení
Modifying Weapon Performance
Vytvořil: Gumbo Slice
This guide will show you how to edit your WeaponInfo.xml which defines your weapon stats, I am not a professional nor did I look at any tutorials (assuming there isn't any) so this is based completely off of my experience. If you want to help and give some information, please do.
NOTE
The codes don't have accurate spacing so I suggest you use the code in the WeaponInfo.xml instead.
   
Ocenit
Přidat do oblíbených
Oblíbeno
Odebrat z oblíbených
Introducing The WeaponInfo.xml

(The codes don't have accurate spacing so I suggest you find the code in the WeaponInfo.xml instead)
The WeaponInfo.xml is located in your GTAIV/common/data, this file defines the weapons' time between shots, its flags, how much ammo it has, how fast it shoots, and just about everything to do with the gun. This will work for EFLC's WeaponInfo file as well and if you want to join servers where no mods are allowed go into EFLC/TBoGT/common/data or EFLC/TLAD/common/data and ONLY edit those WeaponInfo.xml files NOT the root folder which contains GTA IV's original. Although the WeaponInfo.xml defines the most useful properties it still has it's limits, for instance; you can't change how many bombs your sticky bomb weapon can have at once, but you can change how much damage is done, how much force is applied, ...etc.

Modifying the WeaponInfo.xml can cause strange behavior with guns even guns that you didn't directly modify can act out of line. It works pretty well for the most part though, all of my posted information is as accurate as I can get it, I will mention whether I know for sure or not when I try to explain it.
Modifying The WeaponInfo.xml
BEFORE YOU BEGIN
Install Notepad ++ , it makes life easier, but if you got something else that opens .xml files to be edited then go for it.

NOTE IF USING IN MP
Do not modify the damage or force of the weapon, or else when you get shot the force and damage is applied to you, and it won't apply those modifiers on other players too well!

REMINDER: DO NOT modify GTA IV's Weaponinfo if you plan on playing in non-moded MP games, so if you have EFLC only modify the TBoGT and TLAD Weaponinfo.

Choose the gun you wish to edit in the WeaponInfo.xml, I displayed the M4 code (remember all weapons begin with <weapon type= and end with </weapon>)

<weapon type="M4"> <data slot="RIFLE" firetype="INSTANT_HIT" damagetype="BULLET" group="RIFLE_ASSAULT" targetrange="65.0" weaponrange="70.0" clipsize="30" ammomax="600" timebetweenshots="133"> <damage base="30" networkplayermod="2.5" networkpedmod="1.25"/> <physics force="75.0"/> <reload time="2066" fasttime="1166" crouchtime="2066"/> <aiming accuracy="0.5"> <offset x="0.14" y="1.0" z="0.55"/> <crouchedoffset x="0.08" y="1.0" z="0.12"/> <reticule standing="0.6" ducked="0.5" scale="0.3"/> </aiming> <pickup regentime="600000" ammoonstreet="80"/> <controller> <rumble duration="90" intensity="0.1"/> </controller> <flags> <flag>GUN</flag> <flag>CAN_AIM</flag> <flag>CAN_FREE_AIM</flag> <flag>ANIM_RELOAD</flag> <flag>ANIM_CROUCH_FIRE</flag> <flag>2HANDED</flag> </flags> </data> <assets model="w_m4"> <anim group="gun@ak47"> <rates firerate="1.2" blindfirerate="1.2"/> </anim> <effects> <muzzle fx="muz_machine"/> <shell fx="weap_ejected_rifle"/> </effects> </assets> </weapon>

This defines what weapon it is:

<weapon type="M4">

You don't really want to change this as it may screw the whole thing up, unless you use EPISODIC_22 and up, which it will work but there may be some negative effects such as: a weapon that has explosive rounds will return to normal rounds. On the flip side, this could be used to make another gun use explosive rounds in EFLC, for example: if you want your golden uzi to shoot exlplosive rounds like the explosive shoutgun, change the shotgun to EPISODIC_22 or up and give the uzi the type the exlposive shotgun had. Then the uzi "should" shoot explosive rounds just like the explosive shotgun, and the shotgun will shoot regularly.
NOTE
Doing this could cause crashes (I have not tested that so use at your own risk), also this info could be invalid as I have not directly tested it but other tests had led to this conclusion.

This defines the most important properties:

<data slot="RIFLE" firetype="INSTANT_HIT" damagetype="BULLET" group="RIFLE_ASSAULT" targetrange="65.0" weaponrange="70.0" clipsize="30" ammomax="600" timebetweenshots="133">

slot= defines what slot the gun belongs to. If you change it to HANDGUN you can use the weapon inside a car as if it were a handgun, however it depends on the weapon such as shotguns, they will not work.
NOTE
This will also shorten the amount of weapons you can have at one time because if the weapon is in the HANDGUN slot, it will replace your current handgun with the modified weapon.

firetype= defines what kind of bullets the weapon fires. If its a projectile it would say firetype="PROJECTILE" or if it does not instantly hit the target like sniper rifles its firetype="DELAYED_HIT".
NOTE
The huge DSR sniper rifle from TBoGT, you may want to leave it DELAYED_HIT so it can keep its explosive properties.

damagetype= defines what kind of damage the weapon deals. It can be EXLPOSIVE, BULLET, ...etc. With this, its best to keep it at BULLET, but if it uses rockets change it to damagetype="EXPLOSIVE".

group= not sure exactly what it does but its good to set it with its appropriate group, like if you change the gun to a rocket launching weapon, then change this to group="ROCKET".

targetrange= defines how far you can lock onto enemies and how far you need to go for your aim to break.

weaponrange= defines how far your bullets go.
NOTE
For shotguns that have spread, like the non-explosive ones, DO NOT put a huge range. It will cause your shotgun to freeze the game between shots, so keep it no more then 50000, and if it still freezes between shots then lower the value till it stops.

clipsize= defines how big each clip of your gun is.

ammomax= defines how much ammo you can carry. There is a limit of about 25000 shots.

timebetweenshots= defines how much time is between shots, but for this to work, the gun needs to have more than clipsize="1".

This is the secondary set of weapon properties:

<damage base="30" networkplayermod="2.5" networkpedmod="1.25"/> <physics force="75.0"/> <reload time="2066" fasttime="1166" crouchtime="2066"/>

damage base= defines how much damage the weapon does.
REMINDER: DO NOT modify if using in MP.

networkplayermod= not sure what it does, I wouldn't change it unless you want to experiment, if you figure it out, please let me know so I can add the info on the guide.

networkpedmod= not sure what it does, I wouldn't change it unless you want to experiment, if you figure it out, please let me know so I can add the info on the guide.

physics force= defines how much force your weapon has. If you shot a car with the force set to physics force="1000000" that car is going to go ♥♥♥♥♥♥♥ flying across planet earth!
REMINDER: DO NOT modify if using in MP.

reload time= defines how much time it takes to reload the gun. I think the reload time is limited to animation time so this serves no importance.

fasttime= not sure, but it must be how long it takes for your guy to pull the gun out and conceal the gun again, I don't see the point in editing it.

crouchtime= I haven't done much with it... I assume its how long it takes for your guy to crouch.
Flags
I wouldn't mess with this too much, speaking it usually screws the weapon up, but if used responsibly you can edit this just fine.

<flags> <flag>GUN</flag> <flag>CAN_AIM</flag> <flag>CAN_FREE_AIM</flag> <flag>ANIM_RELOAD</flag> <flag>ANIM_CROUCH_FIRE</flag> <flag>2HANDED</flag> </flags> </data>

You can add flags to the gun to do extra things, here is some information about the flags (some flags may only be for TBoGT I will mark my guesses):

<flag>THROWN</flag> only used for grenades, I wouldn't add this to the M4.

<flag>SILENCED</flag> not sure what this does but it could just be silent to NPCs.

<flag>ADD_SMOKE_ON_EXPLOSION</flag> this kind of explains it self, as do most, but I would only add this to explosives such as grenades.

TBoGT <flag>TREAT_AS_2HANDED_IN_COVER</flag> Your guy will hold the weapon with both hands only when in cover (If your gun has 2HANDED flag, this flag is useless)

<flag>DONT_RUMBLE_WHEN_DOING_DRIVE_BY</flag> Maybe this has something to do with controller rumble.

TBoGT <flag>MISSION_CAN_FORCE_DRIVEBY_USE</flag> Doesn't do anything if a mission doesn't force the weapon to use as drive by, its useless.

<flag>HIGHER_BREAK_FORCE</flag> I don't know what this does, it could mean anything.

TBoGT <flag>HEAVY_WEAPON_USES_RIFLE_ANIMS</flag> Yep you guessed it... I hope.

<flag>HEAVY</flag> I think this just makes the gun weigh a lot, so when you ragdoll you should break dance!

<flag>EXPLOSION_BASED_ON_IMPACT</flag> I don't know what this does really.

Honestly, I would modify the flags with caution.

I would display the last bit of code but I would never change it, you can though, at your own risk. I think it just has something to do with weapon model and weapon sound.
How To Add Rockets To Your Weapon
You have to do this in a special way, copying the entire rocket code and pasting over another weapon will not do it! Don't be silly.

There are two ways to do this. One way is for TBoGT, and the other is for GTA IV. TBoGT can use GTA IV's way too, if thats what you wish to do.

GTA IV's snippet
<projectile> <typetocreate type="ROCKET"/> <offset x="0.54" y="0.0" z="0.055"/> <rotoffset x="0.0" y="0.0" z="-1.571"/> </projectile>

TBoGT's snippet
<projectile type="ROCKET"> <explosion type="EPISODIC_5"/> <physics force="500" explodeimpactthreshold="0" explodeimpactwithvehiclethreshold="0"/> </projectile>

I like the TBoGT's version better, speaking it doesn't lag out your game with smoke particles. Its kind of strange though, the missiles have the same model as your gun, so it looks like you are firing explosive guns.... Anyways, you can also customize the rocket behavior without screwing with the Buzzard's rocket codes... speaking this code snippet comes from the Buzzard's rocket launchers.

I don't like GTA IV's rocket projectile snippet so much because it lags the game a lot, and if you wish to edit the rocket behavior, you have to edit the rockets themselfs, unlike TBoGT, where there is properties to be modified attached to the snippet.

To install the code snippet you must paste it right under flags leaving one space and making sure its up against the </data> mark, like this:

TBoGT
<flags> <flag>GUN</flag> <flag>CAN_AIM</flag> <flag>CAN_FREE_AIM</flag> <flag>ANIM_RELOAD</flag> <flag>ANIM_CROUCH_FIRE</flag> <flag>HIGHER_BREAK_FORCE</flag> </flags> <projectile type="ROCKET"> <explosion type="EPISODIC_5"/> <physics force="500" explodeimpactthreshold="0" explodeimpactwithvehiclethreshold="0"/> </projectile> </data>

projectile type= you need to keep it at ROCKET so that way your missle will fly like a rocket.

explosion type= this will change how the missile explodes, I like it the way it is because it is a pretty powerful explosion. Its the same explosion as the grenades of the grenade launcher, but if you don't like it then change it to another explosive, like the rocket for the RPG.

physics force= this on a normal gun would make things fly if you shot them; however, this is different, this makes the rocket go faster. I wouldn't make it too much faster than 500 because there comes a point where the rockets are so fast the get out of control and they bounce off of walls!

explodeimpactthreshold= you want this at 0 because any number bigger then that will work against you. This is how much its going to miss its target, the bigger the number the more its going to fly away from the target.

explodeimpactwithvehiclethreshold= exactly like explodeimpactthreshold= except its for cars.

GTA IV
<flags> <flag>GUN</flag> <flag>CAN_AIM</flag> <flag>CAN_FREE_AIM</flag> <flag>ANIM_RELOAD</flag> <flag>ANIM_CROUCH_FIRE</flag> </flags> <projectile> <typetocreate type="ROCKET"/> <offset x="0.54" y="0.0" z="0.055"/> <rotoffset x="0.0" y="0.0" z="-1.571"/> </projectile> </data>

I wouldn't mess with the rocket projectile properties since it doesn't really do anything desirable, it just changes the rocket's origin when fired and the type, which for the GTA IV style you want to keep as is. If you want to edit the rocket you have to go to the rocket code which should look like this:

<weapon type="ROCKET"> <data slot="THROWN" firetype="PROJECTILE" damagetype="EXPLOSIVE" group="ROCKET" targetrange="35.0" clipsize="1" stattype="RLAUNCHER"> <damage networkplayermod="2.0" networkpedmod="1.0"/> <aiming accuracy="1.0"> <offset x="0.0" y="1.0" z="0.0"/> <crouchedoffset x="0.0" y="1.0" z="0.0"/> <reticule standing="0.65" ducked="0.55" scale="0.3"/> </aiming> <pickup regentime="360000" ammoonstreet="8"/> <controller> <rumble duration="0" intensity="0.0"/> </controller> <flags> <flag>THROWN</flag> <flag>EXPLOSION_BASED_ON_IMPACT</flag> <flag>ADD_SMOKE_ON_EXPLOSION</flag> </flags> <projectile type="ROCKET"> <explosion type="ROCKET"/> <physics force="999" explodeimpactthreshold="0.01" explodeimpactwithvehiclethreshold="0.01"/> </projectile> </data> <assets model="cj_rpg_rocket"> <effects> <trail fx="weap_rocket_player"/> </effects> </assets> </weapon>

This is modified a little from the original .xml as its force is changed to 999... but this is its orginal code for the most part. Now this is just like the TBoGT's code snippet as far as modifying it goes, just look under </flags>.

stattype= can't say, last time I did anything with it, it did nothing to the gun.

After you put in the projectile code snippet you want to use, its time for the last part, and that is setting its firetype=, damagetype=, and its group=

firetype="PROJECTILE" damagetype="EXPLOSIVE" group="ROCKET"

And now you have officially created your very own rocket launching abomination.

Here is an example of my TBoGT rocket launching golden uzi:

<weapon type="EPISODIC_13"> <data slot="SMG" firetype="PROJECTILE" damagetype="EXPLOSIVE" group="ROCKET" targetrange="1000000" weaponrange="1000000" clipsize="1000000" ammomax="1000000" timebetweenshots="0"> <damage base="25" networkplayermod="2.0" networkpedmod="1.0"/> <physics force="50.0"/> <reload time="1" fasttime="1" crouchtime="2000"/> <aiming accuracy="0"> <offset x="0.15" y="1.0" z="0.55"/> <crouchedoffset x="0.2" y="1.0" z="0.1"/> <reticule standing="0.75" ducked="0.6" scale="0.3"/> </aiming> <pickup regentime="240000" ammoonstreet="2000000"/> <controller> <rumble duration="100" intensity="0.04"/> </controller> <flags> <flag>GUN</flag> <flag>CAN_AIM</flag> <flag>CAN_FREE_AIM</flag> <flag>ANIM_RELOAD</flag> <flag>ANIM_CROUCH_FIRE</flag> <flag>HIGHER_BREAK_FORCE</flag> </flags> <projectile type="ROCKET">
<explosion type="EPISODIC_5"/>
<physics force="500" explodeimpactthreshold="0" explodeimpactwithvehiclethreshold="0"/>
</projectile> </data> <assets model="w_e2_uzi"> <anim group="gun@GOLD_UZI" meleegroup1="firearm_core"/> <effects> <muzzle fx="muz_P90"/> <shell fx="weap_ejected_p90"/> </effects> </assets> </weapon>

A GTA IV's rocket launching weapon should look similar.
The End
Thanks for taking your time to read this guide, please like it if you did.

This information is not 100% accurate, so if you found out something I will test it and add it to the guide. Hopefully this will slowly build on this guide as time goes on, so please suggestions and corrections are very appreciated!

If you need help just ask away, I will try to answer questions, but sometimes I just don't have all the answers... or perhaps you over looked it.
How To Add Weapons Without Replacing Them (video)
Počet komentářů: 41
AlconburyBlues 22. kvě. v 19.45 
For targetrange/weaponrange, is this number feet? meters?

Also, timebetweenshots, I would assume is the fire rate in milliseconds. But changing this number doesn't seem to have any effect.
MercMan 9. led. v 10.07 
Thanks for making my night fun. Take some awards.
MercMan 8. led. v 22.38 
Tried this out. So PhysicsForce increases how much knockback a prop/object/npc/vehicle receives. I set it to 380 on the M4, and it causes some hilarious ragdolling in gunfights.
Hawk 13. pro. 2022 v 17.53 
how do i reduce bullet spread?
Lovelyduckgamer 5. zář. 2021 v 12.15 
great job, but can I ask you another question? is about how to ONLY reduce Ai aim and accuracy ? I really need it for making a cinematic video, i noticed that if i change the weapons accuracy in the weaponsinfo.xml than it applies to the AI too. Do you know how to do this? please I need it badly
stinky savid 8. čvc. 2019 v 0.33 
Thank you for the reply! I also have a solution for your shotgun problem. If you make the shotgun a delayed_hit weapon you won't get a freeze for some reason. This also is how you get the bullets to behave somewhat like projectiles. It's like a traveling hitscan.
Gumbo Slice  [autor] 7. čvc. 2019 v 14.19 
Not from what I can remember, since bullets were never designed to have any real physics to them.
stinky savid 2. čvc. 2019 v 9.43 
So is it possible to make guns shoot projectile bullets instead of instant or delayed hit? Just curious.
Gumbo Slice  [autor] 30. zář. 2018 v 13.22 
Only thing I can recal, is giving shotguns really long ranges made the game freeze between shots.

Perhaps the weapon fires too many projectiles at too long of a range.

Unless you mean the game out right crashes, then all I can tell you is to make sure you didn't screw up any brackets or comas, and check your spacing...
anchovy 氷 30. zář. 2018 v 11.00 
I seem to have broken something, but im not sure what it is, as soon as i fire, the game freezes, all ive changed are the mag sizes, RoF, and that kid of stuff. Dunno what to do here