Post: Some Forge Codes
10-05-2014, 04:02 PM #1
alex-_-123
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Credits to Taylor for the amazing YARDSALE patch in the good old mw2 days, which is where I got the code from to convert. Smile
Edit: I know that the elevator doesn't work properly if someone wants to get it workin i will add it to the thread and provide credits. Thanks!


Make sure to add these to init()
precacheModel("t6_wpn_supply_drop_ally");
precacheModel("mp_flag_green");
precacheModel("mp_flag_red");


    
ForgeRamp()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self iPrintlnBold("^2Go To The Start Position Of The Ramp \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self iPrintlnBold("^2Go To The End Position Of The Ramp \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Ramp...");
wait 2;
level thread CreateRamp(pos1,pos2);
self iPrintln("^2Ramp Done!");
self notify("doneforge");
}
}




CreateRamp(top,bottom)
{
D=Distance(top,bottom);
blocks=xxroundUp(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("t6_wpn_supply_drop_ally");
block.angles=BA;
blockb=spawn("trigger_radius",(0,0,0),0,65,30);
blockb.origin=block.origin+(0,0,5);
blockb.angles=BA;
blockb setContents(1);
wait 0.01;
}
block=spawn("script_model",(bottom +((XA,YA,ZA)* blocks)-(0,0,5)));
block setModel("t6_wpn_supply_drop_ally");
block.angles =(BA[0],BA[1],0);
blockb=spawn("trigger_radius",(0,0,0),0,65,30);
blockb.origin=block.origin+(0,0,5);
blockb.angles =(BA[0],BA[1],0);
blockb setContents(1);
wait 0.01;
}



ForgeWall()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self iPrintlnBold("^2Go To The Start Position Of The Wall \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self iPrintlnBold("^2Go To The End Position Of The Wall \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Wall...");
wait 2;
level thread CreateWall(pos1,pos2);
self iPrintln("^2Wall Done!");
self notify("doneforge");
}
}




CreateWall(top,bottom)
{
blockb=[];
blockc=[];
D=Distance((top[0],top[1],0),(bottom[0],bottom[1],0));
H=Distance((0,0,top[2]),(0,0,bottom[2]));
blocks=xxroundUp(D / 40);
height=xxroundUp(H / 40);
CX=bottom[0] - top[0];
CY=bottom[1] - top[1];
CZ=bottom[2] - top[2];
XA=CX / blocks;
YA=CY / blocks;
ZA=CZ / height;
TXA=(XA / 4);
TYA=(YA / 4);
Temp=VectorToAngles(bottom - top);
BA =(0,Temp[1],90);
for(h=0;h < height;h++)
{
fstpos=(top+(TXA,TYA,10)+((0,0,ZA)* h));
block=spawn("script_model",fstpos);
block setModel("t6_wpn_supply_drop_ally");
block.angles=BA;
blockb[h]=spawn("trigger_radius",(0,0,0),0,75,40);
blockb[h].origin=fstpos;
blockb[h].angles=BA;
blockb[h] setContents(1);
wait 0.001;
for(i=0;i < blocks;i++)
{
secpos=(top +((XA,YA,0)* i)+(0,0,10)+((0,0,ZA)* h));
block=spawn("script_model",secpos);
block setModel("t6_wpn_supply_drop_ally");
block.angles =BA;
blockc[i]=spawn("trigger_radius",(0,0,0),0,75,40);
blockc[i].origin=secpos;
blockc[i].angles=BA;
blockc[i] setContents(1);
wait 0.001;
}
}
}


ForgeGrids()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self iPrintlnBold("^2Go To The Start Position Of Grid \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self iPrintlnBold("^2Go To The End Position Of Grid \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Grid...");
wait 2;
level thread CreateGrids(pos1,pos2);
self iPrintln("^2Grid Done!");
self notify("doneforge");
}
}


