Game Development Community

I'm so frustrated I think I'm gonna pass out...

by Tasty Green Pees :-, · in Torque Game Engine · 02/22/2006 (9:54 am) · 16 replies

This has driven me up the wall in a bad way!

I'm new to this as is evident by me posting here. I can't figure out how to pick up a weapon using the invetory system. This is what I have till now:

* inventory.cs
* weapon.cs
* crossbow.cs
* item.cs

All these are called from the game.cs I then proceed to place a crossbow into the game world, run the game, try to run up to the crossbow, and nothing happens!?!

I'd appriciate help with this. I'm scared to try it again cos I just might scratch someone's eyes out if I fail again!

#1
02/22/2006 (10:01 am)
Do you already have a crossbow?... just a thought. You can only carry 1 if the maxinventory[crossbow]=1 (from memory)

Have you got the inventory specific values in your player datablock? If you've got the rest, it won't work without this.

I don't recall having a problem myself with the inventory system.

If I remember correctly, the start.fps has inventory support built in.. The Ork can pick up weapons (crossbow) and extra ammo.
#2
02/22/2006 (10:14 am)
Thanks for the prompt reply Jason. I'm working in the tutorial.base and have incoperated aspects of the starter.fps to it.

No when my plaer starts up in the game he is weaponless.

Can u please tell me what these inventory specific values in the player datablock are so I can check if I got all of mine.
#3
02/22/2006 (10:53 am)
Always start by cloning the already existing assets in the demo.
Make a second crossbow, rename it to something else and place it in engine.

If it shows up, but you cannot pick it up.. then you need to go into player.cs and find the lines which set how many items you can carry. There are fields there which say how many "crossbow" and "ammo" you can carry, so you would have to add your second crossbow there.

Edit: Grammar
#4
02/22/2006 (11:12 am)
I keep getting this error:

Error: shape tutorial.base/data/shapes/crossbow/ammo.dts-collision detail 0 (Collision-3) bounds box invalid!

tutorial.base/server/crossbow.cs (763): preload failed for Crossbow: ShapeBaseData: Couldn't load shape "tutorial.base/data/shapes/crossbow/s_gun.dts".

tutorial.base/server/crossbow.cs (763): preload failed for CrossbowImage: Unable to load shape: tutorial.base/data/shapes/crossbow/s_gun.dts.

...

Error: shape tutorial.base/data/shapes/crossbow/ammo.dts-collision detail 1 (Collision-3) bounds box invalid!

I'm clueless.
#5
02/22/2006 (11:57 am)
The collision is an onld error, you didnt make it.

As for the other, are you sure that you placed the crossbow from the SHAPES catagory in the creator, and not the STATICSHAPES area?

But, it seems, it cant find that .dts, check your path.

Also, the invatory system in the FPS may not work in the Tutorial.Bace, as one is set up for multi player, and the other is not.
#6
02/22/2006 (12:49 pm)
"Also, the invatory system in the FPS may not work in the Tutorial.Bace, as one is set up for multi player, and the other is not."

That's interesting, Allyn... does anyone know this for sure cos it would give me finality on the issue.

By the way can anyone explain what the weapon.cs is for. I don't see where any of its function are ever called.
#7
02/22/2006 (12:56 pm)
Open up weapon.cs and read the comments, that should help you out.
#8
02/22/2006 (1:38 pm)
As i understand, there are some comandtoserver calls that updates the "i have this" of the invatory system.

I am not expert thoe, i do know, that the FPS invatory system is a clicent/server set up with the server knowing who has what and how many.

Don't quote me.
#9
02/22/2006 (2:11 pm)
I believe to be an inventorable "Item", that item should contain the hooks into the Inventory system via the Item object....just a guess.
#10
02/22/2006 (2:40 pm)
I'm stuck...
#11
02/22/2006 (7:07 pm)
Honestly, many of the problems you have been asking about on the forums consist of "how do I move this from starter.fps to tutorial.base" (it's base by the way!)...I highly suggest you simply work from starter.fps instead during your "getting to know Torque" phase.

There is quite a bit of code involved in the whole "picking up and using a crossbow as a weapon" portion of starter.fps that was removed from tutorial.base (because people kept asking us to), and porting it all back in is quite a bit of work.
#12
02/23/2006 (2:00 am)
By working of the bare tutorial.base, rather than starter.fps is that I hope by having to rebuild anything I wish to add to the game from scratch I would get a better understanding of Torque script.

Usually I find that I'm missing a function that enables something to work or didn't call through the right way before I actually get anything going, this has helped me cover quite a range of things.

I'm not an advanced programmer, if there is a better way to understand Torque script I'd appriciate some insight. As I see it, if I'm working straight off starter.fps I'd just be changing variables. Then again I'm new to this so...
#13
02/23/2006 (7:10 am)
If it's working for you and you are learning from it, then don't change--but we are seeing a ton of questions, so I just wanted to make sure!
#14
02/23/2006 (12:54 pm)
I didn't rea the entire thread so Im sorry if Im repeat someone.
Here is the way I once add a weapon to the game
use this resource
(take a look at the comments to see some resources for switching between the weapons and the media).
and take a look at this and this to fix some errors.

At the end I managed to add a weapon + change between the two weapons, it can take
a while but in the end it's worth it. You also need to read and understand the shoutgun.cs file so you could
create some weapons of your own.

BTW I tried this on Torque 1.3 with the FPS Starter Kit.
#15
02/23/2006 (1:32 pm)
@Stephen Zepp

I first started using Tutorial.Bace to learn on, now i have moved onto Starter.FPS. Its a great way to learn.

Thats how i knew that The bace wasn't set up for the Inventory system ;).

Works for some, not all, like you said. =)
#16
02/23/2006 (4:16 pm)
You might want to check out the CodeSampler tutorials, as they show you how to gradually add features to the tutorial.base code.

They do not appear to have been updated for TGE 1.4 yet though, so minor changes may need to be made.