Game Development Community

World Editor and Item datablocks

by Ron Barbosa · in Torque Game Engine · 03/12/2006 (1:49 pm) · 6 replies

Hey all. I've posted a similar version of this question in another thread, but I still haven't been able to find the answer. I've got a bomb item that I want the player to be able to pick up. The datablock is below:

datablock ItemData(Bomb)
{
category = "Items";
className = "Ammo";
pickUpName = "Bomb";
maxInventory = 10;
shapeFile = "~/data/shapes/landmine/landmine.dts";
mass = 1;
friction = 1;
elasticity = 0;
value = 1;
respawnTime = 30 * 60000;
salvageTime = 15 * 60000;
};

When I use the world editor, I see the bomb in the creator tree, but when I click it...no bomb shows up. It doesn't instantiate. I get no errors in the console window either. I can instantiate the item using the "new" statement in my mission scripts, but I can't create on in the world editor.

Can anyone help me figure out what I'm missing to be able to create these items and hide them in the game world for players to find without having to manually write them into my mission code?

Thanks
Ron

#1
03/12/2006 (3:28 pm)
Have you checked the size of the model? it may have exported at the wrong scale.
#2
03/12/2006 (5:56 pm)
I don't think it has anything to do with the scale. As you see in the datablock, the .dts file is called landmine.dts. The game currently has landmines in it (using the same .dts) that I process as static shapes and they explode when onCollision is called with the player.

The bomb item I'm working on is a weapon that the player can set (so it's a bomb while it's in your inventory and once it's been set, it becomes a landmine...sort of).

At any rate, I can place landmines anywhere using the world editor. Is it possible that the two entities are in conflict because they share the same .dts file?

Thanks for any help.
--Ron
#3
03/12/2006 (6:22 pm)
Are you certain it doesn't instantiate? No object appears in the object tree in the upper right of the world editor?
#4
03/12/2006 (7:11 pm)
I am absolutely certain that it doesn't instantiate.

I will say this, though. If I import the .dts file and the datablock into the starter.fps game, I can instantiate the object. So it appears to be something specific to that game project.

Basically...I followed the tutorial. Then I decided to add some features. I modelled land mines to hurt the player. I used the same technique as the tutorial uses for picking the Torque logos. I created the land mines as static shapes and they explode when onCollision is called.

To recover from the land mines, I created health kits. Again, I used the same technique.

After that, I wanted to create an item...something that doesn't stop the user from passing through it. Something that could be collected and used later. So I tried to create the simplest ItemData datablock and create an instance of it in the world editor. No love. I've been working on this ever since.

Very odd.
#5
03/12/2006 (7:29 pm)
I had a similar problem once, it turns out I was not executing the file in main.cs. I had created a new file for my object and was simply not calling it.

Eric Prem
#6
03/12/2006 (7:30 pm)
Follow up to my previous message. As it turns out. The tutorial project does not include an item.cs file. This file defines the item::create method that tells the editor what to do when the item is created. No create method...no new items.

I copied the item.cs from the starter.fps project and it worked fine.

I guess in an effort to simplify the tutorial, some major pieces have been removed that might be required for future expansion beyond what's in the tutorial.

At any rate...it's a lesson learned on my part and debugging it has helped me learn more about Torque Script. So I think it's pretty good all around

Thanks to all who responded...I got some good leads from the forums.

--Ron