Items invisible
by Toks · in RTS Starter Kit · 12/27/2006 (3:21 am) · 2 replies
Hi all, ive got the following problem with my RTSStarterkit:
im trying to get some items in my world using ItemData datablocks like this:
datablock ItemData(Potion1)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "Health";
// Basic Item properties
shapeFile = "~/data/shapes/items/potion/potion.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
// Dynamic properties defined by the scripts
pickUpName = "a health potion";
repairAmount = 50;
};
and this:
function ItemData::create(%data)
{
// The mission editor invokes this method when it wants to create
// an object of the given datablock type. For the mission editor
// we always create "static" re-spawnable rotating objects.
%obj = new Item() {
dataBlock = %data;
static = true;
rotate = true;
};
return %obj;
}
both were kind of copied from garagegames (sorry about that) so they should be working, at least thats what I thought. The file with the datablock in it is executed from game.cs where the other datablocks are loaded too.
Everything looks fine so far, right? Well, when I fire up my game and I spawn this test object (either through the mission editor or through a test-function) it does not show. When I go to the mission editor inspector function, I can find my object, and it indeed does have the right datablock, rotation, position and all the things you'd expect, and when I have an echo through the console like this: echo(%obj.getDatablock().shapeFile); it does return the right value however I cannot see it, and I also don't see why not.
Thanks for reading (and maybe some help)
P.S. The file DOES exist and when I try the same with the standard crossbow or crossbowammo they have the same problem.
im trying to get some items in my world using ItemData datablocks like this:
datablock ItemData(Potion1)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "Health";
// Basic Item properties
shapeFile = "~/data/shapes/items/potion/potion.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
// Dynamic properties defined by the scripts
pickUpName = "a health potion";
repairAmount = 50;
};
and this:
function ItemData::create(%data)
{
// The mission editor invokes this method when it wants to create
// an object of the given datablock type. For the mission editor
// we always create "static" re-spawnable rotating objects.
%obj = new Item() {
dataBlock = %data;
static = true;
rotate = true;
};
return %obj;
}
both were kind of copied from garagegames (sorry about that) so they should be working, at least thats what I thought. The file with the datablock in it is executed from game.cs where the other datablocks are loaded too.
Everything looks fine so far, right? Well, when I fire up my game and I spawn this test object (either through the mission editor or through a test-function) it does not show. When I go to the mission editor inspector function, I can find my object, and it indeed does have the right datablock, rotation, position and all the things you'd expect, and when I have an echo through the console like this: echo(%obj.getDatablock().shapeFile); it does return the right value however I cannot see it, and I also don't see why not.
Thanks for reading (and maybe some help)
P.S. The file DOES exist and when I try the same with the standard crossbow or crossbowammo they have the same problem.
#2
Thanks for the help here Anthony! I have the same problem. Can you describe how we make this change? More specifically, how do I make the object scope to all clients?
I tried your link and the link from that forum is broken.
----------------------------------------------------------------------------------------------------
Update:
I got it working. I invoke the setScopeAlways() function in the onAdd for the object. Thanks for the help Anthony. The community is great!
04/02/2007 (5:17 am)
@Anthony,Thanks for the help here Anthony! I have the same problem. Can you describe how we make this change? More specifically, how do I make the object scope to all clients?
I tried your link and the link from that forum is broken.
----------------------------------------------------------------------------------------------------
Update:
I got it working. I invoke the setScopeAlways() function in the onAdd for the object. Thanks for the help Anthony. The community is great!
Associate Anthony Rosenbaum
1) when you make an object scope it too all the clients
or
2) change the netmask in the constructor to scope always.
Just to note, the more things on the network the more infomation has to be sent to everyone and in turn more lag.
I belive i have an example for 1) is [url =www.garagegames.com/mg/forums/result.thread.php?qt=23443] here[/url]