I get bad syntax every time Checked it 1000 times, it is supposed to give every Block a number.. I need this because I want to make blocks disappear in random order, every 3 seconds a block disappears.
with this on init()
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/55);
COLUMNS = roundUp(L/30);
HEIGHT = roundUp(H/20);
XA = CX/ROWS;
YA = CY/COLUMNS;
ZA = CZ/HEIGHT;
self.center = spawn("script_model", corner1);
for(r = 0; r <= ROWS; r++)
{
for(c = 0; c <= COLUMNS; c++)
{
for(h = 0; h <= HEIGHT; h++)
{
if(!isDefined(level.blocks)
{
level.blocks.size = 0;
}
b = level.blocks.size;
wait .01;
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] LinkTo(self.center);
level.blocks[b].health = level.boxhealth;
level.blocks[b] setCanDamage(true);
level.blocks[b] thread destroyBlock();
wait .01;
level.blocks++;
wait .03;
}
}
}
self.center.angles = angle;
}
destroyBlock()
{
for(;;)
{
if(self.health < 0)
{
playfx(level.destroyblockfx, self.origin);
self delete();
}
wait 0.05;
}
}
roundUp( floatVal )
{
if ( int( floatVal ) != floatVal )
return int( floatVal+1 );
else
return int( floatVal );
}
with this on init()
Code:
level.blocks = [];
level.boxhealth = 200;
level.traphealth = 300;
level.crateModelFriendly = "mp_supplydrop_ally";
level.crateModelEnemy = "mp_supplydrop_axis";
level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped";
level.destroyblockfx = loadfx("explosions/fx_exp_equipment");
(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