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");
}
}
Last edited by alex-_-123 ; 10-07-2014 at 03:21 PM. Reason: Added Spawn Weapon With credits :)

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, 05:28 PM #11
***1 script error(s):
solve function "xxroundup"in
maps/mp/gametypes/_clientids.gsc


-Help me???
10-05-2014, 05:28 PM #12
alex-_-123
Do a barrel roll!
Originally posted by x0ptic0ns100 View Post
I am still freezing

Sorry guys i forgot to add some code!
10-05-2014, 05:34 PM #13
Now it seems to work!
10-05-2014, 05:35 PM #14
alex-_-123
Do a barrel roll!
Originally posted by x0ptic0ns100 View Post
Now it seems to work!

Thanks for the info! Happy
10-05-2014, 05:45 PM #15
Thirst
Error… Cat invasion!
Someone mind posting their .gsc code? I'm having some trouble lol. I've been doing everything correctly yet I freeze? (or atleast I think I am)

EDIT: NVM, I didn't get the full code since you just edited it lol.
Last edited by Thirst ; 10-05-2014 at 05:55 PM.
10-05-2014, 06:04 PM #16
Originally posted by Thirst View Post
Someone mind posting their .gsc code? I'm having some trouble lol. I've been doing everything correctly yet I freeze? (or atleast I think I am)

EDIT: NVM, I didn't get the full code since you just edited it lol.


how did u get it working?
10-05-2014, 06:11 PM #17
Thirst
Error… Cat invasion!
Originally posted by Unboundh4x View Post
how did u get it working?


It's easy, got a Skype? I'll help you out ^^
10-05-2014, 07:45 PM #18
Thanks for posting this
10-05-2014, 07:45 PM #19
Originally posted by Thirst View Post
It's easy, got a Skype? I'll help you out ^^


Jurriaan.kolk is my skype

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo