How do I go about doing this? datablock issue
by Michael Cozzolino · in Torque Game Engine · 02/02/2006 (12:48 pm) · 5 replies
ProjectileData::ProjectileData()
{
projectileShapeName = NULL;
sound = NULL;
soundId = 0;
explosion = NULL;
explosionId = 0;
waterExplosion = NULL;
waterExplosionId = 0;
splash = NULL;
splashId = 0;
hasLight = false;
lightRadius = 1;
lightColor.set(1, 1, 1);
hasWaterLight = false;
waterLightColor.set(1, 1, 1);
faceViewer = false;
scale.set( 1.0, 1.0, 1.0 );
isBallistic = false;
noBounceObjTypes = 0;
// Explode on Water Impact - T_F
explodeOnWater = false;
// Explode on explodetime expiration - T_F
explodeOnExplodeTime = false;
velInheritFactor = 1.0;
muzzleVelocity = 50;
armingDelay = 0;
fadeDelay = 20000 / 32;
lifetime = 20000 / 32; // ***Gets overridden by Datablock if its a valid value***
explodetime = 1000/32; //***[b]Does NOT[/b] get overridden by datablock with known good value***
activateSeq = -1;
maintainSeq = -1;
gravityMod = 1.0;
bounceElasticity = 0.999;
bounceFriction = 0.3;
particleEmitter = NULL;
particleEmitterId = 0;
particleWaterEmitter = NULL;
particleWaterEmitterId = 0;
decalCount = 0;
for (U32 i = 0; i < NumDecals; i++)
{
decals[i] = NULL;
decalId[i] = 0;
}
}Check the commented code.
How do I go about getting the datablock to override the values set in Source?
ie. set explodetime something different in datablock than Source and have it work.
About the author
Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489
#2
02/02/2006 (2:26 pm)
Did that. Sorry I forgot to mention that.addNamedFieldV(explodetime, TypeS32, ProjectileData, new IRangeValidatorScaled(TickMs, 0, Projectile::MaxLivingTicks)); addNamedField(explodeOnExplodeTime, TypeBool, ProjectileData);
#3
02/02/2006 (2:28 pm)
I need to go off to work now. This is one of those things that will keep me from getting anything else done until I figure it out. Thats just who I am ;)
#4
I'm guessing i'm missing something small. I have exhausted my thoughts of what it could be as well as searching the site.
02/03/2006 (5:45 am)
Anyone have any idea why ProjectileData::initPersistFields() would not be exposing the variables to the script engine? ie. The datablock value overrides the default engine values as long as the value is valid.I'm guessing i'm missing something small. I have exhausted my thoughts of what it could be as well as searching the site.
#5
02/03/2006 (6:15 am)
Ok I feel like a complete moron. My script was never compiling it was compiling the one I had in a different directory than the one I was working with. On the bright side it friggen works now! Yay!
Torque Owner Paul /*Wedge*/ DElia
void ProjectileData::initPersistFields() { Parent::initPersistFields(); addNamedField(particleEmitter, TypeParticleEmitterDataPtr, ProjectileData); addNamedField(particleWaterEmitter, TypeParticleEmitterDataPtr, ProjectileData); //etc...For how you should set it up. Look over the different declaration functions to see what you should use for what variables.
Then you can set the variables in script and they will override the engine values.