Game Development Community

Weapon implementation

by Dave D · in Torque Game Engine · 12/30/2004 (11:04 am) · 4 replies

Using several free resources and several original models. I have come up with quite a collection of weapons for "Mygame". The probelm is I am not sure how to implement them into the game. I have experimented around withe the crossbow.cs file and tried to use it as a reference. The crossbow, obviously, will not remain in the game, however it needs to stay till I get these issues sorted out. My questions are:

1. Aside from the model, what is needed to put te weapon into the game.

2. How to switch weapons?

I do not want to be babied thru this, as I need to learn, but any helpful tutorials or sample code would be helpful.

#1
12/30/2004 (11:43 am)
Besides the models, you need a few different additions/changes to script files. First, you need a script to "run" your weapon. An example of this is the crossbow.cs file. After you have that, you need to execute that script in game.cs (or whatever file you are using to execute your weapon scripts... game.cs is the default so unless youve made major changes, thats where it should go). After that, you will be able to place your weapon in the game.

To be able to pick it up in game, you need to change make a change to player.cs to define the weapon as something that can be added to your inventory.

To be able to select it after youve picked it up, you need to go to your keybind files and add the keybind in. There are a few of these and im not sure which one torque looks to at which time, so maybe someone else can fill that void.

Hope that helps. :)
#2
12/30/2004 (11:56 am)
Thanks for the quick reply, I am getting started on it right now
#3
12/30/2004 (12:42 pm)
Thanks again, I got it figured out.
#4
12/30/2004 (5:06 pm)
Good to hear. :)