So I want the block to fall down if it doesnt have any health left.. its not moving after its death but it does get destroyed after 5 sec
Code:
CreateGrids(corner1, corner2, angle)
{
W = Distance((corner1[0], 0, 0), (corner2[0], 0, 0));
L = Distance((0, corner1[1], 0), (0, corner2[1], 0));
H = Distance((0, 0, corner1[2]), (0, 0, corner2[2]));
CX = corner2[0] - corner1[0];
CY = corner2[1] - corner1[1];
CZ = corner2[2] - corner1[2];
ROWS = roundUp(W/35);
COLUMNS = roundUp(L/70);
HEIGHT = roundUp(H/35);
XA = CX/ROWS;
YA = CY/COLUMNS;
ZA = CZ/HEIGHT;
b = 0;
center = spawn("script_model", corner1, 0);
for(r = 0; r <= ROWS; r++)
{
for(c = 0; c <= COLUMNS; c++)
{
for(h = 0; h <= HEIGHT; h++)
{
if(!isDefined(level.blocks))
{
level.blocks = [];
}
level.blocks[b] = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);
level.blocks[b] setModel(level.crateModelFriendly);
level.blocks[b].angles = (0, 0, 0);
level.blocks[b] SetOwner( level );
level.blocks[b] LinkTo(center);
level.blocks[b].health = 100;
level.blocks[b] SetCanDamage(true);
level.blocks[b] thread destroyBlock( b );
b++;
wait 0.01;
}
}
}
center.angles = angle;
}
destroyBlock( b )
{
for(;;)
{
block = level.blocks[b];
block waittill("death");
block moveTo((block.origin[0], block.origin[1], block.origin[2]-600), 4);
wait 5;
block delete();
}
}
(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking
[Release] Old School Mod v2.2
[Release] Scroll menu