FSP Tutorial Inventory System
by David Reagan · in General Discussion · 02/17/2008 (10:41 pm) · 2 replies
Is there a tutorial somewhere that explains in detail how to use the inventory system that is included in the first person shooter example? I can only find new ones that have to be added in. Basically, how to pick up new weapons. Like you have a bow, and you pick up and start using a sword.
Also, is there a good torquescript tutorial somewhere? Something that explains how to use the script, its syntax, and explains how the .cs files interact with each other.
Thanks!
-David
Also, is there a good torquescript tutorial somewhere? Something that explains how to use the script, its syntax, and explains how the .cs files interact with each other.
Thanks!
-David
About the author
#2
Step one is to create or purchase a weapon with all the proper mount points and stuff in place. (That would be another tutorial)
2> Next Create a weapon script specific for that weapon let's call this first one Shotgun.cs (just for this example) This would contain all the info for projectile, splashes, ect ect. If you are just starting out simply copy crossbow.cs rename it to Shotgun.cs then and modify the Shotgun.cs to suit your needs. ( Do not delete crossbow.cs)
3> Place the new Shotgun.cs file in starter.fps\server\scripts
3.5> in game.cs located in starter.fps/server/scripts/game.cs, under function onServerCreated() simply add:
exec("./Shotgun.cs");
4> Next step would be to modify the the player.cs file....under PlayerData(PlayerBody) add:
maxInv[Shotgun] = 1 ;
maxInv[ShotgunAmmo] = 30 ;
This will allow the player to have 1 shotgun and it will have a max of 30 rounds of ammo.
5> Next find the client bind script: usually under: starter.fps/client/scripts/default.bind.cs, at end add:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"Shotgun\");", "");
6> Since we changed the default bind we need to change the config.cs as well. So find
starter.fps/client/scripts/client/config.cs, at the end add:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"Shotgun\");", "");
So now when you add a pickup item to your map and its the shotgun your "2" key will be your shotgun and your "1" key will be the crossbow. Thats the basic concept behind changing weapons. As for the tutorial for TS....well that has been explained in many books and is way to complex to go into in a forum post. Hope that helps ya a little.
02/23/2008 (9:11 am)
Pretty Simple actually, for this example I will use the starter.fps example. It looks to me like your just wanting to be able to pick up and use another weapon so....Step one is to create or purchase a weapon with all the proper mount points and stuff in place. (That would be another tutorial)
2> Next Create a weapon script specific for that weapon let's call this first one Shotgun.cs (just for this example) This would contain all the info for projectile, splashes, ect ect. If you are just starting out simply copy crossbow.cs rename it to Shotgun.cs then and modify the Shotgun.cs to suit your needs. ( Do not delete crossbow.cs)
3> Place the new Shotgun.cs file in starter.fps\server\scripts
3.5> in game.cs located in starter.fps/server/scripts/game.cs, under function onServerCreated() simply add:
exec("./Shotgun.cs");
4> Next step would be to modify the the player.cs file....under PlayerData(PlayerBody) add:
maxInv[Shotgun] = 1 ;
maxInv[ShotgunAmmo] = 30 ;
This will allow the player to have 1 shotgun and it will have a max of 30 rounds of ammo.
5> Next find the client bind script: usually under: starter.fps/client/scripts/default.bind.cs, at end add:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"Shotgun\");", "");
6> Since we changed the default bind we need to change the config.cs as well. So find
starter.fps/client/scripts/client/config.cs, at the end add:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"Shotgun\");", "");
So now when you add a pickup item to your map and its the shotgun your "2" key will be your shotgun and your "1" key will be the crossbow. Thats the basic concept behind changing weapons. As for the tutorial for TS....well that has been explained in many books and is way to complex to go into in a forum post. Hope that helps ya a little.
Torque Owner Lee Latham
Default Studio Name
There are a few good starting TS tutorials on TDN, tdn.garagegames.com