Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MoveTo thingy :(
#1
So I want the block to fall down if it doesnt have any health left.. its not moving after its death Sad but it does get destroyed after 5 sec Sad

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();
    }
}

Big Grin
(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

Reply

#2
Quote:destroyBlock( b )
{
for(;Wink
{
block = level.blocks[b];
block waittill("death");
if( (self.block.health <= 0)
{
block moveTo((block.origin[0], block.origin[1], block.origin[2]-600), 4);
}
wait 5;
block delete();
}
}
Reply

#3
(03-26-2011, 20:45)Romuald27 Wrote:
Quote:destroyBlock( b )
{
for(;Wink
{
block = level.blocks[b];
block waittill("death");
if( (self.block.health <= 0)
{
block moveTo((block.origin[0], block.origin[1], block.origin[2]-600), 4);
}
wait 5;
block delete();
}
}

Code:
block waittill("death");
is the same as
Code:
if(block.health <= 0)

just some advise to you, self is (in most cases) an entity, block is the entity so you have to replace self with block Wink
(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

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.