Datablock Scripting ?
by Areal Person · in Torque Game Engine · 08/30/2006 (9:47 am) · 2 replies
Hi,
I'm trying to create an Explosion datablock object and cause an explosion at a specific location in script,
but when I execute the following code it sayes "myexplosion is not a member of GameBasedData"
//----------------------------------------------------------------------
%explosion = new Explosion() {
datablock = "myexplosion";
position = %this.getPosition();
};
//----------------------------------------------------------------------
I've defined the datablock and emitters like this
datablock ExplosionData(myexplosion)
{
soundProfile = MyExplosionSound;
lifeTimeMS = 1200;
// Volume particles
particleEmitter = MyExplosionFireEmitter;
particleDensity = 75;
particleRadius = 2;
etc...
etc...
};
I know how to do the syntax (I think), but I may be having trouble getting the scripting structure
correct ? I just copied the datablocks and emitters from fps.starter and just changed
the names.
Can someone help me ? I'm just trying to create the simple explosion object with the datablock
that is called on a schedule. I've looked at the fps.starter example, but I can't find what I'm doing wrong. (This is the first time I have tryed to do this as I'm new to Torque)
I may be leaving out some other function calls that are needed ? I don't know :(
What are the steps ?
Thanks,
Areal Person
I'm trying to create an Explosion datablock object and cause an explosion at a specific location in script,
but when I execute the following code it sayes "myexplosion is not a member of GameBasedData"
//----------------------------------------------------------------------
%explosion = new Explosion() {
datablock = "myexplosion";
position = %this.getPosition();
};
//----------------------------------------------------------------------
I've defined the datablock and emitters like this
datablock ExplosionData(myexplosion)
{
soundProfile = MyExplosionSound;
lifeTimeMS = 1200;
// Volume particles
particleEmitter = MyExplosionFireEmitter;
particleDensity = 75;
particleRadius = 2;
etc...
etc...
};
I know how to do the syntax (I think), but I may be having trouble getting the scripting structure
correct ? I just copied the datablocks and emitters from fps.starter and just changed
the names.
Can someone help me ? I'm just trying to create the simple explosion object with the datablock
that is called on a schedule. I've looked at the fps.starter example, but I can't find what I'm doing wrong. (This is the first time I have tryed to do this as I'm new to Torque)
I may be leaving out some other function calls that are needed ? I don't know :(
What are the steps ?
Thanks,
Areal Person
Torque Owner Paul /*Wedge*/ DElia