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-23-2011, 01:35 AM #11
Originally posted by dill1259 View Post
Hey I have just tried this and got an error?


I can assure you it works fine. I have tried it on both my pc and my ps3. Your gsc might be too full or you're not adding it right.
02-23-2011, 01:44 AM #12
dill1259
Do a barrel roll!
I Am sure a am adding it right I am testing it on PC, when i removed it the patch worked fine Lol
02-23-2011, 01:47 AM #13
Originally posted by dill1259 View Post
I Am sure a am adding it right I am testing it on PC, when i removed it the patch worked fine Lol


ok, hold on one second.
02-23-2011, 01:49 AM #14
Woof
...hmm
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;
}
}

you can make my function more optimized Winky Winky
Thanks for the credit aswell, nice to see at-least 1 non-leach lol
02-23-2011, 01:51 AM #15
Originally posted by BadMan
you can make my function more optimized Winky Winky
Thanks for the credit aswell, nice to see at-least 1 non-leach lol


lol I hate leachers and yea, I'm going to optimize it some more, but it's a little buggy, so I'm just trying to fix it up first :P

---------- Post added at 08:51 PM ---------- Previous post was at 08:51 PM ----------

Originally posted by dill1259 View Post
I Am sure a am adding it right I am testing it on PC, when i removed it the patch worked fine Lol


try it now
02-23-2011, 01:52 AM #16
dill1259
Do a barrel roll!
Ok Give Me 1 min
02-23-2011, 01:54 AM #17
Woof
...hmm
Originally posted by FourzerotwoFAILS View Post
lol I hate leachers and yea, I'm going to optimize it some more, but it's a little buggy, so I'm just trying to fix it up first :P

---------- Post added at 08:51 PM ---------- Previous post was at 08:51 PM ----------



try it now

its because the console has to remember the codes cause there not actually written on the patch.
hint, just make sure you have somewhere for them to go Winky Winkynon-loop
02-23-2011, 01:56 AM #18
pcfreak30
>> PCFreak30.com Happy<<
Hmm, this really reminds me of my shape shitter code. I am curious as to where it went, as it was the only forge patch I assisted in making with Antic on 7s.

This could be improved though..

---------- Post added at 08:56 PM ---------- Previous post was at 08:55 PM ----------

Originally posted by BadMan
its because the console has to remember the codes cause there not actually written on the patch.
hint, just make sure you have somewhere for them to go Winky Winkynon-loop


Um that didn't exactly make sense?
02-23-2011, 01:58 AM #19
Originally posted by BadMan
its because the console has to remember the codes cause there not actually written on the patch.
hint, just make sure you have somewhere for them to go Winky Winkynon-loop


lol wut????

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo