Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED]Whats wrong with this? :(
#1
I get bad syntax every time Sad 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.

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

Reply

#2
PHP Code
  1. if(!isDefined(level.blocks)


you forgot a ")"

fixed one:
PHP Code
  1. if(!isDefined(level.blocks))
Reply

#3
(03-15-2011, 17:41)surtek Wrote:
PHP Code
  1. if(!isDefined(level.blocks)


you forgot a ")"

fixed one:
PHP Code
  1. if(!isDefined(level.blocks))

Thanx, but I still get bad syntax Sad
(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

#4
Quote: level.crateModelFriendly = "mp_supplydrop_ally";
level.crateModelEnemy = "mp_supplydrop_axis";
level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped";

Already this is useless ^^
Reply

#5
(03-15-2011, 19:29)Romuald27 Wrote:
Quote: level.crateModelFriendly = "mp_supplydrop_ally";
level.crateModelEnemy = "mp_supplydrop_axis";
level.crateModelBoobyTrapped = "mp_supplydrop_boobytrapped";

Already this is useless ^^

If i dont use it, i dont see the models ...
(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

#6
Remade and fixed, i just made the chance to get a trap 5% and if it reaches the trap limit it'll always create a normal crate

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;
    center = spawn("script_model", corner1, 0);
    for(r = 0; r <= ROWS; r++)
    {
        for(c = 0; c <= COLUMNS; c++)
        {
            for(h = 0; h <= HEIGHT; h++)
            {
                self.trap = randomInt(100);
                if(self.trap <=5 && level.traps < level.maxtraps)
                {
                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);
                    block setModel(level.crateModelBoobyTrapped);
                    block.angles = (0, 0, 0);
                    block SetOwner( level );
                    block LinkTo(center);
                    block.health = level.traphealth;
                    block thread destroyBoobytrap();
                    level.traps++;
                    wait 0.01;
                }
                else
                {
                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)), 1);
                    block setModel(level.crateModelFriendly);
                    block.angles = (0, 0, 0);
                    block SetOwner( level );
                    block LinkTo(center);
                    block.health = level.boxhealth;
                    block thread destroyBlock();
                    wait 0.01;
                }
            }
        }
    }
    center.angles = angle;
}
(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



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help [C#] WebClient how to know real url [solved] narkos 21 12,965 09-09-2013, 15:21
Last Post: surtek
Information Help How to edit new derived entry? (Solved) SSonic70 1 2,736 08-20-2013, 15:29
Last Post: Nekochan
  Help What's Wrong 2 Dominator56 5 3,813 02-19-2013, 21:46
Last Post: Dominator56
  Help What's wrong ? Dominator56 4 3,080 02-17-2013, 12:12
Last Post: Dominator56
  I know I've posted this in a wrong place Ra3shed 2 2,360 02-16-2013, 21:15
Last Post: Arteq
  whats the command to get string length pedjas 4 3,096 01-20-2013, 18:30
Last Post: pedjas
  Help [solved]red hitmark mod? founderlj 7 4,718 12-30-2012, 23:06
Last Post: Pozzuh
  !weapon Plugin help pls [solved] Hallla 0 1,971 12-30-2012, 14:04
Last Post: Hallla
  Help !giveammo Plugin doesnt work [solved] Hallla 3 3,549 12-29-2012, 20:53
Last Post: Hallla
  Help OnPlayerConnect [Solved] 99IRock 4 4,127 11-18-2012, 10:07
Last Post: 99IRock

Forum Jump:


Users browsing this thread:
2 Guest(s)

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