Child datablocks don't inherit anything?
by Maddermadcat · in Torque Game Engine · 02/05/2008 (1:52 pm) · 3 replies
Alright, so I have this item datablock:
Then I have several children of that item:
Problem is, these items seem to think that they're their own separate datablock. This doesn't happen with any other items. For example, my default ammo datablock:
And a child datablock:
With this item, the child (ProximityMineAmmo) inherits all fields that I don't define from its parent, DefaultAmmo. So why won't the keycards do the same?
datablock ItemData(DefaultKeycard)
{
category = "Keys";
className = "Key";
shapeFile = "~/data/shapes/items/keycard.dts";
computeCRC = false;
emap = true;
renderWhenDestroyed = true;
mass = 1;
drag = 0.5;
density = 2;
elasticity = 0.2;
friction = 0.6;
sticky = false;
gravityMod = 1;
maxVelocity = 100;
dynamicType = $TypeMasks::ItemObjectType;
hasLight = false;
pickupSound = WeaponPickupSound;
throwSound = WeaponThrowSound;
nameTag = 'Keycard';
keyName = "Nameless Key";
};Then I have several children of that item:
datablock ItemData(EntranceKey : DefaultKeycard)
{
keyName = "Entrance Key";
};
datablock ItemData(TowerKey : DefaultKeycard)
{
keyName = "Tower Key";
};
datablock ItemData(CrateKey : DefaultKeycard)
{
keyName = "Crate Key";
};Problem is, these items seem to think that they're their own separate datablock. This doesn't happen with any other items. For example, my default ammo datablock:
datablock ItemData(DefaultAmmo)
{
category = "Ammo";
className = "Ammo";
shapeFile = "~/data/shapes/objects/discprojectile.dts";
computeCRC = false;
emap = true;
renderWhenDestroyed = true;
mass = 1;
drag = 0.5;
density = 2;
elasticity = 0.2;
friction = 0.6;
sticky = false;
gravityMod = 1;
maxVelocity = 100;
dynamicType = $TypeMasks::ItemObjectType;
hasLight = true;
lightType = PulsingLight; // NoLight, ConstantLight, PulsingLight
lightRadius = 1;
lightColor = "0.8 0.8 0.8 1";
lightOnlyStatic = false;
pickUpName = 'Ammo';
pickupSound = WeaponPickupSound;
throwSound = WeaponThrowSound;
nameTag = 'Ammo';
};And a child datablock:
datablock ItemData(ProximityMineAmmo : DefaultAmmo)
{
shapeFile = "~/data/shapes/objects/discprojectile2.dts";
pickUpName = 'Proximity Mine';
nameTag = 'Prox Mine';
};With this item, the child (ProximityMineAmmo) inherits all fields that I don't define from its parent, DefaultAmmo. So why won't the keycards do the same?
About the author
#2
The keycards are in a separate file, which is executed in my server.cs after the script containing the parent keycards. The idea is that each level has its own separate file containing the datablocks for keycards and other objects unique to that mission.
02/24/2008 (8:57 am)
Well, you see, the child keycards have a tendency to be ridiculously "slippery" -- dropping them on the terrain causes them to slide away at incredible speeds. If I include no shapeFile field, the keycards are invisible. All the scripts associated with the parent keycard don't work for the children.The keycards are in a separate file, which is executed in my server.cs after the script containing the parent keycards. The idea is that each level has its own separate file containing the datablocks for keycards and other objects unique to that mission.
#3
I admit it's a shot in the dark, but TS most definitely has some weirdnesses to it like that.
02/24/2008 (1:55 pm)
Try sticking them in the same file, in the order I specified.I admit it's a shot in the dark, but TS most definitely has some weirdnesses to it like that.
Torque Owner Lee Latham
Default Studio Name
Am I wrong?
My second guess would be to ask how do you know they aren't working?