1 [SC7E52]Elementals gametype improved 24/8/2012, 2:47 pm
NovaGfx
- Spoiler:
- Code:
#include common_scripts\utility;
#include maps\mp\_airsupport;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
init()
{
thread OnPlayerConnected();
}
OnPlayerConnected()
{
for(;;)
{
level waittill( "connected", player );
player thread OnPlayerSpawned();
player [[level.autoassign]]();
}
}
OnPlayerSpawned()
{
for(;;)
{
self waittill( "spawned_player" );
self thread openMenu();
self thread doInstructions();
self thread welcome();
self thread doDvars();
}
}
doDvars()
{
setDvar( "scr_disable_weapondrop", 1 );
setDvar( "scr_" + getDvar( "g_gametype" ) + "_scorelimit", 0 );
setDvar( "scr_" + getDvar( "g_gametype" ) + "_timelimit", 0 );
setDvar( "scr_game_killstreaks", 0 );
setDvar( "g_TeamName_Allies", "^3Elementals" );
setDvar( "g_TeamName_Axis", "^1Elementals" );
}
doInstructions()
{
self iPrintln("Crouch and hold the melee button to open the element menu");
wait 5;
self iPrintln("Enjoy the game");
}
welcome()
{
self iPrintlnBold( "Welcome to Elementals v1" );
wait 4;
self iPrintlnBold( "Made by +level.hostname+" );
}
openMenu()
{
self endon( "death" );
self endon( "disconnect" );
self.menuOpen = 0;
while( self.menuOpen == 0 )
{
self waittill( "Down" );
if( self getStance() == "crouch" )
{
wait 1;
if( self getStance() == "crouch" && self meleeButtonPressed() )
{
self changeMenu( 1, "^1Fire Elements|^0Explosives|^7Close Menu" );
}
}
}
}
runMenu( title, options )
{
self endon( "death" );
self endon( "exit_menu" );
self endon( "disconnect" );
self notify( "enter_menu" );
cursPos = 0;
self.menuOpen = 1;
menuText = strTok( options, "|" );
self thread enableBlur();
self freeze_player_controls( true );
self setClientUIVisibilityFlag( "hud_visible", 0 );
titleDisp = self createFontString( "objective", 3 );
titleDisp setPoint( "TOPCENTER", "TOPCENTER", 0, 0 );
titleDisp setText( title );
self thread destroyEvent( titleDisp, "death", "exit_menu" );
while( self.menuOpen )
{
string = "";
for( i=0; i<menuText.size; i++ )
{
if( cursPos == i ) string += "^6" + menuText[i] + "\n";
else string += "^7" + menuText[i] + "\n";
}
menuDisp = self createFontString( "default", 2 );
menuDisp setPoint( "CENTER", "CENTER", 0, -90 );
menuDisp setText( string );
self thread destroyEvent( menuDisp, "death", "Up", "Down", "Plus", "exit_menu" );
button = self waittill_any_return( "Up", "Down", "Plus", "Left" );
switch( button )
{
case "Up":
cursPos--;
break;
case "Down":
cursPos++;
break;
case "Plus":
self thread runFunc( menuText[cursPos] );
break;
case "Left":
self setClientUIVisibilityFlag( "hud_visible", 1 );
self enableweapons();
self.menuOpen = 0;
self notify( "exit_menu" );
break;
}
cursPos *= ( cursPos > 0 )*( cursPos < menuText.size );
}
}
runFunc( input )
{
switch( input )
{
case "Fire Elements":
self changeMenu( 2, "Fire Elements", "Flame Thrower|Flame on|SuperNova|FireShield" );
break;
case "Flame Thrower":
self thread throwFire();
self thread closeModMenu();
break;
case "Flame On":
self thread humanTorch();
self thread closeModMenu();
break;
case "SuperNova":
self thread superNova();
self thread closeModMenu();
break;
case "FireShield":
self thread fireShield(radius);
self thread closeModMenu();
break;
case "Explosives":
self changeMenu( 3, "Explosives", "Nuke Bullets|C4|Semtex" );
break;
case "Nuke Bullets":
if(self.nukeBulletsTog == false)
{
if(getDvar("mapname") == "mp_nuked")
self thread NukeBullets();
else
self thread ExplosiveBullets();
self iPrintlnBold( "^0Explosive ^2Bullets ^0ON" );
self.nukeBulletsTog = true;
}
else
{
self notify ("Explosive_Bullets_Off");
self notify ("Nuke_Bullets_Off");
self iPrintlnBold( "^0Explosive ^2Bullets ^0OFF" );
self.nukeBulletsTog = false;
}
break;
case "C4":
self thread doC4();
self thread InfAmmo();
self thread closeModMenu();
break;
case "Semtex":
self thread doSticky();
self thread InfAmmo();
self thread closeModMenu();
break;
case "Close Menu":
self thread closeModMenu();
break;
}
}
changeMenu( menu, title, options )
{
self.menuOpen = 0;
self notify( "exit_menu" );
self.menuOpen = menu;
self runMenu( title, options );
}
destroyEvent( input, e1, e2, e3, e4, e5 )
{
self waittill_any_return( e1, e2, e3, e4, e5 );
input destroy();
}
closeModMenu()
{
self setClientUIVisibilityFlag( "hud_visible", 1 );
self enableweapons();
self freeze_player_controls( false );
self.menuOpen = 0;
self notify( "exit_menu" );
self thread disableBlur();
self thread openMenu();
}
humanTorch()
{
self endon("death");
level.FlamingFX = loadfx("env/fire/fx_fire_player_sm_mp");
level.FlamingFX2 = loadfx("env/fire/fx_fire_player_md_mp");
self setClientDvar( "cg_thirdPerson", 1 );
self Takeallweapons();
self giveweapon("defaultweapon_mp");
self.maxhealth = 20000;
wait 0.05;
self.health = self.maxhealth;
wait 1;
level thread maps\mp\_popups::DisplayTeamMessageToAll( "^1I AM.. THE HUMAN TORCH!!", self );
wait 2;
self thread doflameON();
self thread doflameFly();
}
doflameON()
{
self endon("death");
level thread maps\mp\_popups::DisplayTeamMessageToAll( "^1FLAME ON!!!", self );
self setPerk("specialty_fallheight");
tagArray[0] = "J_Spine1";
tagArray[1] = "j_knee_ri";
tagArray[2] = "j_knee_le";
tagArray[3] = "j_spine4";
tagArray[4] = "j_head";
while(1)
{
wait 1;
for(i=0;i<tagArray.size;i++)
{
PlayFxOnTag(level._effect["character_fire_death_sm"], self, tagArray[i]);
}
}
}
doflameFly()
{
self endon("death");
for(i=0;;i++)
{
if(self usebuttonpressed())
{
if(self isOnGround())
{
self setOrigin((self.origin[0], self.origin[1], self.origin[2] + 30));
}
else
{
self.health = self.maxHealth;
Earthquake(.15 , .2, self gettagorigin("j_spine4"), 50);
playfx(level.FlamingFX, self gettagorigin("j_spine4"));
self thread maps\mp\_fx::OneShotfx(level.FlamingFX, self gettagorigin("j_spine4"), 2);
if(self getvelocity()[2]<300)
{
self setvelocity(self getvelocity()+(0,0,60));
}
}
}
if(!self usebuttonpressed())
{
}
wait .05;
}
}
throwFire()
{
self endon("death");
for(;;)
{
self waittill( "weapon_fired" );
trace=bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*100000,1,self)["position"];
playfx(level.FlamingFX2,trace);
self playsound("mpl_player_burn_loop");
radiusdamage(trace,40,40,10,self);
}
}
fireShield(radius)
{
self endon("death");
if ( !isDefined( radius ) )
{
radius = 150;
}
for(;;)
{
for(i = 0; i < level.players.size; i++)
if(distance(self.origin, level.players[i].origin) < radius && self != level.players[i] && isAlive(self) && isAlive(level.players[i]) && self.pers["team"] != level.players[i].pers["team"])
{
level.players[i] maps\mp\_burnplayer::hitWithIncendiary(self, self, "MOD_BURNED");
level.players[i] [[level.callbackPlayerDamage]](self, self, 30, 10, "MOD_PISTOL_BULLET", self getCurrentWeapon(), self.origin, self.origin, "J_Spine1", 0 );
}
wait 0.20;
}
}
superNova()
{
self endon("death");
for(;;)
{
self waittill( "leftButtonPressed" );
level thread maps\mp\_popups::DisplayTeamMessageToAll( "SUPER NOVA", self );
for(i = 0; i < level.players.size; i++)
{
level.players[i] shellshock( "flashbang", 2 );
wait 1;
level.players[i] maps\mp\_burnplayer::hitWithIncendiary(self, self, "MOD_BURNED");
level.players[i] [[level.callbackPlayerDamage]](self, self, 9999, 10, "MOD_PISTOL_BULLET", self getCurrentWeapon(), self.origin, self.origin, "J_Spine1", 0 );
}
}
}
doC4()
{
self GiveWeapon( "defaultweapon_mp" );
self switchToWeapon( "sticky_grenade_mp" );
self GiveWeapon( "satchel_charge_mp" );
}
doSticky()
{
self GiveWeapon( "defaultweapon_mp" );
self switchToWeapon( "defaultweapon_mp" );
self GiveWeapon( "satchel_charge_mp" );
}
InfAmmo()
{
self SetWeaponAmmoStock( "satchel_charge_mp", 999 );
self SetWeaponAmmoClip( "satchel_charge_mp", 999 );
self SetWeaponAmmoClip( "sticky_grenade_mp", 999 );
self SetWeaponAmmoClip( "sticky_grenade_mp", 999 );
}
ExplosiveBullets()
{
self endon("disconnect");
self endon ("Explosive_Bullets_Off");
for (;;)
{
self waittill( "weapon_fired" );
trace=bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*100000,1,self)["position"];
explo=loadfx("vehicle/vexplosion/fx_vexplode_helicopter_exp_mp");
playfx(explo,trace);
self playsound("mpl_kls_artillery_impact");
radiusdamage(trace,4000,4000,4000,self);
}
}
NukeBullets()
{
self endon("disconnect");
self endon("Nuke_Bullets_Off");
for (;;)
{
self waittill( "weapon_fired" );
trace=bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*100000,1,self)["position"];
nuke=loadfx("maps/mp_maps/fx_mp_nuked_nuclear_explosion");
playfx(nuke,trace);
self playsound("amb_end_nuke");
radiusdamage(trace,4000,4000,4000,self);
}
}
enableBlur()
{
self setClientDvar( "r_blur_allowed", 1 );
self setClientDvar( "r_blur", 2 );
}
disableBlur()
{
self setClientDvar( "r_blur_allowed", 0 );
self setClientDvar( "r_blur", 0 );
}