Adding more wepaons to to the game
by Bapi Roy · in General Discussion · 06/26/2008 (9:36 pm) · 3 replies
Hi,
I m new to Torque Game Engine and trying to make a simple FPS game.
I have a problem in adding weapon to the player. I want to add M16 along with crossbow. I can also be able to change form one weapon to other and return back to same. How can i do this by scripting.
pls. help.
I m new to Torque Game Engine and trying to make a simple FPS game.
I have a problem in adding weapon to the player. I want to add M16 along with crossbow. I can also be able to change form one weapon to other and return back to same. How can i do this by scripting.
pls. help.
#2
It solved my problem. I have add new wepaons to my game very easily.
One more thing, while going thru the turorial "Weapon Cycling in Torque", I have came thru a file called "optionsDLG.cs ". My question is what does this file do?
Hope u i will get the answer ! :)
Thank again.
06/27/2008 (7:09 am)
Thank u "M (silentMike) H".It solved my problem. I have add new wepaons to my game very easily.
One more thing, while going thru the turorial "Weapon Cycling in Torque", I have came thru a file called "optionsDLG.cs ". My question is what does this file do?
Hope u i will get the answer ! :)
Thank again.
#3
06/27/2008 (9:13 am)
OptionsDLG.cs contains the functions that control the behaviour of the in-game options screen. What you added to it as part of the weapon cycling resource allows you to remap the keys that you use for next and prev weapon while ingame. Instead of changing the default key-bind in script that little bit of code allows you to just go to Options -> Controls -> find the bind for previous weapon & next weapon and change them to whatever you want.
Associate Michael Hall
Distracted...
1) put your weapons shapes, textures and sounds into the appropriate data folder.
2) put your weapon script into the server/scripts directory and exec the script from game.cs. Double check that your weapon script also points to the correct data folders for the shapes, particles, sounds, etc.
3) You will also have to edit your player.cs file. Locate the playerbody datablock declaration and towards the end of it you will find "Allowable Inventory Items". You need to add the weapon and ammo there. '1' means the player can pick the weapon up and use it, and "xx" for the amount of ammo the player can carry.
Weapon Cycling in Torque
In case you want to add a hud to indicate weapon usage and an ammo counter:
How to add a Weapon HUD