Items in an inventory
by Daniel Buckmaster · in Torque Game Engine · 01/19/2007 (9:19 am) · 2 replies
I've been trying to figure out how the standard scripted inventory system in TGE works. I don't understand all of it, but what I do unerstand, I don't like. So I just want to make sure I'm getting things straight.
-The current inventory works by storing, within the player's datablock, how many of each different item he's picked up.
-When items are picked up, they are hidden and then scheduled to reappear. The taker's inventory array is increased by a specified amount.
-When items are used, the inventory is simply decreased by the given amount and their effects applied.
-When items are thrown, a new item is created to throw.
Weapons are the part I'm not sure about. What with item and image datablocks, I don't really know what does what.
But even going by what I know about the way items are handles, it's not the way I want them to be done in my game. It'd be perfectly suited to something like UT, with a handful of weapons and ammo that stays in fixed locations and respawns. But I'm looking for somewhere around thirty of forty weapons, so that alone makes the standard system unuseable.
-The current inventory works by storing, within the player's datablock, how many of each different item he's picked up.
-When items are picked up, they are hidden and then scheduled to reappear. The taker's inventory array is increased by a specified amount.
-When items are used, the inventory is simply decreased by the given amount and their effects applied.
-When items are thrown, a new item is created to throw.
Weapons are the part I'm not sure about. What with item and image datablocks, I don't really know what does what.
But even going by what I know about the way items are handles, it's not the way I want them to be done in my game. It'd be perfectly suited to something like UT, with a handful of weapons and ammo that stays in fixed locations and respawns. But I'm looking for somewhere around thirty of forty weapons, so that alone makes the standard system unuseable.
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
EDIT: Also, would it take a huge amount of effort to remove the Image functionality? Call me a wuss, but in an engine I've worked with previously, it was much simpler just to have one model for the weapon, and then control what it did. For example, on picking it up, the player adds it to a list of weapons that it controls. Depending on the player's state, it may tell each weapon object to become invisible, attach to a bone, fire, etc.
01/19/2007 (1:16 pm)
I get the basic differences between the two types - but how are they handled by the inventory? Are weapon images unique objects, or just created when needed?EDIT: Also, would it take a huge amount of effort to remove the Image functionality? Call me a wuss, but in an engine I've worked with previously, it was much simpler just to have one model for the weapon, and then control what it did. For example, on picking it up, the player adds it to a list of weapons that it controls. Depending on the player's state, it may tell each weapon object to become invisible, attach to a bone, fire, etc.
Employee Michael Perry
ZombieShortbus
However, to clarify the difference between a weapon item and a weapon image, let's put it this way:
Weapon Item - Represents weapon item in world that entities collide with, pick up, and see on the ground.
Weapon Image - Represents the visual of the weapon as seen from 1st person perspective.
If the standard inventory script system doesn't suit your needs, I know of quite a few resources out there that beef it up, or use a completely new system. You've got the source, and you are obviously progressing well with learning Torque Script. So, hack it up and make it your own =).