Game Development Community

Inventory and weapon problems

by Tom Bampton · in Torque Game Engine · 05/26/2003 (4:20 pm) · 1 replies

Hiya,

I have been messing around with Torque for the last week or so. It rules ;-) But, inevitably considering the amount of stuff to it, I hit a snag, heh. I *think* I have a fairly good understanding of how a lot of it fits together. I'm using current HEAD.

I decided to implement a marginally different inventory system. It's based on the concept of slots, each slot can hold a certain type of weapon (e.g. knife, sidearm, primary, secondary, grenade, etc etc). It also uses ammo clips rather then one lump of ammo (I know theres a clip tutorial somewhere, but I havent read that so I have no idea how similar "my way" is, but that's pretty much irrelevant for now). This thing is loosely based on Tim Newell's Inventory Manager tutorial. The code is pretty different, but it all fits together in a similar way (e.g. seperate inventory class, methods added to the Player console object for accessing the inventory). The script code is very similar, but with obvious semantic changes to work with my inventory methods and the differences for clips. At the moment clips arent fully done; it will work "almost" as before in that it wont reload once a clip is empty.

Since adding this (and tracing through a lot of code to figure out how it all fits together and works) a few problems came up that I wont bore you with, but the main one is that when picking up a weapon and a clip the animations dont trigger and you can't fire. I figure this is a problem with triggers somewhere, but I cant figure out how the callbacks get called and where they get called from, which makes tracing back along the execution path quite annoying since I have no way of debugging scripts (but as I wrote that sentence I remembered the debugger, stupid me). I have checked through as many scripts and C++ code as I can see and I am fairly sure I have modified all the inventory calls. However, since the CrossbowImage::onFire() function doesnt handle out of ammo situations, I know I have missed something somewhere, but I can't for the life of me figure out where it is. It is late and maybe I am just getting codeblind.

Any ideas on where to look would be much appreciated. Sorry for the rambling post, like I said it's late and I'm too dead to form coherent thoughts.

#1
05/27/2003 (5:13 am)
Never mind, I fixed it. The weapon and ammo werent being mounted properly.