Post: {How To}Smaller Code for Forcefields
02-22-2011, 09:48 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Well this is a very smaller version of the forcefield code. All it will do is place a forcefield. The only way to remove it is by fast restarting the map or ending the game. Also, you will be able to choose where to build one while in game.

Thanks to:

-BadMan- for the in game building function
Hawkin for the forcefield code
Me for putting it all together :P
JordyPordy_94 for some help


Just Call ::Force from your menu
    
Force(){
self endon("jw");
self iPrintLnBold( "Please press down at starting persission of [^1WALL^7]" );
self notifyOnPlayerCommand( "SL", "+actionslot 2" );
for(;Winky Winky{
self waittill("SL");
st = self getOrigin();
self iPrintLn("Start persission saved.");
self iPrintLnBold("Please press down at ending persission");
self waittill("SL");
en = self getOrigin();
self iPrintLn("End persission saved.");
self iPrintLnBold("ready, press down to start build.");
self waittill("SL");
self iPrintLn("started....");
CreateForce((st), (en));
self iPrintLn("Done.");
self notify("jw");
}}
CreateForce(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( level.chopper_fx["light"]["belly"] );
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( level.chopper_fx["light"]["belly"] );
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( level.chopper_fx["light"]["belly"] );
block.angles = Angle;
block Solid();
block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
wait 0.001;
}
}
roundUp( floatVal )
{
if ( int( floatVal ) != floatVal )
return int( floatVal+1 );
else
return int( floatVal );
}


Even Smaller!
    
Force(){ self endon("jw"); self iPrintLnBold( "Please press down at starting persission of [^1WALL^7]" ); self notifyOnPlayerCommand( "SL", "+actionslot 2" ); for(;Winky Winky{ self waittill("SL"); st = self getOrigin(); self iPrintLn("Start persission saved."); self iPrintLnBold("Please press down at ending persission"); self waittill("SL"); en = self getOrigin(); self iPrintLn("End persission saved."); self iPrintLnBold("ready, press down to start build."); self waittill("SL"); self iPrintLn("started...."); CreateForce((st), (en)); self iPrintLn("Done."); self notify("jw"); }}CreateForce(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( level.chopper_fx["light"]["belly"] );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( level.chopper_fx["light"]["belly"] ); 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( level.chopper_fx["light"]["belly"] );block.angles = Angle; block Solid(); block CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; } }roundUp( floatVal ) { if ( int( floatVal ) != floatVal ) return int( floatVal+1 ); else return int( floatVal ); }


-BadMan-'s even smaller code:
    
force(){
self iPrintLn( "choose starting persission" );
self notifyOnPlayerCommand( "g", "+actionslot 2" );
self waittill("g");st = self getOrigin();self iPrintLn("choose ending persission");
self waittill("g");en = self getOrigin();self iPrintLn("ready, press down to start build.");
self waittill("g");Cforce(st, en);self iPrintLn("Done.");
}}
CForce(start,end){
D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
H = Distance((0, 0, start[2]), (0, 0, end[2]));
b = roundUp(D/55);
h = roundUp(H/30);
CX = end[0] - start[0]; CY = end[1] - start[1]; CZ = end[2] - start[2]; XA = (CX/b); YA = (CY/b); ZA = (CZ/h); TXA = (XA/4); TYA = (YA/4);
Temp = VectorToAngles(end - start);
Angle = (0, Temp[1], 90); for(h = 0; h < h; h++){
b = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h))); b setModel( level.chopper_fx["light"]["belly"] );b.angles = Angle;
b Solid();
b CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; for(i = 1; i < b; i++){
b = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h))); b setModel( level.chopper_fx["light"]["belly"] );
b.angles = Angle; b Solid(); b CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; }
b = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
b setModel( level.chopper_fx["light"]["belly"] );b.angles = Angle; b Solid(); b CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
wait 0.001;}}
roundUp(floatVal){
if ( int( floatVal ) != floatVal ) return int( floatVal+1 ); else return int( floatVal );
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 4 users say thank you to FourzerotwoFAILS for this useful post:

agtiger, JordyPordy, CHAOZ, Skyl1n3
02-24-2011, 09:23 PM #29
Originally posted by BadMan
no it should not be that.. look at the function.
    CreateForce[COLOR="Red"](start,end)[/COLOR]


were the error would take place on this... | = error
    CreateForce(st)[COLOR="Red"]|[/COLOR], [COLOR="Red"]|[/COLOR](en);


The way I fixed made it work, so maybe it works both ways.
02-25-2011, 06:16 AM #30
Woof
...hmm
Originally posted by FourzerotwoFAILS View Post
The way I fixed made it work, so maybe it works both ways.

yea they work, but they slow down the process and give dramatic lag in the game.
02-25-2011, 06:19 AM #31
emsp
Space Ninja
Originally posted by BadMan
yea they work, but they slow down the process and give dramatic lag in the game.


sup buddy!! can u help me?
02-25-2011, 06:30 AM #32
Woof
...hmm
Originally posted by emsp View Post
sup buddy!! can u help me?

yea sure, im free all day Outie
02-25-2011, 06:35 AM #33
emsp
Space Ninja
Originally posted by BadMan
yea sure, im free all day Outie


yay!! lol i just need help with the patch im editing lol..

i want to be able to spawn the random box from mossy or someone

and Pack A Punch

i just got Tactical Insertions to work!! lol but i cant get those to i also got doors to work yesterday but they will only work on TDM and only one door closes and it dose it by its self but im just care about

Pack a Punch and the box
02-25-2011, 06:36 AM #34
Woof
...hmm
Originally posted by emsp View Post
yay!! lol i just need help with the patch im editing lol..

i want to be able to spawn the random box from mossy or someone

and Pack A Punch

i just got Tactical Insertions to work!! lol but i cant get those to i also got doors to work yesterday but they will only work on TDM and only one door closes and it dose it by its self but im just care about

Pack a Punch and the box


just PM me the codes with problems..
02-25-2011, 06:38 AM #35
emsp
Space Ninja
Originally posted by BadMan
just PM me the codes with problems..


k one sec to short
02-25-2011, 08:30 AM #36
Beta-
< ^ > < ^ >
Originally posted by FourzerotwoFAILS View Post
Well this is a very smaller version of the forcefield code. All it will do is place a forcefield. The only way to remove it is by fast restarting the map or ending the game. Also, you will be able to choose where to build one while in game.

Thanks to:

-BadMan- for the in game building function
Hawkin for the forcefield code
Me for putting it all together :P
JordyPordy_94 for some help


Just Call ::Force from your menu
    
Force(){
self endon("jw");
self iPrintLnBold( "Please press down at starting persission of [^1WALL^7]" );
self notifyOnPlayerCommand( "SL", "+actionslot 2" );
for(;Winky Winky{
self waittill("SL");
st = self getOrigin();
self iPrintLn("Start persission saved.");
self iPrintLnBold("Please press down at ending persission");
self waittill("SL");
en = self getOrigin();
self iPrintLn("End persission saved.");
self iPrintLnBold("ready, press down to start build.");
self waittill("SL");
self iPrintLn("started....");
CreateForce((st), (en));
self iPrintLn("Done.");
self notify("jw");
}}
CreateForce(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( level.chopper_fx["light"]["belly"] );
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( level.chopper_fx["light"]["belly"] );
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( level.chopper_fx["light"]["belly"] );
block.angles = Angle;
block Solid();
block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
wait 0.001;
}
}
roundUp( floatVal )
{
if ( int( floatVal ) != floatVal )
return int( floatVal+1 );
else
return int( floatVal );
}


Even Smaller!
    
Force(){ self endon("jw"); self iPrintLnBold( "Please press down at starting persission of [^1WALL^7]" ); self notifyOnPlayerCommand( "SL", "+actionslot 2" ); for(;Winky Winky{ self waittill("SL"); st = self getOrigin(); self iPrintLn("Start persission saved."); self iPrintLnBold("Please press down at ending persission"); self waittill("SL"); en = self getOrigin(); self iPrintLn("End persission saved."); self iPrintLnBold("ready, press down to start build."); self waittill("SL"); self iPrintLn("started...."); CreateForce((st), (en)); self iPrintLn("Done."); self notify("jw"); }}CreateForce(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( level.chopper_fx["light"]["belly"] );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( level.chopper_fx["light"]["belly"] ); 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( level.chopper_fx["light"]["belly"] );block.angles = Angle; block Solid(); block CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; } }roundUp( floatVal ) { if ( int( floatVal ) != floatVal ) return int( floatVal+1 ); else return int( floatVal ); }


-BadMan-'s even smaller code:
    
force(){
self iPrintLn( "choose starting persission" );
self notifyOnPlayerCommand( "g", "+actionslot 2" );
self waittill("g");st = self getOrigin();self iPrintLn("choose ending persission");
self waittill("g");en = self getOrigin();self iPrintLn("ready, press down to start build.");
self waittill("g");Cforce(st, en);self iPrintLn("Done.");
}}
CForce(start,end){
D = Distance((start[0], start[1], 0), (end[0], end[1], 0));
H = Distance((0, 0, start[2]), (0, 0, end[2]));
b = roundUp(D/55);
h = roundUp(H/30);
CX = end[0] - start[0]; CY = end[1] - start[1]; CZ = end[2] - start[2]; XA = (CX/b); YA = (CY/b); ZA = (CZ/h); TXA = (XA/4); TYA = (YA/4);
Temp = VectorToAngles(end - start);
Angle = (0, Temp[1], 90); for(h = 0; h < h; h++){
b = spawn("script_model", (start + (TXA, TYA, 10) + ((0, 0, ZA) * h))); b setModel( level.chopper_fx["light"]["belly"] );b.angles = Angle;
b Solid();
b CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; for(i = 1; i < b; i++){
b = spawn("script_model", (start + ((XA, YA, 0) * i) + (0, 0, 10) + ((0, 0, ZA) * h))); b setModel( level.chopper_fx["light"]["belly"] );
b.angles = Angle; b Solid(); b CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.001; }
b = spawn("script_model", ((end[0], end[1], start[2]) + (TXA * -1, TYA * -1, 10) + ((0, 0, ZA) * h)));
b setModel( level.chopper_fx["light"]["belly"] );b.angles = Angle; b Solid(); b CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
wait 0.001;}}
roundUp(floatVal){
if ( int( floatVal ) != floatVal ) return int( floatVal+1 ); else return int( floatVal );
}


is this using Dereks invisible Care Packages?

---------- Post added at 03:29 AM ---------- Previous post was at 03:29 AM ----------

Originally posted by FourzerotwoFAILS View Post
Well this is a very smaller version of the forcefield code. All it will do is place a forcefield. The only way to remove it is by fast restarting the map or ending the game. Also, you will be able to choose where to build one while in game.

Thanks to:

-BadMan- for the in game building function
Hawkin for the forcefield code
Me for putting it all together :P
JordyPordy_94 for some help


Just Call ::Force from your menu
    
Force(){
self endon("jw");
self iPrintLnBold( "Please press down at starting persission of [^1WALL^7]" );
self notifyOnPlayerCommand( "SL", "+actionslot 2" );
for(;Winky Winky{

}


is this using Dereks invisible Care Packages?

---------- Post added at 03:30 AM ---------- Previous post was at 03:29 AM ----------

Originally posted by FourzerotwoFAILS View Post
hi


is this using Dereks invisible Care Packages?

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo