Game Development Community

Problem with Destruction Datablock

by Darin Pitts · in Torque Game Engine · 08/19/2008 (8:56 am) · 1 replies

Hey guys I'm having problems getting my datablock to work right. every time i run it i keep getting a syntax error on line 6.......i've tried all the tricks i can think of. but sadly this is one feild i find myself lacking in experiance and training. do any of you have any ideas that could help fix the problem?

here is my codeing

// this is a Data Block for the FBarrel01 to take damage and explode

datablock StaticShapeData( Fbarrel01Data ) {
shapeFile = "./starter.fps/data/shapes/barrels/FBarrel01.dts"

new StaticShape( FBarrel01 ) {
dataBlock = "Fbarrel01Data";
position = "1 10 1";
rotation = "1 0 0 0";
scale = "1 1 1";
}
};

//life of the barrel
datablock StaticShapeData( Fbarrel01Data ) {

maxdamage = 10;
disabledLevel = 9; // Disabled level
destroyedLevel = 10; // Destroyed at Max Damage
repairRate = 0; // no repair rate/unable to repair
};

// Destroyes our Barrel
function ShapeBase::determineDamageState( %theShape ) {
%curDamage = %theShape.getDamageLevel();
%disabledDamage = %theShape.getDatablock().disabledLevel;
%destroyedDamage = %theShape.getDatablock().destroyedLevel;

if( %curDamage >= %destroyedDamage ) {
%theShape.setDamageState( Destroyed );
}
else if( %curDamage >= %disabledDamage ) {
%theShape.setDamageState( Disabled );
}
else {
%theShape.setDamgeState( Enabled );
}
};

//Tells whether the barrel stayes or goes upon destruction
datablock StaticShapeData( ExplodeGears ) {
explosion = "GearsExplosion";
underwaterExplosion = "GearsUnderwaterExplosion";
renderWhenDestroyed = false;
};

#1
08/19/2008 (10:41 am)
You are missing a semicolon on the inner close curly brace for FBarrel01. By the way, using {code} your code {/code} makes code more readable, except replace with straight braces.