Game Development Community

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

#1
08/30/2006 (11:12 am)
Explosion objects are not networked and thus when created in server scripts won't show up on clients. What I did is add a netEvent that I can call from script which tells the clients to play an Explosion effect. It might also be possible to do it soley from script using commandToClient and instantiating the Explosion in the client scripts.
#2
08/30/2006 (11:20 am)
Ok, Now I'm really lost, is there a sample somewhere ?