Thread: Bunkers Help.

Results 1 to 8 of 8
  1. #1
    Legend Of Hacking's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Isreal
    Posts
    57
    Reputation
    10
    Thanks
    4
    My Mood
    Fine

    Bunkers Help.

    I download Easy Coordinates FINAL Mod
    I open the files of the mod there are was :
    _rank.gsc
    _maps_objects.gsc
    ......................................
    I open _maps_objects.gsc
    and find in it this code:
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    init()
    {
    	level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    	level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
    	precacheModel( level.elevator_model["enter"] );
    	precacheModel( level.elevator_model["exit"] );
    	wait 1.05;
    	switch(GetDvar("mapname")) {
    		case "mp_favela":
    			favela_objects();
    			break;
    
    		
    
    	}
    }
    
    
    
    favela_objects()
    {
    
    CreateWalls((-1351, 919, 184), (-1450, 919, 274));
    CreateDoors((-1400, 919, 184), (-1500, 919, 184), (90,90, 0), 2, 2, 15, 75);
    CreateWalls((2445, 3065, 280), (2583, 2863, 310));
    CreateWalls((2445, 3065, 340), (2583, 2863, 370));
    CreateWalls((2130, 2613, 280), (2081, 2712, 310));
    CreateWalls((2130, 2613, 340), (2081, 2712, 370));
    CreateElevator((880, 2254, 282), (1177, 2402 ,281), (0, 0, 0));
    CreateDoors((-1474, 1399, 210), (-1374, 1399, 210), (90,90, 0), 2, 2, 15, 75);
    CreateDoors((2081, 2712, 280), (2028, 2790, 280), (90,90, 55), 3, 2, 15, 75);
    }
    
    
    /************************************************************************************
    *  Building functions, credits to Killingdyl for making this
    *************************************************************************************/
    
    CreateBlocks(pos, angle)
    {
            block = spawn("script_model", pos );
            block setModel("com_plasticcase_friendly");
            block.angles = angle;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	level.doorwait = 0.7;
            offset = (((size / 2) - 0.5) * -1); 
            center = spawn("script_model", open ); 
            for(j = 0; j < size; j++){ 
                    door = spawn("script_model", open + (((0, 30, 0) * offset))*1.5); 
                    door setModel("com_plasticcase_enemy"); 
                    door Solid(); 
                    door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                    door EnableLinkTo(); 
                    door LinkTo(center); 
                    for(h = 1; h < height; h++){ 
                            door = spawn("script_model", open + (((0, 30, 0) * offset)*1.5) - ((55, 0, 0) * h)); 
                            door setModel("com_plasticcase_enemy"); 
                            door Solid(); 
                            door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                            door EnableLinkTo(); 
                            door LinkTo(center); 
                    } 
                    offset += 1; 
            } 
            center.angles = angle; 
            center.state = "open"; 
            center.hp = hp; 
            center.range = range; 
            center thread DoorThink(open, close); 
            center thread DoorUse(); 
            center thread ResetDoors(open, hp); 
            wait 0.01; 
    } 
     
    DoorThink(open, close) 
    { 
            while(1) 
            { 
                    if(self.hp > 0){ 
                            self waittill ( "triggeruse" , player ); 
                            if(player.team == "axis"){ 
                                    if(self.state == "open"){ 
                                            self MoveTo(close, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "close"; 
                                            continue; 
                                    } 
                                    if(self.state == "close"){ 
                                            self MoveTo(open, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "open"; 
                                            continue; 
                                    } 
                            } 
                            if(player.team == "allies"){ 
                                    if(self.state == "close"){ 
                                            self.hp--; 
                                            player iPrintlnBold("HIT"); 
                                            wait 1; 
                                            continue; 
                                    } 
                            } 
                    } else { 
                            if(self.state == "close"){ 
                                self MoveTo(open, level.doorwait); 
                            } 
                            self.state = "broken"; 
                            wait .5; 
    						self delete();
                    } 
            } 
    } 
     
    DoorUse(range) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(self.origin, player.origin) <= self.range){ 
                                    if(player.team == "axis"){ 
                                            if(self.state == "open"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door"; 
                                            } 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player.team == "allies"){ 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player maps\mp\gametypes\_rank::isButtonPressed("X")){ 
                                            self notify( "triggeruse" , player); 
                                    } 
                            } 
                    } 
                    wait .045; 
            } 
    }
     
    CreateElevator(enter, exit, angle, notantycamp) 
    { 
    		if(!isDefined(notantycamp)) notantycamp = true;
    		if(notantycamp) {
    			flag = spawn( "script_model", enter ); 
    			flag setModel( level.elevator_model["enter"] ); 
    			wait 0.01; 
    			flag = spawn( "script_model", exit ); 
    			flag setModel( level.elevator_model["exit"] ); 
    		}
            wait 0.01; 
            self thread ElevatorThink(enter, exit, angle); 
    }  
     
    ElevatorThink(enter, exit, angle) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(enter, player.origin) <= 90){ 
                                    player SetOrigin(exit); 
                                    player SetPlayerAngles(angle); 
                            } 
                    } 
                    wait .25; 
            } 
    }  
     
    ResetDoors(open, hp) 
    { 
            while(1) 
            { 
                    level waittill("RESETDOORS"); 
                    self.hp = hp; 
                    self MoveTo(open, level.doorwait); 
                    self.state = "open"; 
            } 
    } 
    
    CreateRamps(top, bottom)
    {
            D = Distance(top, bottom);
            blocks = roundUp(D/30);
            CX = top[0] - bottom[0];
            CY = top[1] - bottom[1];
            CZ = top[2] - bottom[2];
            XA = CX/blocks;
            YA = CY/blocks;
            ZA = CZ/blocks;
            CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            Temp = VectorToAngles(top - bottom);
            BA = (Temp[2], Temp[1] + 90, Temp[0]);
            for(b = 0; b < blocks; b++){
                    block = spawn("script_model", (bottom + ((XA, YA, ZA) * B)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = BA;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.01;
            }
            block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)));
            block setModel("com_plasticcase_friendly");
            block.angles = (BA[0], BA[1], 0);
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    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;
            center = spawn("script_model", corner1);
            for(r = 0; r <= ROWS; r++){
                    for(c = 0; c <= COLUMNS; c++){
                            for(h = 0; h <= HEIGHT; h++){
                                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)));
                                    block setModel("com_plasticcase_friendly");
                                    block.angles = (0, 0, 0);
                                    block Solid();
                                    block LinkTo(center);
                                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                                    wait 0.01;
                            }
                    }
            }
            center.angles = angle;
    }
    
    CreateWalls(start, end)
    {
            D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
            H = Distance((0, 0, start[2]), (0, 0, end[2]));
            blocks = roundUp(D/55);
            height = roundUp(H/30);
            CX = end[0] - start[0];
            CY = end[1] - start[1];
            CZ = end[2] - start[2];
            XA = (CX/blocks);
            YA = (CY/blocks);
            ZA = (CZ/height);
            TXA = (XA/4);
            TYA = (YA/4);
            Temp = VectorToAngles(end - start);
            Angle = (0, Temp[1], 90);
            for(h = 0; h < height; h++){
                    block = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
                    for(i = 1; i < blocks; i++){
                            block = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h)));
                            block setModel("com_plasticcase_friendly");
                            block.angles = Angle;
                            block Solid();
                            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                            wait 0.001;
                    }
                    block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
            }
    }
    
    CreateCluster(amount, pos, radius)
    {
            for(i = 0; i < amount; i++)
            {
                    half = radius / 2;
                    power = ((randomInt(radius) - half), (randomInt(radius) - half), 500);
                    block = spawn("script_model", pos + (0, 0, 1000) );
                    block setModel("com_plasticcase_friendly");
                    block.angles = (90, 0, 0);
                    block PhysicsLaunchServer((0, 0, 0), power);
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    block thread ResetCluster(pos, radius);
                    wait 0.05;
            }
    }
    
    ResetCluster(pos, radius)
    {
            wait 5;
            self RotateTo(((randomInt(36)*10), (randomInt(36)*10), (randomInt(36)*10)), 1);
            level waittill("RESETCLUSTER");
            self thread CreateCluster(1, pos, radius);
            self delete();
    }
    
    
    roundUp( floatVal )
    {
            if ( int( floatVal ) != floatVal )
                    return int( floatVal+1 );
            else
                    return int( floatVal );
    }
    IF you see there are bunkers only for favela how to add new maps to the _maps_objects.gsc Help me plzz
    SorryForBadEnglish

  2. #2
    rangg's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    157
    Reputation
    10
    Thanks
    20
    My Mood
    Cool
    need help too how add objectiv i have this too.
    this very easy the zombie with that.
    i edit the zombie alone and this hard1
    how add objectiv?

  3. #3
    Legend Of Hacking's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Isreal
    Posts
    57
    Reputation
    10
    Thanks
    4
    My Mood
    Fine
    Quote Originally Posted by rangg View Post
    need help too how add objectiv i have this too.
    this very easy the zombie with that.
    i edit the zombie alone and this hard1
    how add objectiv?
    i try to add maps to bulid bunkers in it but didnt work look at it how i add its say bad snyax
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    init()
    {
    	level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    	level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
    	precacheModel( level.elevator_model["enter"] );
    	precacheModel( level.elevator_model["exit"] );
    	wait 1.05;
    	switch(GetDvar("mapname")) {
    		case "mp_favela":
    			favela_objects();
    			break;
    
    		
    
    	}
    }
    
    
    
    favela_objects()
    {
    
    CreateWalls((-1351, 919, 184), (-1450, 919, 274));
    CreateDoors((-1400, 919, 184), (-1500, 919, 184), (90,90, 0), 2, 2, 15, 75);
    CreateWalls((2445, 3065, 280), (2583, 2863, 310));
    CreateWalls((2445, 3065, 340), (2583, 2863, 370));
    CreateWalls((2130, 2613, 280), (2081, 2712, 310));
    CreateWalls((2130, 2613, 340), (2081, 2712, 370));
    CreateElevator((880, 2254, 282), (1177, 2402 ,281), (0, 0, 0));
    CreateDoors((-1474, 1399, 210), (-1374, 1399, 210), (90,90, 0), 2, 2, 15, 75);
    CreateDoors((2081, 2712, 280), (2028, 2790, 280), (90,90, 55), 3, 2, 15, 75);
    }
    afghan_objects()
    {
       CreateDoors((1200, 4756, 410), (1400, 4756, 410), (90, 90, 0), 6, 2, 12, 200);
    	CreateRamps((2280, 1254, 142), (2548, 1168, 33));
    	CreateGrids((1688, 4746, 416), (1024, 5039, 416), (0, 0, 0));
    	CreateRamps((1472, 4103, 256), (1356, 4720, 410));
    	CreateRamps((1552, 4103, 256), (1436, 4720, 410));
    	CreateWalls((1688, 4746, 416), (1500, 4746, 550));
    	CreateWalls((1024, 4746, 416), (1300, 4746, 550));
    	CreateWalls((1688, 4746, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1024, 4746, 550));
    }
    
    /************************************************************************************
    *  Building functions, credits to Killingdyl for making this
    *************************************************************************************/
    
    CreateBlocks(pos, angle)
    {
            block = spawn("script_model", pos );
            block setModel("com_plasticcase_friendly");
            block.angles = angle;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	level.doorwait = 0.7;
            offset = (((size / 2) - 0.5) * -1); 
            center = spawn("script_model", open ); 
            for(j = 0; j < size; j++){ 
                    door = spawn("script_model", open + (((0, 30, 0) * offset))*1.5); 
                    door setModel("com_plasticcase_enemy"); 
                    door Solid(); 
                    door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                    door EnableLinkTo(); 
                    door LinkTo(center); 
                    for(h = 1; h < height; h++){ 
                            door = spawn("script_model", open + (((0, 30, 0) * offset)*1.5) - ((55, 0, 0) * h)); 
                            door setModel("com_plasticcase_enemy"); 
                            door Solid(); 
                            door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                            door EnableLinkTo(); 
                            door LinkTo(center); 
                    } 
                    offset += 1; 
            } 
            center.angles = angle; 
            center.state = "open"; 
            center.hp = hp; 
            center.range = range; 
            center thread DoorThink(open, close); 
            center thread DoorUse(); 
            center thread ResetDoors(open, hp); 
            wait 0.01; 
    } 
     
    DoorThink(open, close) 
    { 
            while(1) 
            { 
                    if(self.hp > 0){ 
                            self waittill ( "triggeruse" , player ); 
                            if(player.team == "axis"){ 
                                    if(self.state == "open"){ 
                                            self MoveTo(close, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "close"; 
                                            continue; 
                                    } 
                                    if(self.state == "close"){ 
                                            self MoveTo(open, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "open"; 
                                            continue; 
                                    } 
                            } 
                            if(player.team == "allies"){ 
                                    if(self.state == "close"){ 
                                            self.hp--; 
                                            player iPrintlnBold("HIT"); 
                                            wait 1; 
                                            continue; 
                                    } 
                            } 
                    } else { 
                            if(self.state == "close"){ 
                                self MoveTo(open, level.doorwait); 
                            } 
                            self.state = "broken"; 
                            wait .5; 
    						self delete();
                    } 
            } 
    } 
     
    DoorUse(range) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(self.origin, player.origin) <= self.range){ 
                                    if(player.team == "axis"){ 
                                            if(self.state == "open"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door"; 
                                            } 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player.team == "allies"){ 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player maps\mp\gametypes\_rank::isButtonPressed("X")){ 
                                            self notify( "triggeruse" , player); 
                                    } 
                            } 
                    } 
                    wait .045; 
            } 
    }
     
    CreateElevator(enter, exit, angle, notantycamp) 
    { 
    		if(!isDefined(notantycamp)) notantycamp = true;
    		if(notantycamp) {
    			flag = spawn( "script_model", enter ); 
    			flag setModel( level.elevator_model["enter"] ); 
    			wait 0.01; 
    			flag = spawn( "script_model", exit ); 
    			flag setModel( level.elevator_model["exit"] ); 
    		}
            wait 0.01; 
            self thread ElevatorThink(enter, exit, angle); 
    }  
     
    ElevatorThink(enter, exit, angle) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(enter, player.origin) <= 90){ 
                                    player SetOrigin(exit); 
                                    player SetPlayerAngles(angle); 
                            } 
                    } 
                    wait .25; 
            } 
    }  
     
    ResetDoors(open, hp) 
    { 
            while(1) 
            { 
                    level waittill("RESETDOORS"); 
                    self.hp = hp; 
                    self MoveTo(open, level.doorwait); 
                    self.state = "open"; 
            } 
    } 
    
    CreateRamps(top, bottom)
    {
            D = Distance(top, bottom);
            blocks = roundUp(D/30);
            CX = top[0] - bottom[0];
            CY = top[1] - bottom[1];
            CZ = top[2] - bottom[2];
            XA = CX/blocks;
            YA = CY/blocks;
            ZA = CZ/blocks;
            CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            Temp = VectorToAngles(top - bottom);
            BA = (Temp[2], Temp[1] + 90, Temp[0]);
            for(b = 0; b < blocks; b++){
                    block = spawn("script_model", (bottom + ((XA, YA, ZA) * B)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = BA;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.01;
            }
            block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)));
            block setModel("com_plasticcase_friendly");
            block.angles = (BA[0], BA[1], 0);
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    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;
            center = spawn("script_model", corner1);
            for(r = 0; r <= ROWS; r++){
                    for(c = 0; c <= COLUMNS; c++){
                            for(h = 0; h <= HEIGHT; h++){
                                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)));
                                    block setModel("com_plasticcase_friendly");
                                    block.angles = (0, 0, 0);
                                    block Solid();
                                    block LinkTo(center);
                                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                                    wait 0.01;
                            }
                    }
            }
            center.angles = angle;
    }
    
    CreateWalls(start, end)
    {
            D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
            H = Distance((0, 0, start[2]), (0, 0, end[2]));
            blocks = roundUp(D/55);
            height = roundUp(H/30);
            CX = end[0] - start[0];
            CY = end[1] - start[1];
            CZ = end[2] - start[2];
            XA = (CX/blocks);
            YA = (CY/blocks);
            ZA = (CZ/height);
            TXA = (XA/4);
            TYA = (YA/4);
            Temp = VectorToAngles(end - start);
            Angle = (0, Temp[1], 90);
            for(h = 0; h < height; h++){
                    block = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
                    for(i = 1; i < blocks; i++){
                            block = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h)));
                            block setModel("com_plasticcase_friendly");
                            block.angles = Angle;
                            block Solid();
                            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                            wait 0.001;
                    }
                    block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
            }
    }
    
    CreateCluster(amount, pos, radius)
    {
            for(i = 0; i < amount; i++)
            {
                    half = radius / 2;
                    power = ((randomInt(radius) - half), (randomInt(radius) - half), 500);
                    block = spawn("script_model", pos + (0, 0, 1000) );
                    block setModel("com_plasticcase_friendly");
                    block.angles = (90, 0, 0);
                    block PhysicsLaunchServer((0, 0, 0), power);
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    block thread ResetCluster(pos, radius);
                    wait 0.05;
            }
    }
    
    ResetCluster(pos, radius)
    {
            wait 5;
            self RotateTo(((randomInt(36)*10), (randomInt(36)*10), (randomInt(36)*10)), 1);
            level waittill("RESETCLUSTER");
            self thread CreateCluster(1, pos, radius);
            self delete();
    }
    
    
    roundUp( floatVal )
    {
            if ( int( floatVal ) != floatVal )
                    return int( floatVal+1 );
            else
                    return int( floatVal );
    }

  4. #4
    Arasonic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    569
    Reputation
    11
    Thanks
    115
    Quote Originally Posted by Legend Of Hacking View Post
    i try to add maps to bulid bunkers in it but didnt work look at it how i add its say bad snyax
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    init()
    {
    	level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    	level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
    	precacheModel( level.elevator_model["enter"] );
    	precacheModel( level.elevator_model["exit"] );
    	wait 1.05;
    	switch(GetDvar("mapname")) {
    		case "mp_favela":
    			favela_objects();
    			break;
                   case "mp_afghan
                               afghan_objects();
                               break;
    
    		
    
    	}
    }
    
    
    
    favela_objects()
    {
    
    CreateWalls((-1351, 919, 184), (-1450, 919, 274));
    CreateDoors((-1400, 919, 184), (-1500, 919, 184), (90,90, 0), 2, 2, 15, 75);
    CreateWalls((2445, 3065, 280), (2583, 2863, 310));
    CreateWalls((2445, 3065, 340), (2583, 2863, 370));
    CreateWalls((2130, 2613, 280), (2081, 2712, 310));
    CreateWalls((2130, 2613, 340), (2081, 2712, 370));
    CreateElevator((880, 2254, 282), (1177, 2402 ,281), (0, 0, 0));
    CreateDoors((-1474, 1399, 210), (-1374, 1399, 210), (90,90, 0), 2, 2, 15, 75);
    CreateDoors((2081, 2712, 280), (2028, 2790, 280), (90,90, 55), 3, 2, 15, 75);
    }
    afghan_objects()
    {
       CreateDoors((1200, 4756, 410), (1400, 4756, 410), (90, 90, 0), 6, 2, 12, 200);
    	CreateRamps((2280, 1254, 142), (2548, 1168, 33));
    	CreateGrids((1688, 4746, 416), (1024, 5039, 416), (0, 0, 0));
    	CreateRamps((1472, 4103, 256), (1356, 4720, 410));
    	CreateRamps((1552, 4103, 256), (1436, 4720, 410));
    	CreateWalls((1688, 4746, 416), (1500, 4746, 550));
    	CreateWalls((1024, 4746, 416), (1300, 4746, 550));
    	CreateWalls((1688, 4746, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1024, 4746, 550));
    }
    
    /************************************************************************************
    *  Building functions, credits to Killingdyl for making this
    *************************************************************************************/
    
    CreateBlocks(pos, angle)
    {
            block = spawn("script_model", pos );
            block setModel("com_plasticcase_friendly");
            block.angles = angle;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	level.doorwait = 0.7;
            offset = (((size / 2) - 0.5) * -1); 
            center = spawn("script_model", open ); 
            for(j = 0; j < size; j++){ 
                    door = spawn("script_model", open + (((0, 30, 0) * offset))*1.5); 
                    door setModel("com_plasticcase_enemy"); 
                    door Solid(); 
                    door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                    door EnableLinkTo(); 
                    door LinkTo(center); 
                    for(h = 1; h < height; h++){ 
                            door = spawn("script_model", open + (((0, 30, 0) * offset)*1.5) - ((55, 0, 0) * h)); 
                            door setModel("com_plasticcase_enemy"); 
                            door Solid(); 
                            door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                            door EnableLinkTo(); 
                            door LinkTo(center); 
                    } 
                    offset += 1; 
            } 
            center.angles = angle; 
            center.state = "open"; 
            center.hp = hp; 
            center.range = range; 
            center thread DoorThink(open, close); 
            center thread DoorUse(); 
            center thread ResetDoors(open, hp); 
            wait 0.01; 
    } 
     
    DoorThink(open, close) 
    { 
            while(1) 
            { 
                    if(self.hp > 0){ 
                            self waittill ( "triggeruse" , player ); 
                            if(player.team == "axis"){ 
                                    if(self.state == "open"){ 
                                            self MoveTo(close, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "close"; 
                                            continue; 
                                    } 
                                    if(self.state == "close"){ 
                                            self MoveTo(open, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "open"; 
                                            continue; 
                                    } 
                            } 
                            if(player.team == "allies"){ 
                                    if(self.state == "close"){ 
                                            self.hp--; 
                                            player iPrintlnBold("HIT"); 
                                            wait 1; 
                                            continue; 
                                    } 
                            } 
                    } else { 
                            if(self.state == "close"){ 
                                self MoveTo(open, level.doorwait); 
                            } 
                            self.state = "broken"; 
                            wait .5; 
    						self delete();
                    } 
            } 
    } 
     
    DoorUse(range) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(self.origin, player.origin) <= self.range){ 
                                    if(player.team == "axis"){ 
                                            if(self.state == "open"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door"; 
                                            } 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player.team == "allies"){ 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player maps\mp\gametypes\_rank::isButtonPressed("X")){ 
                                            self notify( "triggeruse" , player); 
                                    } 
                            } 
                    } 
                    wait .045; 
            } 
    }
     
    CreateElevator(enter, exit, angle, notantycamp) 
    { 
    		if(!isDefined(notantycamp)) notantycamp = true;
    		if(notantycamp) {
    			flag = spawn( "script_model", enter ); 
    			flag setModel( level.elevator_model["enter"] ); 
    			wait 0.01; 
    			flag = spawn( "script_model", exit ); 
    			flag setModel( level.elevator_model["exit"] ); 
    		}
            wait 0.01; 
            self thread ElevatorThink(enter, exit, angle); 
    }  
     
    ElevatorThink(enter, exit, angle) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(enter, player.origin) <= 90){ 
                                    player SetOrigin(exit); 
                                    player SetPlayerAngles(angle); 
                            } 
                    } 
                    wait .25; 
            } 
    }  
     
    ResetDoors(open, hp) 
    { 
            while(1) 
            { 
                    level waittill("RESETDOORS"); 
                    self.hp = hp; 
                    self MoveTo(open, level.doorwait); 
                    self.state = "open"; 
            } 
    } 
    
    CreateRamps(top, bottom)
    {
            D = Distance(top, bottom);
            blocks = roundUp(D/30);
            CX = top[0] - bottom[0];
            CY = top[1] - bottom[1];
            CZ = top[2] - bottom[2];
            XA = CX/blocks;
            YA = CY/blocks;
            ZA = CZ/blocks;
            CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            Temp = VectorToAngles(top - bottom);
            BA = (Temp[2], Temp[1] + 90, Temp[0]);
            for(b = 0; b < blocks; b++){
                    block = spawn("script_model", (bottom + ((XA, YA, ZA) * B)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = BA;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.01;
            }
            block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)));
            block setModel("com_plasticcase_friendly");
            block.angles = (BA[0], BA[1], 0);
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    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;
            center = spawn("script_model", corner1);
            for(r = 0; r <= ROWS; r++){
                    for(c = 0; c <= COLUMNS; c++){
                            for(h = 0; h <= HEIGHT; h++){
                                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)));
                                    block setModel("com_plasticcase_friendly");
                                    block.angles = (0, 0, 0);
                                    block Solid();
                                    block LinkTo(center);
                                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                                    wait 0.01;
                            }
                    }
            }
            center.angles = angle;
    }
    
    CreateWalls(start, end)
    {
            D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
            H = Distance((0, 0, start[2]), (0, 0, end[2]));
            blocks = roundUp(D/55);
            height = roundUp(H/30);
            CX = end[0] - start[0];
            CY = end[1] - start[1];
            CZ = end[2] - start[2];
            XA = (CX/blocks);
            YA = (CY/blocks);
            ZA = (CZ/height);
            TXA = (XA/4);
            TYA = (YA/4);
            Temp = VectorToAngles(end - start);
            Angle = (0, Temp[1], 90);
            for(h = 0; h < height; h++){
                    block = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
                    for(i = 1; i < blocks; i++){
                            block = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h)));
                            block setModel("com_plasticcase_friendly");
                            block.angles = Angle;
                            block Solid();
                            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                            wait 0.001;
                    }
                    block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
            }
    }
    
    CreateCluster(amount, pos, radius)
    {
            for(i = 0; i < amount; i++)
            {
                    half = radius / 2;
                    power = ((randomInt(radius) - half), (randomInt(radius) - half), 500);
                    block = spawn("script_model", pos + (0, 0, 1000) );
                    block setModel("com_plasticcase_friendly");
                    block.angles = (90, 0, 0);
                    block PhysicsLaunchServer((0, 0, 0), power);
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    block thread ResetCluster(pos, radius);
                    wait 0.05;
            }
    }
    
    ResetCluster(pos, radius)
    {
            wait 5;
            self RotateTo(((randomInt(36)*10), (randomInt(36)*10), (randomInt(36)*10)), 1);
            level waittill("RESETCLUSTER");
            self thread CreateCluster(1, pos, radius);
            self delete();
    }
    
    
    roundUp( floatVal )
    {
            if ( int( floatVal ) != floatVal )
                    return int( floatVal+1 );
            else
                    return int( floatVal );
    }
    try that filla
    in a hurry so make it exactly under favela, can't do myself right now

  5. #5
    Legend Of Hacking's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Isreal
    Posts
    57
    Reputation
    10
    Thanks
    4
    My Mood
    Fine
    Quote Originally Posted by Arasonic View Post
    try that filla
    in a hurry so make it exactly under favela, can't do myself right now
    i try it its tell me error
    Last edited by Legend Of Hacking; 10-19-2010 at 10:50 AM.

  6. #6
    mathieutje12's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Close to my PC
    Posts
    578
    Reputation
    14
    Thanks
    165
    My Mood
    Angelic
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    init()
    {
    	level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    	level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
    	precacheModel( level.elevator_model["enter"] );
    	precacheModel( level.elevator_model["exit"] );
    	wait 1.05;
    	switch(GetDvar("mapname")) {
    		
    		case "mp_nightshift":
    			nightshift_objects();
    			break;
    
    		case "mp_MAPNAME":
    			MAPNAME_objects();
    			break;
    
    		case "mp_MAPNAME":
    			MAPNAME_objects();
    			break;
    
    		case "mp_MAPNAME":
    			MAPNAME_objects();
    			break;
    	}
    
    
    }
    MAPNAME_objects()
    {
    
    }
    nightshift_objects()
    {  
     
    }
    
    
    CreateBlocks(pos, angle)
    {
            block = spawn("script_model", pos );
            block setModel("com_plasticcase_friendly");
            block.angles = angle;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	level.doorwait = 0.7;
            offset = (((size / 2) - 0.5) * -1); 
            center = spawn("script_model", open ); 
            for(j = 0; j < size; j++){ 
                    door = spawn("script_model", open + (((0, 30, 0) * offset))*1.5); 
                    door setModel("com_plasticcase_enemy"); 
                    door Solid(); 
                    door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                    door EnableLinkTo(); 
                    door LinkTo(center); 
                    for(h = 1; h < height; h++){ 
                            door = spawn("script_model", open + (((0, 30, 0) * offset)*1.5) - ((55, 0, 0) * h)); 
                            door setModel("com_plasticcase_enemy"); 
                            door Solid(); 
                            door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                            door EnableLinkTo(); 
                            door LinkTo(center); 
                    } 
                    offset += 1; 
            } 
            center.angles = angle; 
            center.state = "open"; 
            center.hp = hp; 
            center.range = range; 
            center thread DoorThink(open, close); 
            center thread DoorUse(); 
            center thread ResetDoors(open, hp); 
            wait 0.01; 
    } 
     
    DoorThink(open, close) 
    { 
            while(1) 
            { 
                    if(self.hp > 0){ 
                            self waittill ( "triggeruse" , player ); 
                            if(player.team == "axis"){ 
                                    if(self.state == "open"){ 
                                            self MoveTo(close, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "close"; 
                                            continue; 
                                    } 
                                    if(self.state == "close"){ 
                                            self MoveTo(open, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "open"; 
                                            continue; 
                                    } 
                            } 
                            if(player.team == "allies"){ 
                                    if(self.state == "close"){ 
                                            self.hp--; 
                                            player iPrintlnBold("HIT"); 
                                            wait 1; 
                                            continue; 
                                    } 
                            } 
                    } else { 
                            if(self.state == "close"){ 
                                self MoveTo(open, level.doorwait); 
                            } 
                            self.state = "broken"; 
                            wait .5; 
    						self delete();
                    } 
            } 
    } 
     
    DoorUse(range) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(self.origin, player.origin) <= self.range){ 
                                    if(player.team == "axis"){ 
                                            if(self.state == "open"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door"; 
                                            } 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player.team == "allies"){ 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player maps\mp\gametypes\_rank::isButtonPressed("X")){ 
                                            self notify( "triggeruse" , player); 
                                    } 
                            } 
                    } 
                    wait .045; 
            } 
    }
     
    CreateElevator(enter, exit, angle, notantycamp) 
    { 
    		if(!isDefined(notantycamp)) notantycamp = true;
    		if(notantycamp) {
    			flag = spawn( "script_model", enter ); 
    			flag setModel( level.elevator_model["enter"] ); 
    			wait 0.01; 
    			flag = spawn( "script_model", exit ); 
    			flag setModel( level.elevator_model["exit"] ); 
    		}
            wait 0.01; 
            self thread ElevatorThink(enter, exit, angle); 
    }  
     
    ElevatorThink(enter, exit, angle) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(enter, player.origin) <= 90){ 
                                    player SetOrigin(exit); 
                                    player SetPlayerAngles(angle); 
                            } 
                    } 
                    wait .25; 
            } 
    }  
     
    ResetDoors(open, hp) 
    { 
            while(1) 
            { 
                    level waittill("RESETDOORS"); 
                    self.hp = hp; 
                    self MoveTo(open, level.doorwait); 
                    self.state = "open"; 
            } 
    } 
    
    CreateRamps(top, bottom)
    {
            D = Distance(top, bottom);
            blocks = roundUp(D/30);
            CX = top[0] - bottom[0];
            CY = top[1] - bottom[1];
            CZ = top[2] - bottom[2];
            XA = CX/blocks;
            YA = CY/blocks;
            ZA = CZ/blocks;
            CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            Temp = VectorToAngles(top - bottom);
            BA = (Temp[2], Temp[1] + 90, Temp[0]);
            for(b = 0; b < blocks; b++){
                    block = spawn("script_model", (bottom + ((XA, YA, ZA) * B)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = BA;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.01;
            }
            block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)));
            block setModel("com_plasticcase_friendly");
            block.angles = (BA[0], BA[1], 0);
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    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;
            center = spawn("script_model", corner1);
            for(r = 0; r <= ROWS; r++){
                    for(c = 0; c <= COLUMNS; c++){
                            for(h = 0; h <= HEIGHT; h++){
                                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)));
                                    block setModel("com_plasticcase_friendly");
                                    block.angles = (0, 0, 0);
                                    block Solid();
                                    block LinkTo(center);
                                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                                    wait 0.01;
                            }
                    }
            }
            center.angles = angle;
    }
    
    CreateWalls(start, end)
    {
            D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
            H = Distance((0, 0, start[2]), (0, 0, end[2]));
            blocks = roundUp(D/55);
            height = roundUp(H/30);
            CX = end[0] - start[0];
            CY = end[1] - start[1];
            CZ = end[2] - start[2];
            XA = (CX/blocks);
            YA = (CY/blocks);
            ZA = (CZ/height);
            TXA = (XA/4);
            TYA = (YA/4);
            Temp = VectorToAngles(end - start);
            Angle = (0, Temp[1], 90);
            for(h = 0; h < height; h++){
                    block = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
                    for(i = 1; i < blocks; i++){
                            block = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h)));
                            block setModel("com_plasticcase_friendly");
                            block.angles = Angle;
                            block Solid();
                            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                            wait 0.001;
                    }
                    block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
            }
    }
    
    CreateCluster(amount, pos, radius)
    {
            for(i = 0; i < amount; i++)
            {
                    half = radius / 2;
                    power = ((randomInt(radius) - half), (randomInt(radius) - half), 500);
                    block = spawn("script_model", pos + (0, 0, 1000) );
                    block setModel("com_plasticcase_friendly");
                    block.angles = (90, 0, 0);
                    block PhysicsLaunchServer((0, 0, 0), power);
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    block thread ResetCluster(pos, radius);
                    wait 0.05;
            }
    }
    
    ResetCluster(pos, radius)
    {
            wait 5;
            self RotateTo(((randomInt(36)*10), (randomInt(36)*10), (randomInt(36)*10)), 1);
            level waittill("RESETCLUSTER");
            self thread CreateCluster(1, pos, radius);
            self delete();
    }
    
    
    roundUp( floatVal )
    {
            if ( int( floatVal ) != floatVal )
                    return int( floatVal+1 );
            else
                    return int( floatVal );
    }
    Hard He?

  7. #7
    Legend Of Hacking's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Isreal
    Posts
    57
    Reputation
    10
    Thanks
    4
    My Mood
    Fine
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    init()
    {
    	level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    	level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
    	precacheModel( level.elevator_model["enter"] );
    	precacheModel( level.elevator_model["exit"] );
    	wait 1.05;
    	switch(GetDvar("mapname")) {
    		
    		case "mp_nightshift":
    			nightshift_objects();
    			break;
    
    		case "mp_favela":
    			favela_objects();
    			break;
    
    		case "mp_quarry":
    			quarry_objects();
    			break;
    
    		case "mp_afghan":
    			afghan_objects();
    			break;
    	}
    
    
    }
    favela_objects()
    {
                CreateElevator((-321, 2633, 335), (5047, -2867, 216), (0, 0, 0));
    	CreateElevator((-192, -743, 308), (5047, -2867, 216), (0, 0, 0));	
    	CreateElevator((-227, 1325, 152), (5047, -2867, 216), (0, 0, 0));	
    	CreateElevator((34, 277, 312), (5047, -2867, 216), (0, 0, 0));	
    	CreateElevator((1022, 413, 198), (5047, -2867, 216), (0, 0, 0));	
    	CreateElevator((1608, 1010, 312), (5047, -2867, 216), (0, 0, 0));		
    	CreateElevator((763, -1983, 152), (404, 1677, 595), (0, 0, 0));
    	CreateGrids((2809, -2212, 239), (2809, -2675, 230), (0, 0, 0));
    	CreateWalls((2809, -2212, 143), (2236, -2212, 240));
    	CreateWalls((2809, -2212, 143), (2809, -2400, 180));
    	CreateWalls((2809, -2212, 220), (2809, -2675, 240));
    	Createwalls((2236, -2212, 143), (2236, -2675, 180));
    	CreateWalls((2236, -2675, 143), (2236, -2212, 240));
            CreateWalls((2809, -2675, 143), (2809, -2550, 180));
    	CreateWalls((2809, -2675, 143), (2236, -2675, 240));
    	CreateRamps((2650, -2600, 143), (2236, -2600, 220));
    	CreateDoors((2780, -2300, 143), (2809, -2485, 143), (90, 0, 0), 7, 2, 15, 50);
    }
    nightshift_objects()
    {  
                 CreateElevator((-725, -410, 136), (-910, -620, 570), (0, 0, 0));
    	CreateRamps((-705, -830, 688), (-495, -830, 608));
    	CreateRamps((-580, -445, 608), (-580, -375, 568));
    	CreateRamps((1690, 325, 213), (1890, 325, 108));
    	CreateGrids((-1540, -1687, 600), (-275, -1687, 660), (0, 0, 0));
    	CreateGrids((-1060, -1535, 584), (-470, -1650, 584), (0, 0, 0));
    	CreateGrids((-700, -120, 580), (-700, -120, 640), (0, 90, 0));
    	CreateGrids((-705, -490, 580), (-705, -770, 580), (-45, 0, 0));
    } 
    
    
    CreateBlocks(pos, angle)
    {
            block = spawn("script_model", pos );
            block setModel("com_plasticcase_friendly");
            block.angles = angle;
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    quarry_objects();
    {
         CreateBlocks((-5817, -319, -88), (0, 0, 0));
    	CreateBlocks((-5817, -289, -108), (0, 0, 0));
    	CreateRamps((-3742, -1849, 304), (-3605, -1849, 224));
    	CreateRamps((-3428, -1650, 224), (-3188, -1650, 160));
    	CreateRamps((-3412, -1800, 416), (-3735, -1800, 304));
    	CreateGrids((-3520, -1880, 320), (-3215, -2100, 320), (0, 0, 0));
    	CreateGrids((-3100, -1725, 400), (-2740, -1840, 400), (3, 0, 0));
    }
    afghan_objects()
    {
         CreateDoors((1200, 4756, 410), (1400, 4756, 410), (90, 90, 0), 6, 2, 12, 200);
    	CreateRamps((2280, 1254, 142), (2548, 1168, 33));
    	CreateGrids((1688, 4746, 416), (1024, 5039, 416), (0, 0, 0));
    	CreateRamps((1472, 4103, 256), (1356, 4720, 410));
    	CreateRamps((1552, 4103, 256), (1436, 4720, 410));
    	CreateWalls((1688, 4746, 416), (1500, 4746, 550));
    	CreateWalls((1024, 4746, 416), (1300, 4746, 550));
    	CreateWalls((1688, 4746, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1688, 5039, 550));
    	CreateWalls((1024, 5039, 416), (1024, 4746, 550));
    }
    
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	level.doorwait = 0.7;
            offset = (((size / 2) - 0.5) * -1); 
            center = spawn("script_model", open ); 
            for(j = 0; j < size; j++){ 
                    door = spawn("script_model", open + (((0, 30, 0) * offset))*1.5); 
                    door setModel("com_plasticcase_enemy"); 
                    door Solid(); 
                    door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                    door EnableLinkTo(); 
                    door LinkTo(center); 
                    for(h = 1; h < height; h++){ 
                            door = spawn("script_model", open + (((0, 30, 0) * offset)*1.5) - ((55, 0, 0) * h)); 
                            door setModel("com_plasticcase_enemy"); 
                            door Solid(); 
                            door CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); 
                            door EnableLinkTo(); 
                            door LinkTo(center); 
                    } 
                    offset += 1; 
            } 
            center.angles = angle; 
            center.state = "open"; 
            center.hp = hp; 
            center.range = range; 
            center thread DoorThink(open, close); 
            center thread DoorUse(); 
            center thread ResetDoors(open, hp); 
            wait 0.01; 
    } 
     
    DoorThink(open, close) 
    { 
            while(1) 
            { 
                    if(self.hp > 0){ 
                            self waittill ( "triggeruse" , player ); 
                            if(player.team == "axis"){ 
                                    if(self.state == "open"){ 
                                            self MoveTo(close, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "close"; 
                                            continue; 
                                    } 
                                    if(self.state == "close"){ 
                                            self MoveTo(open, level.doorwait); 
                                            wait level.doorwait; 
                                            self.state = "open"; 
                                            continue; 
                                    } 
                            } 
                            if(player.team == "allies"){ 
                                    if(self.state == "close"){ 
                                            self.hp--; 
                                            player iPrintlnBold("HIT"); 
                                            wait 1; 
                                            continue; 
                                    } 
                            } 
                    } else { 
                            if(self.state == "close"){ 
                                self MoveTo(open, level.doorwait); 
                            } 
                            self.state = "broken"; 
                            wait .5; 
    						self delete();
                    } 
            } 
    } 
     
    DoorUse(range) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(self.origin, player.origin) <= self.range){ 
                                    if(player.team == "axis"){ 
                                            if(self.state == "open"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door"; 
                                            } 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player.team == "allies"){ 
                                            if(self.state == "close"){ 
                                                    player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door"; 
                                            } 
                                            if(self.state == "broken"){ 
                                                    player.hint = "^1Door is Broken"; 
                                            } 
                                    } 
                                    if(player maps\mp\gametypes\_rank::isButtonPressed("X")){ 
                                            self notify( "triggeruse" , player); 
                                    } 
                            } 
                    } 
                    wait .045; 
            } 
    }
     
    CreateElevator(enter, exit, angle, notantycamp) 
    { 
    		if(!isDefined(notantycamp)) notantycamp = true;
    		if(notantycamp) {
    			flag = spawn( "script_model", enter ); 
    			flag setModel( level.elevator_model["enter"] ); 
    			wait 0.01; 
    			flag = spawn( "script_model", exit ); 
    			flag setModel( level.elevator_model["exit"] ); 
    		}
            wait 0.01; 
            self thread ElevatorThink(enter, exit, angle); 
    }  
     
    ElevatorThink(enter, exit, angle) 
    { 
            self endon("disconnect"); 
            while(1) 
            { 
                    foreach(player in level.players) 
                    { 
                            if(Distance(enter, player.origin) <= 90){ 
                                    player SetOrigin(exit); 
                                    player SetPlayerAngles(angle); 
                            } 
                    } 
                    wait .25; 
            } 
    }  
     
    ResetDoors(open, hp) 
    { 
            while(1) 
            { 
                    level waittill("RESETDOORS"); 
                    self.hp = hp; 
                    self MoveTo(open, level.doorwait); 
                    self.state = "open"; 
            } 
    } 
    
    CreateRamps(top, bottom)
    {
            D = Distance(top, bottom);
            blocks = roundUp(D/30);
            CX = top[0] - bottom[0];
            CY = top[1] - bottom[1];
            CZ = top[2] - bottom[2];
            XA = CX/blocks;
            YA = CY/blocks;
            ZA = CZ/blocks;
            CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            Temp = VectorToAngles(top - bottom);
            BA = (Temp[2], Temp[1] + 90, Temp[0]);
            for(b = 0; b < blocks; b++){
                    block = spawn("script_model", (bottom + ((XA, YA, ZA) * B)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = BA;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.01;
            }
            block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)));
            block setModel("com_plasticcase_friendly");
            block.angles = (BA[0], BA[1], 0);
            block Solid();
            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
            wait 0.01;
    }
    
    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;
            center = spawn("script_model", corner1);
            for(r = 0; r <= ROWS; r++){
                    for(c = 0; c <= COLUMNS; c++){
                            for(h = 0; h <= HEIGHT; h++){
                                    block = spawn("script_model", (corner1 + (XA * r, YA * c, ZA * h)));
                                    block setModel("com_plasticcase_friendly");
                                    block.angles = (0, 0, 0);
                                    block Solid();
                                    block LinkTo(center);
                                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                                    wait 0.01;
                            }
                    }
            }
            center.angles = angle;
    }
    
    CreateWalls(start, end)
    {
            D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
            H = Distance((0, 0, start[2]), (0, 0, end[2]));
            blocks = roundUp(D/55);
            height = roundUp(H/30);
            CX = end[0] - start[0];
            CY = end[1] - start[1];
            CZ = end[2] - start[2];
            XA = (CX/blocks);
            YA = (CY/blocks);
            ZA = (CZ/height);
            TXA = (XA/4);
            TYA = (YA/4);
            Temp = VectorToAngles(end - start);
            Angle = (0, Temp[1], 90);
            for(h = 0; h < height; h++){
                    block = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
                    for(i = 1; i < blocks; i++){
                            block = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h)));
                            block setModel("com_plasticcase_friendly");
                            block.angles = Angle;
                            block Solid();
                            block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                            wait 0.001;
                    }
                    block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
                    block setModel("com_plasticcase_friendly");
                    block.angles = Angle;
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    wait 0.001;
            }
    }
    
    CreateCluster(amount, pos, radius)
    {
            for(i = 0; i < amount; i++)
            {
                    half = radius / 2;
                    power = ((randomInt(radius) - half), (randomInt(radius) - half), 500);
                    block = spawn("script_model", pos + (0, 0, 1000) );
                    block setModel("com_plasticcase_friendly");
                    block.angles = (90, 0, 0);
                    block PhysicsLaunchServer((0, 0, 0), power);
                    block Solid();
                    block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
                    block thread ResetCluster(pos, radius);
                    wait 0.05;
            }
    }
    
    ResetCluster(pos, radius)
    {
            wait 5;
            self RotateTo(((randomInt(36)*10), (randomInt(36)*10), (randomInt(36)*10)), 1);
            level waittill("RESETCLUSTER");
            self thread CreateCluster(1, pos, radius);
            self delete();
    }
    
    
    roundUp( floatVal )
    {
            if ( int( floatVal ) != floatVal )
                    return int( floatVal+1 );
            else
                    return int( floatVal );
    }
    Bad syntax..


  8. #8
    mathieutje12's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Close to my PC
    Posts
    578
    Reputation
    14
    Thanks
    165
    My Mood
    Angelic
    This code is wrong:
    quarry_objects();{
    CreateBlocks((-5817, -319, -88), (0, 0, 0));
    CreateBlocks((-5817, -289, -108), (0, 0, 0));
    CreateRamps((-3742, -1849, 304), (-3605, -1849, 224));
    CreateRamps((-3428, -1650, 224), (-3188, -1650, 160));
    CreateRamps((-3412, -1800, 416), (-3735, -1800, 304));
    CreateGrids((-3520, -1880, 320), (-3215, -2100, 320), (0, 0, 0));
    CreateGrids((-3100, -1725, 400), (-2740, -1840, 400), (3, 0, 0));
    }

    Don't put a ; there
    Last edited by mathieutje12; 10-19-2010 at 11:37 AM.

Similar Threads

  1. making bunkers help
    By molczak714 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 4
    Last Post: 01-26-2011, 10:20 AM
  2. help/Release of new bunker
    By XFL in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 3
    Last Post: 09-20-2010, 03:38 AM
  3. Bunkers HELP!!!!!!!!!
    By darkorlegend in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 5
    Last Post: 09-08-2010, 07:14 AM
  4. [Help] Inserting bunkers too existing maps
    By Erige in forum Call of Duty Modern Warfare 2 Help
    Replies: 15
    Last Post: 08-25-2010, 07:11 PM
  5. [Help]Carepackage bunkers
    By mathieutje12 in forum Call of Duty Modern Warfare 2 Help
    Replies: 2
    Last Post: 08-15-2010, 06:26 AM