Weapons
by Adam · in Torque Game Engine · 09/14/2006 (3:09 pm) · 3 replies
I have figured out how to change the players initial weapon at the start and how to put different weapons into the game. The question I have is how do I change weapons when I have more than 1 in inventory. I see there is a commandToServer to use Crossbow when 1 is pressed, but I don't see it being implemented anywhere. Could someone point me in the right direction?
Thanks in advance
Adam
Thanks in advance
Adam
About the author
#2
I really appreciate you taking the time to help me out.
Adam
09/16/2006 (3:00 pm)
Wow, that was a lot easier than I thought, I didn't realize all I had to do was bind the commandToServer and that would switch the weapons. Thanks alot, now I can add a couple more guns to my game.I really appreciate you taking the time to help me out.
Adam
Torque Owner Fucifer
Add the following lines after crossbow, this will add the gun to our inventory:
Save and close game.cs.
Open player.cs in server/scripts and Search for "// Allowable" then add the following lines to the end:
Bind your weapons to the 'use' function inside of default.bind.cs locate in client\scripts.
Search for the following line:
moveMap.bindCmd(keyboard, "1", "commandToServer('use',\"Crossbow\");", "");Below this line add the following, this will keybind the weapon to 2:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"myGun\");", "");Delete default.bind.cs.dso in client\scripts.
Delete config.cs and config.cs.dso in client. Dont worry it will recompile when you launch Torque.
Press key for which weapon you want. If you need more details just let me know. Whatever weapon you add last to the Starting equipment in game.cs will be the weapon you start with. I hope this help.