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-07-2014, 03:05 PM #38
alex-_-123
Do a barrel roll!
Originally posted by jwm614 View Post
i just got the moving crate working but i gota link the player to it yet

    movingcrate()
{
self endon("death");
self endon("doneforge");
for(;Winky Winky
{
self waittill("weapon_fired");
pos1=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
wait 1;
self waittill("weapon_fired");
pos2=self.origin;
wait .1;
self iPrintln("^2Position Marked!");
self iPrintlnBold("^2Creating Moving Plateform...");
wait 2;
angle = (0,0,0);
level thread CreateAsc(pos1,pos2,angle,5);
self iPrintln("^2Moving crate Done!");
self notify("doneforge");
}
}

CreateAsc(depart,arivee,angle,time1)
{

self.Asc=spawn("script_model",depart);
self.Asc setModel("t6_wpn_supply_drop_ally");
self.Asc.angles=angle;


self thread Escalator(depart,arivee,time1);

}

Escalator(depart,arivee,time1)
{
while(1)
{

if(self.state=="open")
{

self.Asc moveTo(arivee,time1);
wait(time1*3);
self.state ="close";
continue;
}
if(self.state=="close")
{
self.Asc moveTo(depart,time1);
wait(time1*3);
self.state ="open";
continue;
}
}
}

Also if you don't mind could I add you on Skype need to show you something. My Skype = "alex_megablock". Don't judge the name :P
10-07-2014, 10:24 PM #39
jwm614
NextGenUpdate Elite
Originally posted by 123 View Post
Also if you don't mind could I add you on Skype need to show you something. My Skype = "alex_megablock". Don't judge the name :P


Yea add me Jwm614

I'll add you wen I get home
10-08-2014, 03:00 AM #40
CrEaTiiOn_420
Can’t trickshot me!
Originally posted by 123 View Post
Yo I would like the trampoline you put in one of your posts but you don't seem to have converted it, I did convert it but I am getting a script function overflow error (I think, I had a friend tell me) and don't know how to fix that.


send me the converted code and ill fix the overflow problem
10-08-2014, 02:48 PM #41
alex-_-123
Do a barrel roll!
Originally posted by 420 View Post
send me the converted code and ill fix the overflow problem



locationSelector()
{
self endon("disconnect");
self endon("death");

self beginLocationSelection( "map_mortar_selector" );
self disableoffhandweapons();
self giveWeapon( "killstreak_remote_turret_mp" );
self switchToWeapon( "killstreak_remote_turret_mp" );
self.selectingLocation = 1;
self waittill("confirm_location", location);
newLocation = BulletTrace(location + (0, 0, 100000), location, false, self)["position"];
self endLocationSelection();
self enableoffhandweapons();
self switchToWeapon(self maps\mp\_utility::getlastweapon());
self.selectingLocation = undefined;
return newLocation;

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo