PDA

View Full Version : Adding New Weapons to GTA IV



ivanh
02-21-2011, 08:58 AM
Adding New Weapons to GTA IV





Hello gta policemods,

i am going to explain how to add a weapon to gta iv

The tutorial is made by Nima_1i over at gtaforums. (http://www.gtaforums...howtopic=442961 (http://www.gtaforums.com/index.php?showtopic=442961))

In this Tutorial I want to add a weapon that replaces M4 originally (Like I said I'm not replacing). The files are named "w_test.wdr & w_test.wft".



Needed tools:



1. OpenIV



2. Notepad



Files to edit:

Default.dat gta.dat images.txt

Files YOU are going to create:

newdef.ide epweaponinfo.xml newwep.img

Creating Phase



Add before "HTML http" line. Add this in the default.dat:




WEAPONINFO common:/data/epweaponinfo.xml



This is how it should turn out:




#

# Object types

#

IDE common:/data/default.ide

IDE common:/data/vehicles.ide

IDE common:/data/peds.ide



ANIMGRP common:/data/animgrp.dat

HANDLING common:/data/handling.dat

VEHICLEEXTRAS common:/data/VehicleExtras.dat

PLAYER platform:/models/cdimages/playerped.rpf

PEDGRP common:/data/pedgrp.dat

CARGRP common:/data/cargrp.dat

RADIO common:/data/radiohud.dat

RADIOLOGOS independent:/textures/radio_hud.itd

WEAPONINFO common:/data/weaponinfo.xml

THROWNWEAPONINFO common:/data/thrownweaponinfo.xml

PEDPERSONALITY common:/data/pedpersonality.dat

MELEEANIMS common:/data/meleeanims.dat

ACTIONTABLE common:/data/action_table.csv

EXPLOSIONFX common:/data/effects/explosionFx.dat

VEHOFF common:/data/vehOff.csv

FMENUFILE common:/data/frontend_menus.xml

LBDATAFILE common:/data/leaderboards_data.xml

LBICONSFILE independent:/textures/Leaderboards.itd

WEAPONINFO common:/data/epweaponinfo.xml <-------

HTML http:



Part 2



In the end of gta.dat add:




IDE common:/data/newdef.ide



How it should look now:




#

# Load IDEs first, then the models and after that the IPLs

#



#IMG ASSETS.IMG

IMGLIST common:/data/images.txt



#

# Water

#

WATER common:/DATA/WATER.DAT common:/DATA/WATERLOW.DAT





.

.

.

.

.

.

.

#

# Lod Cullers

#

IPL platform:/DATA/MAPS/GENERIC/lodcull_j.IPL

IPL platform:/DATA/MAPS/GENERIC/lodcull_m.IPL

IPL platform:/DATA/MAPS/GENERIC/lodcull_e.IPL

IDE common:/data/newdef.ide



Part 3



Add this line to images.txt:




platformimg:/models/cdimages/newwep 1



This how it should look:




# NOTE: The names and paths in this file are CASESENSITIVE on PS3 so don't f*ck 'em up.



#this has been ordered to reflect the order on the disk



commonimg:/data/cdimages/navgen_script

commonimg:/data/cdimages/script_network 1

platformimg:/anim/cutsprops 1

platformimg:/anim/cuts 1

platformimg:/data/maps/interiors/Int_Props/props_ss 1

platformimg:/data/maps/interiors/Int_Props/props_ab 1

platformimg:/data/maps/interiors/Int_Props/props_km 1

platformimg:/data/maps/interiors/Int_Props/props_mp 1

platformimg:/data/maps/interiors/Int_Props/props_ld 1

platformimg:/data/maps/interiors/Int_Props/props_ah 1

platformimg:/data/maps/interiors/Mission/level_2 1

platformimg:/data/maps/interiors/Mission/level_5 1

.

.

.

.

.

.

.

.

platformimg:/data/maps/east/bronx_e 0

platformimg:/data/maps/east/bronx_e2 0

platformimg:/data/maps/east/bronx_w 0

platformimg:/data/maps/east/bronx_w2 0

platformimg:/models/cdimages/newwep 1 <-----------





#map xref



#map instance



Part 4



Edit newdef.ide



type this in:




weap

################################################## #############################



w_test, w_test, gun@ak47, 1, 50, 0 <----------



end





################################################## #############################

amat

################################################## #############################



w_test, 0, CM_WEAPONS_M4 <---------------



end



Note that you must copy the lines from the weapon that, according to what your mod author said, your weapon is replaced with, in default.ide



Part 5



Edit epweaponsinfo.xml



If the weapon says its a replacement for the M4 copy the M4 lines. If the author of the weapon has their own weaponsinfo.xml find it.



This is how it should look now




<weaponinfo version="1"> <----------------------



<weapon type="EPISODIC_1"> <---------

<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_test"> <------------

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



</weaponinfo>



Note that as I highlighted above you should add "<weaponinfo version="1">" at first, " </weaponinfo>" at the end, "EPISODIC_#" (#=1,2,3,...,24) as weapon type & "w_test" (the model file name) as assets model.



Part 6



Use OpenIV to make a new img file called newwep.img. Add the files w_test.wft & w_test.wtd



Add the files here:



Common\data



default.dat, gta.dat and images.txt, newdef.ide and epweaponinfo.xml.



pc\models\cdimages



newwep.img



To use your weapon you need a trainer!!



Bugs:

The gun has no sound!!



Other credits:

Mataanjin

r.schuindt

sjaak (for the trainer)