Skip to content

Instantly share code, notes, and snippets.

@Tustin
Created December 17, 2016 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tustin/bc5a97120c128016ebb4d10518fb3744 to your computer and use it in GitHub Desktop.
Save Tustin/bc5a97120c128016ebb4d10518fb3744 to your computer and use it in GitHub Desktop.
#using scripts\codescripts\struct;
#using scripts\shared\clientfield_shared;
#using scripts\shared\system_shared;
#using scripts\shared\util_shared;
#using scripts\shared\flag_shared;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#using scripts\shared\ai\zombie_death;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_bgb;
#using scripts\zm\_zm_magicbox;
#using scripts\zm\_zm_pers_upgrades_functions;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_score;
#using scripts\zm\_zm_spawner;
#using scripts\zm\_zm_utility;
#insert scripts\zm\_zm_powerups.gsh;
#insert scripts\zm\_zm_utility.gsh;
#precache("model", "zombie_pickup_bonfire");
#precache("string", "ZOMBIE_POWERUP_MAX_AMMO");
#namespace bonfire_sale;
REGISTER_SYSTEM( "bonfire_sale", &__init__, undefined )
//-----------------------------------------------------------------------------------
// setup
//-----------------------------------------------------------------------------------
function __init__()
{
zm_powerups::register_powerup( "bonfire_sale", &grab_bonfire_sale );
if( ToLower( GetDvarString( "g_gametype" ) ) != "zcleansed" )
{
zm_powerups::add_zombie_powerup(
"bonfire_sale",
"zombie_pickup_bonfire",
&"ZOMBIE_POWERUP_MAX_AMMO",
&zm_powerups::func_should_always_drop,
!POWERUP_ONLY_AFFECTS_GRABBER,
!POWERUP_ANY_TEAM,
!POWERUP_ZOMBIE_GRABBABLE,
undefined,
"hud_zm_powerup_bonfire1",
"zombie_powerup_bonfire_sale_time",
"zombie_powerup_bonfire_sale_on"
);
}
level thread setup_bonfiresale_audio();
}
function should_drop_bonfire_sale() {
return level flag::get("power_on");
}
function grab_bonfire_sale( player )
{
level thread start_bonfire_sale( self );
player thread zm_powerups::powerup_vo("firesale");
}
function createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
{
textElem = newClientHudElem(self);
textElem.sort = sort;
textElem.alpha = alpha;
textElem.x = x;
textElem.y = y;
textElem.glowColor = glow;
textElem.glowAlpha = 1;
textElem.fontScale = fontScale;
textElem setText(text);
return textElem;
}
function start_bonfire_sale( item )
{
level notify ("powerup bonfire sale");
level endon ("powerup bonfire sale");
temp_ent = spawn("script_origin", (0,0,0));
temp_ent playloopsound ("zmb_double_point_loop");
for (i = 0; i < level.players.size; i++)
{
level.players[i] PlaySound("bonfire_sale");
level.players[i] IPrintLnBold("igjifjg");
}
displayTimer = self createText("default", 1.5, "TOP", "TOP", level.zombie_vars["zombie_timer_offset"], 100, 3, 1, undefined, "ffff");
level.zombie_vars["zombie_powerup_bonfire_sale_on"] = true;
level thread toggle_bonfire_sale_on();
level.zombie_vars["zombie_powerup_bonfire_sale_time"] = N_POWERUP_DEFAULT_TIME;
while ( level.zombie_vars["zombie_powerup_bonfire_sale_time"] > 0)
{
WAIT_SERVER_FRAME;
level.zombie_vars["zombie_powerup_bonfire_sale_time"] = level.zombie_vars["zombie_powerup_bonfire_sale_time"] - 0.05;
}
level.zombie_vars["zombie_powerup_bonfire_sale_on"] = false;
level notify ( "bonfire_sale_off" );
for (i = 0; i < level.players.size; i++)
{
level.players[i] playsound("zmb_points_loop_off");
}
temp_ent Delete();
displayTimer Destroy();
}
function toggle_bonfire_sale_on()
{
level endon ("powerup bonfire sale");
//thread play_bonfiresale_audio();
if( !isdefined ( level.zombie_vars["zombie_powerup_bonfire_sale_on"] ) )
{
return;
}
if( level.zombie_vars["zombie_powerup_bonfire_sale_on"] )
{
if ( isdefined( level.bonfire_init_func ) )
{
level thread [[ level.bonfire_init_func ]]();
}
level waittill( "bonfire_sale_off" );
}
}
function setup_bonfiresale_audio()
{
wait(2);
//intercom = getentarray ("intercom", "targetname");
while(1)
{
while( level.zombie_vars["zombie_powerup_fire_sale_on"] == false)
{
wait(0.2);
}
while( level.zombie_vars["zombie_powerup_fire_sale_on"] == true)
{
wait (0.1);
}
level notify ("firesale_over");
}
}
function play_bonfiresale_audio()
{
if(!isdefined( level.pack_a_punch.sndEnt ) )
{
//level.pack_a_punch.sndEnt = spawn( "script_origin", level.pack_a_punch.origin+(0,0,100));
}
//level.pack_a_punch.sndEnt = playloopsound("mus_fire_sale");
//level waittill ("firesale_over");
//level.pack_a_punch.sndEnt = delete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment