All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [TUTORIAL]Creating custom weapons for TC:E
PostPosted: Mon Nov 09, 2009 2:20 am 
Offline
Expert
Expert

Joined: Mon Jul 06, 2009 11:22 pm
Posts: 157
Can I please get a sticky?

////////////////////////TC:E CUSTOM WEAPON TUTORIAL BY RANG3R1//////////////////////////////////////

So, you want to make a new, kickass weapon for TC:E, but you dont know how, well you are lucky, I had to teach myself, and you will learn from my mistakes.

Please pay attention to all that I put down, or you may miss an important step or tidbit. NOTE, THIS IS A LONG TUT, I ADVISE YOU TO COPY AND CREATE LOCAL TEXT FILE FOR REFERENCE

First, this is what you will need to create weapons in TC:E:
A modeling program, and the skills to use it. (in this tut, I will refer to steps using 3ds Max and Gmax, ask kilroy for Milkshape 3D help.)
A photo editor (for creating texture maps for your model)
Notepad, or equivalent
7-zip, or similar compress/decompression programs to pack/unpack .pk3 files
And sound editing software, such as Audacity, if you will make custom sounds



Now, before we begin, I will explain .gear, .weap, and .spec files.

.gear files can be found in the maps folder
.weap and .spec in the custom/default/weapons folder

.weap files describe to the engine things like what sounds to use, the weapon itself, what models to use, and the like. here is an example of the ak47.weap file:
Code:
---------------------------------------------
weaponDef
{
   // This basically fills out weaponInfo_t
   client {
      //standModel         "models/weapons2/luger/luger_stand.mdc"   // weapon pickup 'stand' (do we still use this?)
      //pickupModel      ""
      //pickupSound      "sound/misc/w_pkup.wav"
      
      weaponConfig      "models/weapons2/ak47/weapon.cfg"
      //handsModel         "models/weapons2/luger/v_luger_hand.mdc"
      
      flashDlightColor   1.0 0.6 0.23
      flashSound      "sound/weapons/ak47/ak47f1.wav"   // supports up to 4 flash sounds
      flashEchoSound      "sound/weapons/ak47/ak47_far.wav"      // supports up to 4 flash echo sounds
      //lastShotSound      ""                              // supports up to 4 last shot sounds
      
      //readySound      ""
      //firingSound      ""                           // no weapons seem to use this, basically it's a replacement hum for readysound, but then when firing
      //overheatSound      ""
      reloadSound         "sound/weapons/ak47/ak47reload.wav"
      reloadFastSound      "sound/weapons/luger/luger_reload_fast.wav"      // some weapons have fast reloads due to the skill system
      //spinupSound      ""                           // sound started when fire button goes down, and stepped on when the first fire event happens
      //spindownSound      ""                           // sound called if the above is running but player doesn't follow through and fire
      switchSound         "sound/weapons/misc/silence_off.wav"   // allow overriding of weaponswitch sound
      
      //weaponIcon         "icons/iconw_luger_1"
      weaponSelectedIcon   "icons/iconw_luger_1_select"
      
      //missileModel      ""
      //missileSound      ""
      //missileTrailFunc   ""                           // supports "GrenadeTrail", "RocketTrail", "PyroSmokeTrail" and "DynamiteTrail" (we REALLY want a particle system for this)
      //missileDlight      0
      //missileDlightColor   0 0 0                     // do we still use this?
      
      
      ejectBrassFunc      "MachineGunEjectBrass"            // supports "MachineGunEjectBrass" and "PanzerFaustEjectBrass"
      
      // ELITE
      gunViewOffset      -2 6 0.5         // forward, up, left
      gunViewAimOffset   -10 -7.6 -2         // forward, up, left
      gunViewAngles      0.2 0 0            // PITCH YAW ROLL
      foreShorten      0.5            // sof2 like forward axis shorten factor to compensate for fisheye effect (hl2 has separate viewangle for view weapon rendering)
      tagsInMain      1            // tag_brass and tag_flash in weaponLink Part 0 (usually main)
      
      deployMenuShortName   "AK-47"
      deployMenuDescription   "Izhmash Ak-47 7.62x39mm"
      deployMenuType      "Assault Rifle"
      
      //modModel       1
      
      firstPerson {
         model         "models/weapons2/ak47/ak47_view.mdc"
         flashModel      "models/weapons2/ak47/ak47_view_flash.mdc"
         axisskin      "models/weapons2/mp5/sleeve_hold2.skin"
         alliedskin      "models/weapons2/mp5/sleeve_hold.skin"

         // weapon building
         // the parts are numbered because there are some hardcoded references for some weapons to certain parts
         weaponLink
         {
            part 0
            {
               tag      "tag_main"
               model   "models/weapons2/ak47/ak47_view_main.mdc"
            }
            part 1
            {
               tag      "tag_clip"
               model   "models/weapons2/ak47/ak47_view_clip.mdc"
            }
            part 2
            {
               tag      "tag_slide"
               model   "models/weapons2/ak47/ak47_view_slide.mdc"
               axisskin      "models/weapons2/ak47/ak47_view_slide.skin"
               alliedskin      "models/weapons2/ak47/ak47_view_slide.skin"
            }
            
            
         }
      }
      
      thirdPerson {
         model         "models/weapons2/ak47/ak47.mdc"
         flashmodel      "models/weapons2/ak47/ak47_flash.mdc"
      }
   }
}
----------------------------------------------------------------------


As you can see, it is a lot of things to comprehend, so I will explain most of what you need to know.

weaponConfig <tells engine what animation config file to use for this weapon>
flashsound <tells what sound to use when firing>
flashechosound <tells what faraway sound to use>
reloadsound <what reload sound to use>
gunViewOffset
gunViewAimOffset <these three are the 3d coordinate plane values for the hud weapon placement> <viewaim is for aimed sights, view is for non-aimed>
gunViewAngles
deployMenuShortName <the short and dirty name of your gun>
deployMenuDescription <the menu description of your gun, should be short, and contain caliber>
deployMenuType <is it a pistol, submachine gun, sniper rifle, palsma cannon, etc?? can be whatever you want>
firstperson{
model <this is the hand view model and animation your weapon will use>

Now the next part will need a little more in depth description than the rest, and this is important, so pay attention, from Weaponlink on down, you will see some tag names and models

tag_main has to do with mostly the "bulk" of the rifle, such as scopes, receivers, suppressors, basicaly everything except slides and mags.
tag_clip has to do with your weapon's mag model
tag_slide has to do with your weapons slide, or "charging handle"

thirdPerson{
model <your thirdperson weapon model, should be smaller, and contain all objects>

more on how to use .weap files towards the end of the tut.

now on to .spec files
Spec files basically fill out more information, such as caliber, fire modes, and scope distance, and weither it is suppressed or not.
Here is the AK47.spec file

Code:
// TC:E weaponSpecs
// copyright GrooveSix Studios
weaponDef
{
   // class
   weapClass      "MBR"   // P, AP, MP, SMG, CAR, MBR, SG, SR <sr-sniper-p-pistol-ap-akimbopistol-mp-machinepistol-smg-smallmachinegun-car-carbine-
mbr-mainbattlerifle-sg-shotgun>
   caliberClass      "762x39"  // 9x19, 40SW, 45ACP, 50AE, 556x45, 545x39, 762x39, 762x51, 792x57, 338LAPUA, 50BMG, 70, 73, 76
   
   // modes of operation (multiple modes possible)
   semiauto      1   // semi auto
   fullauto      1   // full auto
   burst         0   // fires x burst
   pump         0   // pump/actiom
   bolt         0   // bolt operation
   
   // misc
   singleReload      0   // reloads single shots (like tubular mag pump guns)
   scoped         0.0   // x times scope
   scopeReticleType   0   // 0 = cross type, 1 = springfield armory type, 2 = russian PSO type   
   useScopeReticleShader   0   // use shader specified in .weap
   nightVision            0   //
   longWaveIR             0   //
   suppressed      0   // no environmental snd effect                                       <if you have a suppressor, set this to one>
   subsonic      0   // subsonic ammunition (different flyby effect)
   jamPercentage      0.0   // probability to jam over 100
   noTacMode      0   //     
   grenadeTimer      4000   // msec (m67 should be 4000, m83 6000, m84 2000)   
   
   // special
   usesWolfAnim      0   // weap uses wolf akimbo anim
   usesPistolAnimMod   0   // weap is slightly lowered during reload/no recoil in tac
   usesRecoilAnimMod   0   // semi-auto recoil for sniper rifles/shotguns
}

It is actually pretty self explanitory, just set values to one or zero, just like binary, yes or no.

This one is also required to make a custom weapons

Now on to .gear files

this on I will go over a little less, since one example is good enough
when you open it up, you will see a long list of weapons and some variables, and I will explain them, but if you look at the .gear files, you will notice the name, default_gt#.gear, and obj_mapname_gt#.gear the mapname ones are for specific maps, but to simplify things, the default work as well. remember to have 3 in each custom pak file gt2,gt5,gt7.

Here is the ak47 example from the default.gear file

gm_weapon
{
weaponID "TH4" <slot id, there are 27, 1-20, then knives and the like>
weaponFile "ak47" <name of your weap and spec files>
team "terrorists" <which team gets this weapon, specops, terrorists, or both>
slot "primary" <weapon slot, primary, ie rifle, secondary, ie pistol>
requiredSkill 1 0 0 <required AA to be able to get this weapon, 100 is 1, for assualt, 010 is 1 for recon, 001, is 1 for sniper, and so on, usually 1-3>
startClips 3 <number of mags your weapon starts with, keep around 3>
equivalentWeaponID "TH2" <what weapon this one balances out, ie in this case the specops m16>
}


Now that you know your .gear files, you can use your weapon in TC:E.

Now lets go over the process to actually set up your model to use in TC:E.

First, lets look at your nice model, it has a seperate, mag, slide and suppressor, and has an amazing skin-lets say it is and ak47, just for kicks
First thing, look over the default hand view animations in game, and choose the best one for your gun, in this case, the ak47_view
Then, find the ak47.weap and .spec files in the uncompressed pak2.pk3 file, rename them to yourgun.weap and .spec (or whatever, such as your weapon is)
Create a new folder on your desktop (for ease of finding), and name it new_ak or whatever you want, then in that folder create folders named models, custom, maps, scripts (for .shader files, but you will have to look at the quake 3 shader tut to learn about them, even I dont know too much about them, sorry...)
In your models folder create a folder called weapons2, and in that folder create a folder called whatever your weapon is called, this is the folder you will export all your models to, and where your texture and .skin files for your weapon will be located.

In the custom folder, create a folder called default, and in that one create one named weapons, in this folder you will throw your new weap and spec files in.
And in the maps folder, you will put your .gear files.

Alright, lets get to the models themselves,
Now, to get the best results, import the weapon that uses the same view animation as yours, and line up the grips and triggers, then delete the imported model, but save the tags tag_flash and tag_brass, they are important.

do this for your mag, supressor, and slide, then have all of the objects in one model, import the weapon that corresponds, and scale it down to fit.

Now, make sure that you have put all of your textures for your gun in its file in the model/weapons2 folder, then make sure that you apply them to your model, then export the following:

yourgun_view_main (this is the main weapon, firstperson view, mostly receiver, sights, suppressor if you want, (can be seperate file) but NO clip or slide!!) DONT FORGET TAGS!!
yourgun_view_slide (this is the slide model for your gun)
yourgun_view_clip (this is the mag for your weapon)
yourgun (this is the thirdperson view, scaled down, has all objects, ie, slide, mag etc.)

export them as .md3 models, in your models/weapons2/yourgun/ folder

now that you have your models done, lets edit the .weap/spec and .gear files so you can use your weapon.

weap first:

lets say your model is really close to the ak, lets say a galil, so copy the ak spec and weapon files and rename them to yourgun.spec/.weap
open the weap, and change the following

the menu names of your weapon
the models, under the specific tag place and part # (note you can make more parts that use the same tags if you need to)
also you may need to change the flash, sounds, and view angles to fit your weapon, depending on level of customization.

Once you have that filled out, move on to the .spec file
change the caliber if needed
add scope zoom and recticle type if nessessary.
add auto, pump, semi, burst firemodes to fit your weapon.
also remember to change the weapclass to fit your gun.

now do the .gear files, change the name to the name of your weapon's .weap and .spec files, also change AA levels as needed, where the weapon yours replaces) ie, galil replacing ak47

Now that you have all of that done, you can compress your custom pak file (remember to compress the folders INSIDE of the folder on your desktop, ie, models, custom,maps, NOT the file they are in!!)

name it zz_yourgun.pk3, and throw it in your tcetest folder, start tce, press the "~" key in the start menu, type in \sv_pure 0, then \devmap obj_mapname, then once you have spawned, press "~" again, and type in \timelimit 99999999, \give all, and then you will have all the weapons, and until you exit the map to look at your model, also type in cg_thirdperson 1 to check thirdperson view.

That's all there is to it, and if you have any questions, ask, but search first.

~Rang3r1~


Last edited by Rang3r1_v2 on Mon Nov 09, 2009 10:13 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 09, 2009 9:19 am 
Offline
Rock Me, Amadeus!
Rock Me, Amadeus!

Joined: Thu Jun 11, 2009 10:38 am
Posts: 172
Location: Austria
same as on the other thread, maybe use some code tags ? :wink:

_________________
"Fog is neither water nor air, it's something between." Merlin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Style created by © Matti, gry komputerowe, reklama sem reklama seo

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group