Game Development Community

Create an Explosion

by Wolfgang Kurz · in Torque Game Engine · 05/02/2007 (6:24 am) · 1 replies

Hello everyone,

I am trying to implement explosions into my Demo where i spawn Explosions without using Projectiles.
What i do is this:

The player clicks on a spot on the map and then depending on the distance from the player en explosion occures there after some time.

here is my code to spawn the explosion:

function blowup(%pos)
{
  %p = new explosion() {
  dataBlock = "CrossbowExplosion";
  position = %pos;
};
MissionCleanup.add(%p);
}

The Explosion datablock is the one from the starter.fps

I tried this code on the server and on the client but all i get is this:

game.cs (411): Register object failed for object (null) of class Explosion.

is there anything i am doing wrong?

#1
05/02/2007 (7:20 am)
function blowup(%pos)
{
   %explosion = new (Explosion)()
   {
      dataBlock = "CrossbowExplosion";
      position = %pos;
   };

   MissionCleanup.add(%explosion);
}
By the way, spawning an explosion like that won't work across the network. You'd have to dig into the source code for that (I think there are a few resources that cover this, do a search).