Post: [CODE] A Slightly more advanced forge mode
03-23-2011, 11:15 PM #1
-Whiteboy-
┌∩┐ (◣◢Winky Winky┌∩┐
(adsbygoogle = window.adsbygoogle || []).push({}); For anyone on pc and likes forge mode here you go...



Im not the first to make a forge mode where you can rotate an entity but i don't think anyone has relased one either, so that's why i made this. Its not perfect but you can rotate any entity you pick up, in any direction. The spawning of carepackages next to or in front of the care package your holding isn't perfect either... but its good for making ramps or floors.

    ForgeMode()
{
if(self.Forge)
{
self notify("StopForge");
self.Forge=0;
self iprintlnbold( "^0Forge Mode ^1Disabled" );
}
else
{
self.Forge=1;
self iprintlnbold( "^0Forge Mode ^2Enabled" );
self thread PickupCrate();
self thread SpawnCrate();
self takeallweapons();
self thread maps\mp\gametypes\_hud_message::hintMessage( "While Standing, Press [{+actionslot 2}] to Spawn a Crate" );
wait 5;
self thread maps\mp\gametypes\_hud_message::hintMessage( "Press [{+usereload}] to Move and Drop a Crate" );
}
}

SpawnCrate()
{
self endon( "death" );
self endon( "StopForge" );
for( ;; )
{
self waittill( "dpad_down" );
if ( self GetStance() == "stand" )
{
vec = anglestoforward( self getPlayerAngles() );
end = ( vec[0]*200, vec[1]*200, vec[2]*200 );
Location = BulletTrace( self gettagorigin( "tag_eye" ), self gettagorigin( "tag_eye" )+end, 0, self )[ "position" ];
Crate = spawn( "script_model", Location+( 0, 0, 20 ) );
Crate setModel( "com_plasticcase_enemy" );
Crate CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
Crate PhysicsLaunchServer( ( 0, 0, 0 ),( 0, 0, 0 ) );
Crate.health = 250;
self thread crateManageHealth( Crate );
self.ugp--;
}
wait .5;
}
}

PickupCrate()
{
self endon( "death" );
self endon( "StopForge" );
for( ;; )
{
self waittill( "button_square" );
if( !self.MenuOpen )
{
vec = anglestoforward( self getPlayerAngles() );
Entity = BulletTrace( self gettagorigin( "tag_eye" ), self gettagorigin( "tag_eye" )+( vec[0]*200, vec[1]*200, vec[2]*200 ), 0, self)[ "entity" ];
Entity.health = 250;
if( isdefined( entity.model ) )
{
self thread CrateRotate( Entity );
self thread MoveCrate( Entity );
self thread SpawnCrate2 ( Entity );
self thread crateManageHealth( Entity );
self waittill( "button_square" );
{
self notify( "Stop" );
self.moveSpeedScaler = 1;
self maps\mp\gametypes\_weapons::updateMoveSpeedScale( "primary" );
self thread Origin( Entity );
}
}
}
}
}

SpawnCrate2( Entity )
{
self endon( "death" );
self endon( "StopForge" );
self endon( "Stop" );
for(;Winky Winky
{
for( i = 1; i <= 55; i++ )
{
self notifyOnPlayerCommand( "down", "+actionslot 2" );
self waittill( "down" );
if ( self GetStance() == "crouch" )
{
Crate = spawn( "script_model", Entity.origin+( i* ( 55 ), 0, 0 ) );
Crate setModel( "com_plasticcase_friendly" );
Crate.angles = Entity.angles;
Crate LinkTo( Entity );
Crate CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
Crate.health = 250;
self thread SpawnCrate3 ( entity, Crate );
self thread SpawnCrate4 ( entity, Crate );
self thread crateManageHealth( Crate );
}
}
wait .5;
}
}

SpawnCrate3( Entity, Crate )
{
self endon( "death" );
self endon( "StopForge" );
self endon( "Stop" );
for(;Winky Winky
{
for( i = 1; i <= 28; i++ )
{
self notifyOnPlayerCommand( "right", "+actionslot 4" );
self waittill( "right" );
if ( self GetStance() == "crouch" )
{
level.Crate = [];
level.Crate[1] = spawn( "script_model", Crate.origin+( 0, i*( 28 ), 0 ) );
level.Crate[2] = spawn( "script_model", Entity.origin+( 0, i*( 28 ), 0 ) );
foreach( Crate2 in level.Crate )
{
Crate2 setModel( "com_plasticcase_friendly" );
Crate2.angles = Entity.angles;
Crate2 LinkTo( Entity );
Crate2 CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
Crate2.health = 250;
self thread crateManageHealth( Crate2 );
}
}
}
wait .5;
}
}

SpawnCrate4( Entity, Crate )
{
self endon( "death" );
self endon( "StopForge" );
self endon( "Stop" );
self notifyOnPlayerCommand( "left", "+actionslot 3" );
for(;Winky Winky
{
for( i = 1; i <= 28; i++ )
{
self waittill( "left" );
if ( self GetStance() == "crouch" )
{
level.Crate = [];
level.Crate[1] = spawn( "script_model", Crate.origin+( 0, i*( -28 ), 0 ) );
level.Crate[2] = spawn( "script_model", Entity.origin+( 0, i*( -28 ), 0 ) );
foreach( Crate2 in level.Crate )
{
Crate2 setModel( "com_plasticcase_friendly" );
Crate2.angles = Entity.angles;
Crate2 LinkTo( Entity );
Crate2 CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
Crate2.health = 250;
self thread crateManageHealth( Crate2 );
}
}
}
wait .5;
}
}

Origin( Entity )
{
self iprintlnbold( "^0Angles Are: ^1"+entity.angles);
wait 3;
self iprintlnbold( "^0Origin Is: ^1"+entity.origin);
}

MoveCrate( Entity )
{
self endon( "button_square" );
for( ;; )
{
vec = anglestoforward( self getPlayerAngles() );
end = ( vec[0]*150, vec[1]*150, vec[2]*150 );
Entity.origin = ( self gettagorigin( "tag_eye" )+end );
self.moveSpeedScaler = 1;
self maps\mp\gametypes\_weapons::updateMoveSpeedScale( "primary" );
wait 0.05;
}
}

CrateRotate( Entity )
{
self endon( "death" );
self endon( "StopForge" );
self endon( "Stop" );
for( ;; )
{
foreach( player in level.players )
{
if( Distance( Entity.origin, player.origin ) < 250 )
{
if( player usebuttonpressed() )
{
Entity RotateYaw( 5, .1 );
}
if( player meleebuttonpressed() )
{
Entity RotateYaw( -5, .1 );
}
if( player fragbuttonpressed() )
{
Entity RotateRoll( 5, .1 );
}
if( player secondaryoffhandbuttonpressed() )
{
Entity RotateRoll( -5, .1 );
}
if( player adsbuttonpressed() )
{
Entity RotatePitch( 5, .1 );
}
if( player attackbuttonpressed() )
{
Entity RotatePitch( -5, .1 );
}
}
}
wait .1;
}
}

CrateManageHealth( Crate, Crate2, Entity )
{
for( ;; )
{
Crate setcandamage( true );
Crate.team = self.team;
Crate.owner = self.owner;
Crate.pers[ "team" ] = self.team;
if( crate.health < 0 )
{
level.chopper_fx[ "smoke" ][ "trail" ] = loadfx ( "fire/fire_smoke_trail_L" );
playfx( level.chopper_fx[ "smoke" ][ "trail" ], Crate.origin );
Crate delete();
}
Crate2 setcandamage( true );
Crate2.team = self.team;
Crate2.owner = self.owner;
Crate2.pers[ "team" ] = self.team;
if( crate2.health < 0 )
{
level.chopper_fx[ "smoke" ][ "trail" ] = loadfx ( "fire/fire_smoke_trail_L" );
playfx( level.chopper_fx[ "smoke" ][ "trail" ], crate2.origin );
Crate2 delete();
}
Entity setcandamage( true );
Entity.team = self.team;
Entity.owner = self.owner;
Entity.pers[ "team" ] = self.team;
if( Entity.health < 0 )
{
level.chopper_fx[ "smoke" ][ "trail" ] = loadfx ( "fire/fire_smoke_trail_L" );
playfx( level.chopper_fx[ "smoke" ][ "trail" ], Entity.origin );
Entity delete();
}
wait 0.1;
}
}

Controls:

Reload, Melee, The Frag Button, the Flashbag button, the ADS button and the fire button all rotate the entity.

While standing, press DOWN to spawn a crate.

While CROUCHED, the down button will spawn a crate in front of the entity (In this case the red carepackage), the left arrow will spawn a crate to the left or the entity and the right arrow will spawn a crate to the right.



A Few Tips:

1. When spawning crates keep the entity angles straight to spawn the crates perfectly with the entity.

2. Spawn crates the legnth you want first then do the width.





If there are any glitches or bugs with this let me know.



Thanks to EliteMossy for the forge mode, i just "advanced" on it.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 9 users say thank you to -Whiteboy- for this useful post:

Woof, Amanda, Chrome Playa, Demmonnixx, iCommander, ImTrippinHoes, LightModz, shawry, XKevin356
03-23-2011, 11:36 PM #2
.JiampyPotter
So Much Win.
Cant wait for this on the 1.12Winky Winky
03-23-2011, 11:41 PM #3
Woof
...hmm
Well done,

Good-
-Nice idea (guessing you dident read my post a year back)
-Seems simple coded (you should optimize it)
Bad-
-Size (like a stated before you should optimize it)
-There is a simpler way to do the rotation (my version is full 360 X Y, in less code)

-Thanked.:rolleyes:
03-24-2011, 12:02 AM #4
Chrome Playa
Chrome Gaming Reloaded
Originally posted by BadMan
Well done,

Good-
-Nice idea (guessing you dident read my post a year back)
-Seems simple coded (you should optimize it)
Bad-
-Size (like a stated before you should optimize it)
-There is a simpler way to do the rotation (my version is full 360 X Y, in less code)

-Thanked.:rolleyes:


If by "year," you mean 1 year ago on NGU, that would be impossible since you joined 2 months ago. Unless you mean on another website. Lol.
03-24-2011, 01:12 AM #5
Woof
...hmm
Originally posted by Chrome
If by "year," you mean 1 year ago on NGU, that would be impossible since you joined 2 months ago. Unless you mean on another website. Lol.

lolas being over dramatic it was about 1-2 weeks before the 1.12 patch i posted it as a repley to your forge patch i think... not sure lol
03-24-2011, 02:11 AM #6
Chrome Playa
Chrome Gaming Reloaded
Originally posted by BadMan
lolas being over dramatic it was about 1-2 weeks before the 1.12 patch i posted it as a repley to your forge patch i think... not sure lol


Oh yea I remember that. I released my Forge v2 right before 1.12 and you told me that you working on a forge mode where you could rotate the carepackage.
03-24-2011, 02:30 AM #7
Generation-
Save Point
Originally posted by Chrome
Oh yea I remember that. I released my Forge v2 right before 1.12 and you told me that you working on a forge mode where you could rotate the carepackage.


i lol'd at your sig for so long lol hahahhh
03-24-2011, 02:38 AM #8
Chrome Playa
Chrome Gaming Reloaded
Originally posted by Generation
i lol'd at your sig for so long lol hahahhh


So did River J, lol. You must login or register to view this content.
03-24-2011, 02:41 AM #9
Generation-
Save Point
Originally posted by Chrome
So did River J, lol. You must login or register to view this content.


lol nextgenerationupdate noob got pwned also You must login or register to view this content.
03-24-2011, 03:52 AM #10
-Whiteboy-
┌∩┐ (◣◢Winky Winky┌∩┐
Originally posted by BadMan
Well done,

Good-
-Nice idea (guessing you dident read my post a year back)
-Seems simple coded (you should optimize it)
Bad-
-Size (like a stated before you should optimize it)
-There is a simpler way to do the rotation (my version is full 360 X Y, in less code)

-Thanked.:rolleyes:


How can i make this more optimized?

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo