Blockland Forums > Modification Help
Explosion: Continuous shockwave
(1/4) > >>
takato14:
Im trying to create an explosion that lingers for a long period of time, dealing out a constant shockwave even after the initial blast. I am planning on doing this by spawning empty projectiles with invisible explosions similar to the initial blast for a short time period after the initial blast. I'm having some trouble making it work.


--- Code: ---function DoomNukeRocketProjectile::onExplode(%this,%obj)
{
parent::onExplode(%this, %obj);

DoomNukeRocketProjectile.Schedule(400, "launchWave",%waves);

}

function DoomNukeRocketProjectile::LaunchWave(%this,%obj)
{
      %projectile = NukeWaveProjectile;
   %position = %obj.getPosition();

   %waves = 1;

   for(%numbar=0; %numbar<%waves; %numbar++)
   {
      %vector = %position;

      if(!%times == 8)
      {
           %x = (getRandom(-7,7) - 0.5) * 3.141592653;
       %y = (getRandom(-7,7) - 0.5) * 3.141592653;
       %z = (getRandom(-7,7) - 0.5) * 3.141592653;
       %velocity = %x SPC %y SPC %z;

       %p = new projectile()
       {
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %position;
sourceObject = %obj;
sourceSlot = %obj.client.player.lastFragslot;
client = %obj.client;
       };
$times = $times + 1;

DoomNukeRocketProjectile.Schedule(400, "launchWave",%p);
      }    
      else
{
$times = 0;
}    

      MissionCleanup.add(%p);
    
   }
  
}



--- End code ---
By adding 1 to $times every time the function is called, it keeps track of how many shockwave explosions have been launched. Setting the schedule delay to a constant multiplied by the maximum number of shockwaves allowed before it stops, the blast can be set to linger for the exact lifetime of the visible explosion. When $times exceeds the maximum # of waves, it resets to 0 for the next projectile. I need some help getting it to work.
phflack:
so, what isn't working?
takato14:
Hm, its not spawning any projectiles, so no explosions occur. $times doesnt increase from the explosion. I didnt see any problems either, but I'm not a genius at scripting, so I made this topic to get help. Apparently, things dont work that way. xC
takato14:
Cmon people 15 views and no ideas?
phflack:
%vector = %position;
it doesn't look like you're using %vector in there
$times = $times + 1;
that would be a global varaible i think, and $times++; would work too
if(!%times == 8)
wouldn't that be if(%times != 8), but there is no %times as it's $times i think, and why not use >= or something?
function DoomNukeRocketProjectile::LaunchWave(%this,%obj)
DoomNukeRocketProjectile.Sche dule(400, "launchWave",%p);
it looks like you're giving it 3 things, while it's only taking 2
Navigation
Message Index
Next page

Go to full version