CreateGrids(corner1,corner2,angle)
{
blockfloor=[];
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=xxroundUp(W / 40);
COLUMNS=xxroundUp(L / 55);
HEIGHT=xxroundUp(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++)
{
floor=(corner1 +(XA * r, YA * c, ZA * h));
block=spawn("script_model",floor);
block setModel("t6_wpn_supply_drop_ally");
block.angles =(0,0,0);
block LinkTo(center);
blockfloor[h]=spawn("trigger_radius",(0,0,0),0,65,30);
blockfloor[h].origin=floor;
blockfloor[h].angles=(0,90,0);
blockfloor[h] setContents(1);
}
}
}
center.angles=angle;
}



ForgeTele()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self iPrintlnBold("^2Go To The Start Position Of The Teleporter \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self iPrintlnBold("^2Go To The End Position Of The Teleporter \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Teleporter...");
wait 2;
level thread CreateFlag(pos1,pos2);
self iPrintln("^2Elevator Done!");
self notify("doneforge");
}
}


CreateFlag(enter,exit,vis,radius,angle)
{
if(!isDefined(vis))vis=0;
if(!isDefined(angle))angle =(0,0,0);
flag=spawn("script_model",enter);
flag setModel("mp_flag_green");
flag.angles=angle;
if(vis==0)
{
col="objective";
flag xxshowInMap(col);
wait 0.01;
flag=spawn("script_model",exit);
flag setModel("mp_flag_red");
}
wait 0.01;
self thread xxElevatorThink(enter,exit,radius,angle);
}
xxElevatorThink(enter,exit,radius,angle)
{
level endon("GEND");
if(!isDefined(radius))radius=50;
while(1)
{
for(i=0;i< level.players.size;i++)
{
p=level.players[i];
if(Distance(enter,p.origin)<= radius)
{
p SetOrigin(exit);
p SetPlayerAngles(angle);
if(p.team=="axis")p thread xxSpNorm(0.1,1.7,1);
if(isDefined(p.elvz))p.elvz++;
}
}
wait .5;
}
}
xxshowInMap(shader)
{
}


xxSpNorm(slow,time,acc,li)
{
self endon("death");
self endon("disconnect");
if(!isDefined(li))li=0;
if(self.lght==1 && li==0)return;
if(!isDefined(acc))acc=0;
self SetMoveSpeedScale(slow);
wait time;
for(;Winky Winky
{
if(acc==0)break;
slow =(slow + 0.1);
self SetMoveSpeedScale(slow);
if(slow==1.0)break;
wait .15;
}
self thread xxLWSP();
}
xxLWSP()
{
self SetMoveSpeedScale(1.0);
if(self.lght==1)self SetMoveSpeedScale(1.4);
}








ForgeLifts()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self iPrintlnBold("^2Go To The Start Position Of The Teleporter \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self iPrintlnBold("^2Go To The End Position Of The Teleporter \n^2Press [{+attack}] To Mark");
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Teleporter...");
wait 2;
level thread CreateLift(pos1,pos2);
self iPrintln("^2Elevator Done!");
self notify("doneforge");
}
}


CreateLift(pos,height)
{
lift=spawn("script_model",pos);
lift setModel("t6_wpn_supply_drop_axis");
wait .05;
lift.angles =(0,0,270);
wait .05;
lift thread ForgeLiftUp(pos,height);
}
ForgeLiftUp(pos,height)
{
level endon("GEND");
while(1)
{
players=level.players;
for(index=0;index < players.size;index++)
{
player=players[index];
if(Distance(pos,player.origin)<= 50)
{
player setOrigin(pos);
player thread ForgeLiftAct(pos,height);
wait 3;
}
wait 0.01;
}
wait 1;
}
}
ForgeLiftAct(pos,height)
{
self endon("death");
self endon("disconnect");
self endon("ZBSTART");
self.liftz=1;
posa=self.origin;
fpos=posa[2] + height;
h=0;
for(j=1;self.origin[2] < fpos;j+=j)
{
if(j > 130)j=130;
h=h+j;
self SetOrigin((pos)+(0,0,h));
wait .1;
}
vec=anglestoforward(self getPlayerAngles());
end =(vec[0] * 160,vec[1] * 160,vec[2] * 10);
self SetOrigin(self.origin + end);
wait .2;
posz=self.origin;
wait 4;
self.liftz=0;
if(self.origin==posz)self SetOrigin(posa);
}

