Game Development Community

dev|Pro Game Development Curriculum

Improved Weapon Shell Casing for T3D

by Christopher Tauscher · 06/07/2011 (11:31 am) · 8 comments

The Soldiers rifle only ejects one shell while holding down the left mouse button instead of a constant stream of shells. Below I've attached the changes to fix this so it will eject multiple shells.

In game/art/datablocks/weapons/Soldier_gun.cs change:

// Fire the weapon. Calls the fire script which does
   // the actual work.
   stateName[3]                     = "Fire";
   stateTransitionOnTimeout[3]      = "Reload";
   stateTimeoutValue[3]             = 0.09; // Chris - was 0.2
   stateFire[3]                     = true;
   stateRecoil[3]                   = "";
   stateAllowImageChange[3]         = false;
   stateSequence[3]                 = "Fire";
   stateSequenceRandomFlash[3]      = true;        // use muzzle flash sequence
   stateScript[3]                   = "onFire";
   stateSound[3]                    = GunFireSound;
   stateEmitter[3]                  = GunFireSmokeEmitter;
   stateEmitterTime[3]              = 0.025;

   // Play the reload animation, and transition into
   stateName[4]                     = "Reload";
   stateTransitionOnNoAmmo[4]       = "NoAmmo";
   stateTransitionOnTimeout[4]      = "Ready";
   stateWaitForTimeout[4]           = "0";
   stateTimeoutValue[4]             = 0.1; // Chris - was 0.0
   stateAllowImageChange[4]         = false;
   stateSequence[4]                 = "Reload";
   stateEjectShell[4]               = true;

About the author

http://www.christauscher.com

Recent Blogs

• Dig In - Why we love Spoon

#1
06/07/2011 (2:15 pm)
Thanks
#2
06/07/2011 (4:15 pm)
cool thanks, looks alot better now its spewing out shells :)
#3
06/08/2011 (2:18 am)
a resource?
personaly I would have thought this would be a bugfix.
#4
06/08/2011 (6:49 am)
looks better yet! ty
#5
06/08/2011 (7:03 am)
deepscratch - it isn't really a bug, someone was just lazy with the datablock settings.
#6
06/08/2011 (9:17 am)
@deepscratch: Unfortunately other "bugs" took higher priority. I've logged this already as an improvement bug but I wanted to post my improved datablock settings on this for you guys to enjoy.
#7
06/08/2011 (11:00 am)
Thanks!
#8
06/18/2011 (3:51 pm)
Hi Chris,

I heard from David that you are currently or will be testing Making Indie Games' Torque Script Interactive Tutorial 2 (TSIT2). I couldn't find an email address through which to contact you so I'm hoping this will do. Just wanted to let you know that if you have any questions you can email me at kevinoflaherty@makingindiegames.com. My team is looking forward to making this resource a part of the Torque community.

Thank you for taking the time to test our software. We look forward to hearing from you.

- Kevin O'Flaherty