Game Development Community

Adding a new weapon

by ben calder · in Torque Game Engine Advanced · 09/10/2008 (6:19 pm) · 1 replies

I am trying to add the rocket launcher (called swarmgun for some reason) from the t3d game example, that comes with TGEA 1.7.1, to the game example that comes with afx core. I had no problem getting the crosbow to work as everything is already set up you just need to add it to the create player function in client/game.cs.

But with the rocket launcher, I can get it to appear on the character (i.e he holds it) but I cant get it to shoot, I have the fire function in my default.bind, the same one that worked with the crossbow, but I carnt get the rocket launcher to fire. I am pretty certain its not the fire function, I think I probably missed something out, here is what I did:

(i) copy the swarmgun files from the t3d (game a) data/shapes/weapons and add it to the afx game data folder (game b)

(ii) I then copyed and pasted the swarmgun.cs file from server/scripts folder from a and added it to b.

(iii) I then went through the script to make sure all the file paths were correct for the game b file structure.

(iii)The in game.cs I include/execute the swarmgun.cs file and then in create player I added:
// Starting equipment
       %player.setInventory(RocketLauncher,1);
       %player.setInventory(RocketLauncherAmmo,50);
       %player.mountImage(RocketLauncherImage,0);

These steps have managed to make it so that the swarmgun is mounted, but it wont fire. Am I missing something or did I just go wrong somewhere.

Thanks

#1
09/11/2008 (12:04 pm)
I managed to work it out, I had to add it to the inventory in sefver/scripts/player.cs It works fine now.