xxroundUp(floatVal)
{
if(int(floatVal)!= floatVal)return int(floatVal+1);
else return int(floatVal);
}



Credits to SyGnUs for the spawn weapon code i just made it so it spawns the ballista in the position where you are standing when you shoot. Smile
But make sure to add this to one of your sub menu's!
    
self add_option("Forge", "Spawn Ballista", ::doWeapon);



    
SpawnWeapon(WFunc,Weapon,WeaponName,Location,TakeOnce)
{
self endon("disconnect");
weapon_model = getWeaponModel(Weapon);
if(weapon_model=="")weapon_model=Weapon;
Wep=spawn("script_model",Location+(0,0,0));
Wep setModel(weapon_model);
for(;Winky Winky
{
foreach(player in level.players)
{
Radius=distance(Location,player.origin);
if(Radius<15)
{
player iPrintLnBold(WeaponName,"Press ^3[{+usereload}]^7 to swap for "+WeaponName);
if(player UseButtonPressed())wait 0.2;
if(player UseButtonPressed())
{
if(!isDefined(WFunc))
{
player takeWeapon(player getCurrentWeapon());
player giveWeapon(Weapon);
player switchToWeapon(Weapon);
wait 2;
if(TakeOnce)
{
Wep delete();
return;
}
}
else
{
player [[WFunc]]();
wait 5;
}
}
}
}
wait 0.5;
}
}





doWeapon()
{
self endon("death");
self endon("doneweapon");
for(;Winky Winky
{
self iPrintlnBold("^2Press [{+attack}] To Mark Spawn Location");
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 2;
self thread SpawnWeapon(undefined,"ballista_mp","Press ^3[{+usereload}]^7 to swap for Ballista",pos1,0);
self iPrintln("^2Weapon Spawned");
self notify("doneweapon");
}
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to alex-_-123 for this useful post:

-Numb, iifire, Loz, My Ninja Defuse, TehMerkMods, Tipton_Modz

The following user groaned alex-_-123 for this awful post:

John
10-05-2014, 04:11 PM #2
Geo
Don't Believe The Title
Need to go back and revise the
     and [SPOILER] options tears
10-05-2014, 04:26 PM #3
alex-_-123
Do a barrel roll!
How do i add them? lol
10-05-2014, 04:37 PM #4
Freeze
10-05-2014, 04:42 PM #5
alex-_-123
Do a barrel roll!
Originally posted by x0ptic0ns100 View Post
Freeze

It's probably because of the smiley's on ngu try now that i have added it to a
     tag
10-05-2014, 04:43 PM #6
ReFleX MoDzZ
Error… Cat invasion!
Originally posted by 123 View Post
It's probably because of the smiley's on ngu try now that i have added it to a
     tag[/QUOTE]

u dont freeze?
10-05-2014, 04:45 PM #7
alex-_-123
Do a barrel roll!
Originally posted by ReFleX
u dont freeze?

Nope, I'm using sharks menu base with my advanced forge which i posted on itsLollo's thread.
10-05-2014, 04:48 PM #8
ReFleX MoDzZ
Error… Cat invasion!
Originally posted by 123 View Post
Nope, I'm using sharks menu base with my advanced forge which i posted on itsLollo's thread.


ok uhm whats your skype? maybe u can help me cuz i freeze
10-05-2014, 04:53 PM #9
alex-_-123
Do a barrel roll!
Originally posted by ReFleX
ok uhm whats your skype? maybe u can help me cuz i freeze

My Skype is alex_megablocks i don't know whether I'll be able to help because I don't know what's wrong, I haven't froze yet, online on ps3 with friends.
10-05-2014, 05:24 PM #10
I am still freezing

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo