How do i determaning if a shape is destroyed, with script?

I've been trying to figer this one out for a while.
I need flipflops to only flip if they have been destroyed.

staticShape.cs
datablock StaticShapeData(FlipFlop) : StaticShapeDamageProfile
{
   ...

};

function FlipFlop::onCollision(%data,%obj,%col)
{

   if (%col.getDataBlock().className $= Armor && %col.getState() !$= "Dead")
   {
      //I need to test whther or not the flipflop is destroyed
      //if(isDestroyed()) //this line dousen't work
	  %data.playerTouch(%obj, %col);
   }
}

thanks in advance.

Comments

  • edited June 2009
    Flipflops don't get destroyed, they're invincible. You'd have to change the invincible flag in the datablock, then, add a hook in FlipFlop::onDestroyed.
  • Make a newFlipFlop, and in newFlipFlop::onDestroyed() call the playerTouch() function
  • I need to determan if a flipflop is destroyed or not.
  • Change this line
    if (%col.getDataBlock().className $= Armor && %col.getState() !$= "Dead")
    
    to
    if(%col.getType() & $TypeMasks::PlayerObjectType && %col.getState() !$= "Dead" && %obj.getDamageState() $= "Destroyed")
    

    Why you'd want to check if an invulnerable object is destroyed however is beyond me.
  • iv aready worked out the invalnarbility.
    and tks for the code.
Sign In or Register to comment.