Results 1 to 5 of 5
  1. #1
    xbeatsszzx's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Behind a dumpster jerking off. xD jks
    Posts
    2,520
    Reputation
    13
    Thanks
    1,494
    My Mood
    Asleep

    Black Ops Building Functions

    Since this wasn't posted on mpgh yet, il post this

    Map Building Functions

    Blocks

    Code:
    CreateBlocks(pos, angle)
    {
    	if(!level.CreateBunkers) return;
            block = spawn("script_model", pos, 1 );
            block setModel( level.crateModelFriendly );	
            block.angles = angle;
            wait 0.01;
    }
    Doors

    Code:
    CreateDoors(open, close, angle, size, height, hp, range) 
    { 
    	if(!level.CreateBunkers) return;
    	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, 1); 
    		door setModel( level.crateModelFriendly );	
    		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), 1); 
    			door setModel( level.crateModelFriendly );	
    			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; 
    			return;
    		} 
    	} 
    } 
     
    DoorUse(range) 
    { 
    	self endon("disconnect"); 
    	while(1) 
    	{ 
    		for(i=0;i<level.players.size;i++)
    		{ 
    			player = level.players[i];
    			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 isButtonPressed("X")){ 
    				//		self notify( "triggeruse" , player); 
    				//} 
    			}
    		} 
    		wait .045; 
    	} 
    }
    
    ResetDoors(open, hp) 
    { 
    	while(1) 
    	{ 
    		level waittill("RESETDOORS"); 
    		self.hp = hp; 
    		self MoveTo(open, level.doorwait); 
    		self.state = "open"; 
    	} 
    }
    Teleport Flags
    -Model not working correctly but function is.

    Code:
    CreateElevator(enter, exit, angle, notantycamp, range) 
    { 
    	if(!level.CreateBunkers) return;
    	if(!isDefined(notantycamp)) notantycamp = true;
    	if(!isDefined(range)) range = 75;
    	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, range); 
    }  
     
    ElevatorThink(enter, exit, angle, range) 
    { 
    	self endon("disconnect"); 
    	while(1) 
    	{ 
    		for(i=0;i<level.players.size;i++)
    		{ 
    			player = level.players[i];
    			if(Distance(enter, player.origin) <= range){ 
    					player SetOrigin(exit); 
    					player SetPlayerAngles(angle); 
    			} 
    		}
    		wait .25; 
    	} 
    }
    Ramps

    Code:
    CreateRamps(top, bottom)
    {
    	if(!level.CreateBunkers) return;
    	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)), 1);
    		block setModel( level.crateModelFriendly );	
    		block.angles = BA;
    		wait 0.01;
    	}
    	block = spawn("script_model", (bottom + ((XA, YA, ZA) * blocks) - (0, 0, 5)), 1);
    	block setModel( level.crateModelFriendly );	
    	block.angles = (BA[0], BA[1], 0);
    	wait 0.01;
    }
    Grids

    Code:
    CreateGrids(corner1, corner2, angle)
    {
    	if(!level.CreateBunkers) return;
    	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)), 1);
    				block setModel( level.crateModelFriendly );	
    				block.angles = (0, 0, 0);
    			    block LinkTo(center);
    				wait 0.01;
    			}
    		}
    	}
    	center.angles = angle;
    }
    Walls

    Code:
    CreateWalls(start, end)
    {
    	if(!level.CreateBunkers) return;
    	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)), 1);
    		block setModel( level.crateModelFriendly );	
    		block.angles = Angle;
    		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)), 1);
    			block setModel( level.crateModelFriendly );	
    			block.angles = Angle;
    			wait 0.001;
    		}
    		block = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)), 1);
    		block setModel( level.crateModelFriendly );	
    		block.angles = Angle;
    		wait 0.001;
    	}
    }
    Cluster

    Code:
    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), 1 );
    		block setModel( level.crateModelFriendly );	
    		block.angles = (90, 0, 0);
    		//block PhysicsLaunchServer((0, 0, 0), power);
    		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();
    }
    Floatval

    Code:
    roundUp( floatVal )
    {
    	if ( int( floatVal ) != floatVal )
    		return int( floatVal+1 );
    	else
    		return int( floatVal );
    }
    Credits:
    AoR
    I Am on this site for the mods for mw2 ONLY. Not hacks.

  2. The Following 2 Users Say Thank You to xbeatsszzx For This Useful Post:

    Jasperdepasper (01-18-2011),YuDi21 (02-04-2011)

  3. #2
    Jasperdepasper's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    C:\MPGH<3\Jasperdepasper™
    Posts
    234
    Reputation
    17
    Thanks
    150
    My Mood
    Fine
    Thanx Its just what i needed
    Jasperdepasper™
    MPGH<3


    Code:
          _                              _                                      
         |M|                            | |                                     
         |P| __ _ ___ _ __   ___ _ __ __| | ___ _ __   __ _ ___ _ __   ___ _ __ 
     _   |G|/ _` / __| '_ \ / _ \ '__/ _` |/ _ \ '_ \ / _` / __| '_ \ / _ \ '__|
    |☺|__|H| (_| \__ \ |_) |  __/ | | (_| |  __/ |_) | (_| \__ \ |_) |  __/ |   
     \MPGH/ \__,_|___/ .__/ \___|_|  \__,_|\___| .__/ \__,_|___/ .__/ \___|_|©  
                     | |                       | |             | |              
                     |_|                       |_|             |_|
    Code:
     __  __ _____   _____ _    _ 
    |Ja\/sp|erdep\ /asper|!|  |!|
    |M\☺☺/M|M|__)☺|L|  __|M|__|M|
    |P|\/|P|P LOL/|O| |!L|P ☺☺ P|
    |G|  |G|G|    |L|__|O|G|  |G|
    |H|  |H|H|     \MPGHL|H|  |H

  4. #3
    alistair4322's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    229
    Reputation
    14
    Thanks
    31
    My Mood
    Goofy
    You miss so much function...Where is CreateAmmoBox and other stuff?

  5. The Following User Says Thank You to alistair4322 For This Useful Post:

    Skyline. (02-03-2011)

  6. #4
    ferryadams11's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    1
    My Mood
    Cool
    hey assasinate3d,

    I appriciate ur work but could u maybe help me with a problem with this cause I can't make that models of u be able to get spawned.

    greetzz FerryAdams10

  7. #5
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,923
    Reputation
    161
    Thanks
    3,096
    No bumping plox.

    /closed