Game Development Community

Spawning explosions.

by Thomas -elfprince13- Dickerson · in Game Design and Creative Issues · 06/08/2009 (11:19 pm) · 2 replies

I'm trying to use the following code to spawn explosions inside a function.

echo("bang");
	%expdata = %this.explosion;
	echo(%expdata);
	%pos = %obj.getPosition();
	echo(%pos);
	%exp = new Explosion()
		{
			datablock = %expdata;
			initialPosition = %pos;
		};
		echo(%exp);
		MissionCleanup.add(%exp);
		//radius damage perhaps?
		%obj.delete();

I get all the lovely output in the console, and no explosion. Attempting to create an explosion by hand in the console leads to an error that the object does not exist, when I try and add it to MissionCleanup.

About the author

C.S. PhD student at Brown University. Project lead for FreeBuild. Administrator, Cemetech tech community. Webmaster for the Village2Village Projects and the Vermont Sustainable Heating Initiative.


#1
06/09/2009 (1:11 am)
I remember having the same problem, don't remember how I fixed it but try this and see if anything happens.

%exp = new Explosion()
       {
          datablock = %expdata;
          client = ClientGroup.getObject(0);
          initialPosition = %pos;
       };
#2
06/09/2009 (1:15 am)
kinda coming back to me why it didn't work, look here for more info.