UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Help for double Pack-A-Punch

broken avatar :(
Created 2 years ago
by 5jasonc
0 Members and 1 Guest are viewing this topic.
475 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 27 July 2018
Last active: 2 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
5jasonc's Groups
5jasonc's Contact & Social Links
I'm new to WaW modding (my first post here), and I'm trying to get double Pack-A-Punch weapons in a custom map I'm making. I have it working where you can pack the weapon twice, and I have edited _zombiemode_perks.gsc to increase the PAP price to 10,000 if you are double upgrading a weapon, but I'm having trouble with being able to buy ammo for double packed weapons. For example, I have a weapon zombie_ppsh_upgraded_upgraded that when I try to buy ammo for using the ppsh wall weapon it doesn't do anything. I have pasted my _zombiemode_weapons.gsc file below (I'm sorry, I couldn't find how to place an attachment to download) so someone can maybe tell me what I'm doing wrong or what I'm missing.
 
Any help is appreciated, thank you.
 
(Can a  mod help me figure out how to attach a file I can't paste the entire contents of my _zombiemode_weapons without it being cut off.)
 
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
    init_weapons();
    init_weapon_upgrade();
    init_pay_turret();
    init_weapon_cabinet();
    treasure_chest_init();
    level thread add_limited_tesla_gun();
    level.box_moved = true;
}

add_zombie_weapon( weapon_name, hint, cost, weaponVO, variation_count, ammo_cost  )
{
    if( IsDefined( level.zombie_include_weapons ) && !IsDefined( level.zombie_include_weapons[weapon_name] ) )
    {
        return;
    }
   
    add_weapon_to_sound_array(weaponVO,variation_count);

    // Check the table first
    table = "mp/zombiemode.csv";
    table_cost = TableLookUp( table, 0, weapon_name, 1 );
    table_ammo_cost = TableLookUp( table, 0, weapon_name, 2 );

    if( IsDefined( table_cost ) && table_cost != "" )
    {
        cost = round_up_to_ten( int( table_cost ) );
    }

    if( IsDefined( table_ammo_cost ) && table_ammo_cost != "" )
    {
        ammo_cost = round_up_to_ten( int( table_ammo_cost ) );
    }

    PrecacheItem( weapon_name );
    PrecacheString( hint );

    struct = SpawnStruct();

    if( !IsDefined( level.zombie_weapons ) )
    {
        level.zombie_weapons = ;
    }

    struct.weapon_name = weapon_name;
    struct.weapon_classname = "weapon_" + weapon_name;
    struct.hint = hint;
    struct.cost = cost;
    struct.sound = weaponVO;
    struct.variation_count = variation_count;
    struct.is_in_box = level.zombie_include_weapons[weapon_name];

    if( !IsDefined( ammo_cost ) )
    {
        ammo_cost = round_up_to_ten( int( cost * 0.5 ) );
    }

    struct.ammo_cost = ammo_cost;

    level.zombie_weapons[weapon_name] = struct;
}

default_weighting_func()
{
    return 1;
}

default_tesla_weighting_func()
{
    num_to_add = 1;
    if( isDefined( level.pulls_since_last_tesla_gun ) )
    {
        // player has dropped the tesla for another weapon, so we set all future polls to 20%
        if( isDefined(level.player_drops_tesla_gun) && level.player_drops_tesla_gun == true )
        {                        
            num_to_add += int(.2 * level.zombie_include_weapons.size);        
        }
       
        // player has not seen tesla gun in late rounds
        if( !isDefined(level.player_seen_tesla_gun) || level.player_seen_tesla_gun == false )
        {
            // after round 10 the Tesla gun percentage increases to 20%
            if( level.round_number > 10 )
            {
                num_to_add += int(.2 * level.zombie_include_weapons.size);
            }        
            // after round 5 the Tesla gun percentage increases to 15%
            else if( level.round_number > 5 )
            {
                // calculate the number of times we have to add it to the array to get the desired percent
                num_to_add += int(.15 * level.zombie_include_weapons.size);
            }                        
        }
    }
    return num_to_add;
}

default_ray_gun_weighting_func()
{
    if( level.box_moved == true )
    {    
        num_to_add = 1;
        // increase the percentage of ray gun
        if( isDefined( level.pulls_since_last_ray_gun ) )
        {
            // after 12 pulls the ray gun percentage increases to 15%
            if( level.pulls_since_last_ray_gun > 11 )
            {
                num_to_add += int(level.zombie_include_weapons.size*0.15);            
            }            
            // after 8 pulls the Ray Gun percentage increases to 10%
            else if( level.pulls_since_last_ray_gun > 7 )
            {
                num_to_add += int(.1 * level.zombie_include_weapons.size);
            }        
        }
        return num_to_add;    
    }
    else
    {
        return 0;
    }
}


//
//    Slightly elevate the chance to get it until someone has it, then make it even
default_cymbal_monkey_weighting_func()
{
    players = get_players();
    count = 0;
    for( i = 0; i < players.size; i++ )
    {
        if( players[i] has_weapon_or_upgrade( "zombie_cymbal_monkey" ) )
        {
            count++;
        }
    }
    if ( count > 0 )
    {
        return 1;
    }
    else
    {
        if( level.round_number < 10 )
        {
            return 3;
        }
        else
        {
            return 5;
        }
    }
}


include_zombie_weapon( weapon_name, in_box, weighting_func )
{
    if( !IsDefined( level.zombie_include_weapons ) )
    {
        level.zombie_include_weapons = ;
    }
    if( !isDefined( in_box ) )
    {
        in_box = true;
    }

    level.zombie_include_weapons[weapon_name] = in_box;
   
    if( !isDefined( weighting_func ) )
    {
        level.weapon_weighting_funcs[weapon_name] = maps\_zombiemode_weapons::default_weighting_func;
    }
    else
    {
        level.weapon_weighting_funcs[weapon_name] = weighting_func;
    }
}

init_weapons()
{
    // Zombify
    PrecacheItem( "zombie_melee" );


    // Pistols
    add_zombie_weapon( "colt",                                     &"ZOMBIE_WEAPON_COLT_50",                     50,        "vox_crappy",    8 );
    add_zombie_weapon( "colt_dirty_harry",                         &"ZOMBIE_WEAPON_COLT_DH_100",                 100,    "vox_357",        5 );
    add_zombie_weapon( "nambu",                                 &"ZOMBIE_WEAPON_NAMBU_50",                     50,     "vox_crappy",    8 );
    add_zombie_weapon( "sw_357",                                 &"ZOMBIE_WEAPON_SW357_100",                 100,     "vox_357",        5 );
    add_zombie_weapon( "zombie_sw_357",                         &"ZOMBIE_WEAPON_SW357_100",                 100,     "vox_357",        5 );
    add_zombie_weapon( "zombie_sw_357_upgraded",                 &"ZOMBIE_WEAPON_SW357_100",                 100,     "vox_357",        5 );
    add_zombie_weapon( "tokarev",                                 &"ZOMBIE_WEAPON_TOKAREV_50",                 50,     "vox_crappy",    8 );
    add_zombie_weapon( "walther",                                 &"ZOMBIE_WEAPON_WALTHER_50",                 50,     "vox_crappy",    8 );
    add_zombie_weapon( "zombie_colt",                             &"ZOMBIE_WEAPON_ZOMBIECOLT_25",             25,     "vox_crappy",    8 );
    add_zombie_weapon( "zombie_colt_upgraded",                     &"ZOMBIE_WEAPON_ZOMBIECOLT_25",             25,     "vox_crappy",    8 );

    // Bolt Action                                              
    add_zombie_weapon( "kar98k",                                 &"ZOMBIE_WEAPON_KAR98K_200",                 200,    "",                0);
    add_zombie_weapon( "zombie_kar98k",                         &"ZOMBIE_WEAPON_KAR98K_200",                 200,    "",                0);
    add_zombie_weapon( "zombie_kar98k_upgraded",                 &"ZOMBIE_WEAPON_KAR98K_200",                 200,    "",                0);
    add_zombie_weapon( "kar98k_bayonet",                         &"ZOMBIE_WEAPON_KAR98K_B_200",                 200,    "",                0);
    add_zombie_weapon( "mosin_rifle",                             &"ZOMBIE_WEAPON_MOSIN_200",                 200,    "",                0);
    add_zombie_weapon( "mosin_rifle_bayonet",                     &"ZOMBIE_WEAPON_MOSIN_B_200",                 200,    "",                0 );
    add_zombie_weapon( "springfield",                             &"ZOMBIE_WEAPON_SPRINGFIELD_200",             200,    "",                0 );
    add_zombie_weapon( "zombie_springfield",                     &"ZOMBIE_WEAPON_SPRINGFIELD_200",             200,    "",                0 );
    add_zombie_weapon( "springfield_bayonet",                     &"ZOMBIE_WEAPON_SPRINGFIELD_B_200",         200,    "",                0 );
    add_zombie_weapon( "zombie_type99_rifle",                     &"ZOMBIE_WEAPON_TYPE99_200",                 200,    "",                0 );
    add_zombie_weapon( "zombie_type99_rifle_upgraded",             &"ZOMBIE_WEAPON_TYPE99_200",                 200,    "",                0 );
    add_zombie_weapon( "type99_rifle_bayonet",                     &"ZOMBIE_WEAPON_TYPE99_B_200",                 200,    "",                0 );

    // Semi Auto                                                
    add_zombie_weapon( "zombie_gewehr43",                         &"ZOMBIE_WEAPON_GEWEHR43_600",                 600,    "" ,            0 );
    add_zombie_weapon( "zombie_gewehr43_upgraded",                 &"ZOMBIE_WEAPON_GEWEHR43_600",                 600,    "" ,            0 );
    add_zombie_weapon( "zombie_m1carbine",                         &"ZOMBIE_WEAPON_M1CARBINE_600",                600,    "" ,            0 );
    add_zombie_weapon( "zombie_m1carbine_upgraded",             &"ZOMBIE_WEAPON_M1CARBINE_600",                600,    "" ,            0 );
    add_zombie_weapon( "m1carbine_bayonet",                     &"ZOMBIE_WEAPON_M1CARBINE_B_600",             600,    "" ,            0 );
    add_zombie_weapon( "zombie_m1garand",                         &"ZOMBIE_WEAPON_M1GARAND_600",                 600,    "" ,            0 );
    add_zombie_weapon( "zombie_m1garand_upgraded",                 &"ZOMBIE_WEAPON_M1GARAND_600",                 600,    "" ,            0 );
    add_zombie_weapon( "m1garand_bayonet",                         &"ZOMBIE_WEAPON_M1GARAND_B_600",             600,    "" ,            0 );
    add_zombie_weapon( "svt40",                                 &"ZOMBIE_WEAPON_SVT40_600",                 600,    "" ,            0 );

    // Grenades                                                
    add_zombie_weapon( "fraggrenade",                             &"ZOMBIE_WEAPON_FRAGGRENADE_250",             250,    "" ,            0 );
    add_zombie_weapon( "molotov",                                 &"ZOMBIE_WEAPON_MOLOTOV_200",                 200,    "vox_crappy",    8 );
    add_zombie_weapon( "molotov_zombie",                         &"ZOMBIE_WEAPON_MOLOTOV_200",                 200,    "vox_crappy",    8 );
    add_zombie_weapon( "stick_grenade",                         &"ZOMBIE_WEAPON_STICKGRENADE_250",             250,    "" ,            0 );
    add_zombie_weapon( "stielhandgranate",                         &"ZOMBIE_WEAPON_STIELHANDGRANATE_250",         250,    "" ,            0, 250 );
    add_zombie_weapon( "type97_frag",                             &"ZOMBIE_WEAPON_TYPE97FRAG_250",             250,    "" ,            0 );

    // Scoped
    add_zombie_weapon( "kar98k_scoped_zombie",                     &"ZOMBIE_WEAPON_KAR98K_S_750",                 750,    "vox_ppsh",        5);
    add_zombie_weapon( "kar98k_scoped_bayonet_zombie",             &"ZOMBIE_WEAPON_KAR98K_S_B_750",             750,    "vox_ppsh",        5);
    add_zombie_weapon( "mosin_rifle_scoped_zombie",             &"ZOMBIE_WEAPON_MOSIN_S_750",                 750,    "vox_ppsh",        5);
    add_zombie_weapon( "mosin_rifle_scoped_bayonet_zombie",     &"ZOMBIE_WEAPON_MOSIN_S_B_750",             750,    "vox_ppsh",        5);
    add_zombie_weapon( "ptrs41_zombie",                         &"ZOMBIE_WEAPON_PTRS41_750",                 750,    "vox_ppsh",        5);
    add_zombie_weapon( "ptrs41_zombie_upgraded",                 &"ZOMBIE_WEAPON_PTRS41_750",                 750,    "vox_ppsh",        5);
    add_zombie_weapon( "springfield_scoped_zombie",             &"ZOMBIE_WEAPON_SPRINGFIELD_S_750",         750,    "vox_ppsh",        5);
    add_zombie_weapon( "springfield_scoped_bayonet_zombie",     &"ZOMBIE_WEAPON_SPRINGFIELD_S_B_750",         750,    "vox_ppsh",        5);
    add_zombie_weapon( "type99_rifle_scoped_zombie",             &"ZOMBIE_WEAPON_TYPE99_S_750",                 750,    "vox_ppsh",        5);
    add_zombie_weapon( "type99_rifle_scoped_bayonet_zombie",     &"ZOMBIE_WEAPON_TYPE99_S_B_750",             750,    "vox_ppsh",        5);

    // Full Auto                                                                                    
    add_zombie_weapon( "zombie_mp40",                             &"ZOMBIE_WEAPON_MP40_1000",                 1000,    "vox_mp40",        2 );
    add_zombie_weapon( "zombie_mp40_upgraded",                     &"ZOMBIE_WEAPON_MP40_1000",                 1000,    "vox_mp40",        2 );
    add_zombie_weapon( "zombie_ppsh",                             &"ZOMBIE_WEAPON_PPSH_2000",                 2000,    "vox_ppsh",        5 );
    add_zombie_weapon( "zombie_ppsh_upgraded",                     &"ZOMBIE_WEAPON_PPSH_2000",                 2000,    "vox_ppsh",        5 );
    add_zombie_weapon( "zombie_ppsh_upgraded_upgraded",         "Press & hold &&1 to buy Pack A Punch Upgrade [Cost: 10000]",                 2000,    "vox_ppsh",        5 );
    add_zombie_weapon( "zombie_stg44",                             &"ZOMBIE_WEAPON_STG44_1200",                 1200,    "vox_mg",        9 );
    add_zombie_weapon( "zombie_stg44_upgraded",                 &"ZOMBIE_WEAPON_STG44_1200",                 1200,    "vox_mg",        9 );
    add_zombie_weapon( "zombie_thompson",                         &"ZOMBIE_WEAPON_THOMPSON_1200",             1200,    "",                0 );
    add_zombie_weapon( "zombie_thompson_upgraded",                 &"ZOMBIE_WEAPON_THOMPSON_1200",             1200,    "",                0 );
    add_zombie_weapon( "zombie_type100_smg",                     &"ZOMBIE_WEAPON_TYPE100_1000",                 1000,    "",                0 );
    add_zombie_weapon( "zombie_type100_smg_upgraded",             &"ZOMBIE_WEAPON_TYPE100_1000",                 1000,    "",                0 );

    // Shotguns                                            
    add_zombie_weapon( "zombie_doublebarrel",                     &"ZOMBIE_WEAPON_DOUBLEBARREL_1200",         1200,    "vox_shotgun", 6);
    add_zombie_weapon( "zombie_doublebarrel_upgraded",             &"ZOMBIE_WEAPON_DOUBLEBARREL_1200",         1200,    "vox_shotgun", 6);
    add_zombie_weapon( "zombie_doublebarrel_sawed",             &"ZOMBIE_WEAPON_DOUBLEBARREL_SAWED_1200",     1200,    "vox_shotgun", 6);
    add_zombie_weapon( "zombie_doublebarrel_sawed_upgraded",    &"ZOMBIE_WEAPON_DOUBLEBARREL_SAWED_1200",     1200,    "vox_shotgun", 6);
    add_zombie_weapon( "zombie_shotgun",                         &"ZOMBIE_WEAPON_SHOTGUN_1500",                 1500,    "vox_shotgun", 6);
    add_zombie_weapon( "zombie_shotgun_upgraded",                 &"ZOMBIE_WEAPON_SHOTGUN_1500",                 1500,    "vox_shotgun", 6);

    // Heavy Machineguns                                    
    add_zombie_weapon( "zombie_30cal",                             &"ZOMBIE_WEAPON_30CAL_3000",                 3000,    "vox_mg",        9 );
    add_zombie_weapon( "zombie_30cal_upgraded",                 &"ZOMBIE_WEAPON_30CAL_3000",                 3000,    "vox_mg",        9 );
    add_zombie_weapon( "zombie_bar",                             &"ZOMBIE_WEAPON_BAR_1800",                     1800,    "vox_bar",        5 );
    add_zombie_weapon( "zombie_bar_upgraded",                     &"ZOMBIE_WEAPON_BAR_1800",                     1800,    "vox_bar",        5 );
    add_zombie_weapon( "dp28",                                     &"ZOMBIE_WEAPON_DP28_2250",                 2250,    "vox_mg" ,        9 );
    add_zombie_weapon( "zombie_fg42",                             &"ZOMBIE_WEAPON_FG42_1500",                 1500,    "vox_mg" ,        9 );
    add_zombie_weapon( "zombie_fg42_upgraded",                     &"ZOMBIE_WEAPON_FG42_1500",                 1500,    "vox_mg" ,        9 );
    add_zombie_weapon( "fg42_scoped",                             &"ZOMBIE_WEAPON_FG42_S_1500",                 1500,    "vox_mg" ,        9 );
    add_zombie_weapon( "zombie_mg42",                             &"ZOMBIE_WEAPON_MG42_3000",                 3000,    "vox_mg" ,        9 );
    add_zombie_weapon( "zombie_mg42_upgraded",                     &"ZOMBIE_WEAPON_MG42_3000",                 3000,    "vox_mg" ,        9 );
    add_zombie_weapon( "type99_lmg",                             &"ZOMBIE_WEAPON_TYPE99_LMG_1750",             1750,    "vox_mg" ,        9 );

    // Grenade Launcher                                    
    add_zombie_weapon( "m1garand_gl_zombie",                     &"ZOMBIE_WEAPON_M1GARAND_GL_1500",             1500,    "",                0 );
    add_zombie_weapon( "m1garand_gl_zombie_upgraded",             &"ZOMBIE_WEAPON_M1GARAND_GL_1500",             1500,    "",                0 );
    add_zombie_weapon( "mosin_launcher_zombie",                 &"ZOMBIE_WEAPON_MOSIN_GL_1200",                1200,    "",                0 );

    // Bipods                                              
    add_zombie_weapon( "30cal_bipod",                             &"ZOMBIE_WEAPON_30CAL_BIPOD_3500",             3500,    "vox_mg",        5 );
    add_zombie_weapon( "bar_bipod",                             &"ZOMBIE_WEAPON_BAR_BIPOD_2500",             2500,    "vox_bar",        5 );
    add_zombie_weapon( "dp28_bipod",                             &"ZOMBIE_WEAPON_DP28_BIPOD_2500",             2500,    "vox_mg",        5 );
    add_zombie_weapon( "fg42_bipod",                             &"ZOMBIE_WEAPON_FG42_BIPOD_2000",             2000,    "vox_mg",        5 );
    add_zombie_weapon( "mg42_bipod",                             &"ZOMBIE_WEAPON_MG42_BIPOD_3250",             3250,    "vox_mg",        5 );
    add_zombie_weapon( "type99_lmg_bipod",                         &"ZOMBIE_WEAPON_TYPE99_LMG_BIPOD_2250",     2250,    "vox_mg",        5 );

    // Rocket Launchers
    add_zombie_weapon( "bazooka",                                 &"ZOMBIE_WEAPON_BAZOOKA_2000",                 2000,    "",                0 );
    add_zombie_weapon( "panzerschrek_zombie",                     &"ZOMBIE_WEAPON_PANZERSCHREK_2000",         2000,    "vox_panzer",    5 );
    add_zombie_weapon( "panzerschrek_zombie_upgraded",             &"ZOMBIE_WEAPON_PANZERSCHREK_2000",         2000,    "vox_panzer",    5 );

    // Flamethrower                                        
    add_zombie_weapon( "m2_flamethrower_zombie",                 &"ZOMBIE_WEAPON_M2_FLAMETHROWER_3000",         3000,    "vox_flame",    7);    
    add_zombie_weapon( "m2_flamethrower_zombie_upgraded",         &"ZOMBIE_WEAPON_M2_FLAMETHROWER_3000",         3000,    "vox_flame",    7);    

    // Special                                              
    add_zombie_weapon( "mine_bouncing_betty",                    &"ZOMBIE_WEAPON_SATCHEL_2000",                2000,    "" );
    add_zombie_weapon( "mortar_round",                             &"ZOMBIE_WEAPON_MORTARROUND_2000",             2000,    "" );
    add_zombie_weapon( "satchel_charge",                         &"ZOMBIE_WEAPON_SATCHEL_2000",                 2000,    "vox_monkey",    3 );
    add_zombie_weapon( "zombie_cymbal_monkey",                    &"ZOMBIE_WEAPON_SATCHEL_2000",                 2000,    "vox_monkey",    3 );
    add_zombie_weapon( "ray_gun",                                 &"ZOMBIE_WEAPON_RAYGUN_10000",                 10000,    "vox_raygun",    6 );
    add_zombie_weapon( "ray_gun_upgraded",                         &"ZOMBIE_WEAPON_RAYGUN_10000",                 10000,    "vox_raygun",    6 );
    add_zombie_weapon( "tesla_gun",                                &"ZOMBIE_BUY_TESLA",                         10,        "vox_tesla",    5 );
    add_zombie_weapon( "tesla_gun_upgraded",                    &"ZOMBIE_BUY_TESLA",                         10,        "vox_tesla",    5 );

    if(level.script != "nazi_zombie_prototype")
    {
        Precachemodel("zombie_teddybear");
    }
    // ONLY 1 OF THE BELOW SHOULD BE ALLOWED
    add_limited_weapon( "m2_flamethrower_zombie", 1 );
    add_limited_weapon( "tesla_gun", 1);
}  

//remove this function and whenever it's call for production. this is only for testing purpose.
add_limited_tesla_gun()
{

    weapon_spawns = GetEntArray( "weapon_upgrade", "targetname" );

    for( i = 0; i < weapon_spawns.size; i++ )
    {
        hint_string = weapon_spawns[i].zombie_weapon_upgrade;
        if(hint_string == "tesla_gun")
        {
            weapon_spawns[i] waittill("trigger");
            weapon_spawns[i] trigger_off();
            break;

        }
       
    }

}


add_limited_weapon( weapon_name, amount )
{
    if( !IsDefined( level.limited_weapons ) )
    {
        level.limited_weapons = ;
    }

    level.limited_weapons[weapon_name] = amount;
}                                              

// For pay turrets
init_pay_turret()
{
    pay_turrets = ;
    pay_turrets = GetEntArray( "pay_turret", "targetname" );
   
    for( i = 0; i < pay_turrets.size; i++ )
    {
        cost = level.pay_turret_cost;
        if( !isDefined( cost ) )
        {
            cost = 1000;
        }
        pay_turrets[i] SetHintString( &"ZOMBIE_PAY_TURRET", cost );
        pay_turrets[i] SetCursorHint( "HINT_NOICON" );
        pay_turrets[i] UseTriggerRequireLookAt();
       
        pay_turrets[i] thread pay_turret_think( cost );
    }
}

// For buying weapon upgrades in the environment
init_weapon_upgrade()
{
    weapon_spawns = ;
    weapon_spawns = GetEntArray( "weapon_upgrade", "targetname" );

    for( i = 0; i < weapon_spawns.size; i++ )
    {
        hint_string = get_weapon_hint( weapon_spawns[i].zombie_weapon_upgrade );

        weapon_spawns[i] SetHintString( hint_string );
        weapon_spawns[i] setCursorHint( "HINT_NOICON" );
        weapon_spawns[i] UseTriggerRequireLookAt();

        weapon_spawns[i] thread weapon_spawn_think();
        model = getent( weapon_spawns[i].target, "targetname" );
        model hide();
    }
}

// weapon cabinets which open on use
init_weapon_cabinet()
{
    // the triggers which are targeted at doors
    weapon_cabs = GetEntArray( "weapon_cabinet_use", "targetname" );

    for( i = 0; i < weapon_cabs.size; i++ )
    {

        weapon_cabs[i] SetHintString( &"ZOMBIE_CABINET_OPEN_1500" );
        weapon_cabs[i] setCursorHint( "HINT_NOICON" );
        weapon_cabs[i] UseTriggerRequireLookAt();
    }

    array_thread( weapon_cabs, ::weapon_cabinet_think );
}

// returns the trigger hint string for the given weapon
get_weapon_hint( weapon_name )
{
    AssertEx( IsDefined( level.zombie_weapons[weapon_name] ), weapon_name + " was not included or is not part of the zombie weapon list." );

    return level.zombie_weapons[weapon_name].hint;
}

get_weapon_cost( weapon_name )
{
    AssertEx( IsDefined( level.zombie_weapons[weapon_name] ), weapon_name + " was not included or is not part of the zombie weapon list." );

    return level.zombie_weapons[weapon_name].cost;
}

get_ammo_cost( weapon_name )
{
    AssertEx( IsDefined( level.zombie_weapons[weapon_name] ), weapon_name + " was not included or is not part of the zombie weapon list." );

    return level.zombie_weapons[weapon_name].ammo_cost;
}

get_is_in_box( weapon_name )
{
    AssertEx( IsDefined( level.zombie_weapons[weapon_name] ), weapon_name + " was not included or is not part of the zombie weapon list." );
   
    return level.zombie_weapons[weapon_name].is_in_box;
}

is_weapon_upgraded( weaponname )
{
    if( !isdefined( weaponname ) )
    {
        return false;
    }

    weaponname = ToLower( weaponname );

    upgraded = issubstr( weaponname, "_upgraded" );

    return upgraded;

}

has_upgrade( weaponname )
{
    has_upgrade = false;
    if( IsDefined( level.zombie_include_weapons[weaponname+"_upgraded"] ) )
    {
        has_upgrade = self HasWeapon( weaponname+"_upgraded" );
    }
    return has_upgrade;
}

has_weapon_or_upgrade( weaponname )
{
    has_weapon = false;
    if (self maps\_laststand::player_is_in_laststand())
    {
        for( m = 0; m < self.weaponInventory.size; m++ )
        {
            if (self.weaponInventory[m] == weaponname || self.weaponInventory[m] == weaponname+"_upgraded" || self.weaponInventory[m] == weaponname+"_upgraded_upgraded")
            {
                has_weapon = true;
            }
        }
    }
    else
    {
        // If the weapon you're checking doesn't exist, it will return undefined
        if( IsDefined( level.zombie_include_weapons[weaponname] ) )
        {
            has_weapon = self HasWeapon( weaponname );
        }
   
        if( !has_weapon && isdefined( level.zombie_include_weapons[weaponname+"_upgraded"] ) )
        {
            has_weapon = self HasWeapon( weaponname+"_upgraded" );
        }
       
        if( !has_weapon && isdefined( level.zombie_include_weapons[weaponname+"_upgraded_upgraded"] ) )
        {
            has_weapon = self HasWeapon( weaponname+"_upgraded_upgraded" );
        }
    }

    return has_weapon;
}

using_weapon_or_upgrade( weaponname )
{
    if( self GetCurrentWeapon() == weaponname || self GetCurrentWeapon() == weaponname+"_upgraded" || self GetCurrentWeapon() == weaponname+"_upgraded_upgraded" )
    {
        return true;
    }
    return false;
}

// for the random weapon chest
treasure_chest_init()
{
    flag_init("moving_chest_enabled");
    flag_init("moving_chest_now");
   
   
    level.chests = GetEntArray( "treasure_chest_use", "targetname" );

    if (level.chests.size > 1)
    {

        flag_set("moving_chest_enabled");
   
        while ( 1 )
        {
            level.chests = array_randomize(level.chests);

            if( isdefined( level.random_pandora_box_start ) )
                break;
   
            if ( !IsDefined( level.chests[0].script_noteworthy ) || ( level.chests[0].script_noteworthy != "start_chest" ) )
            {
                break;
            }

        }        
       
        level.chest_index = 0;

        while(level.chest_index < level.chests.size)
        {
               
            if( isdefined( level.random_pandora_box_start ) )
                break;

            if(level.chests[level.chest_index].script_noteworthy == "start_chest")
            {
                 break;
            }
           
            level.chest_index++;    
      }

        //init time chest accessed amount.
       
        if(level.script != "nazi_zombie_prototype")
        {
            level.chest_accessed = 0;
        }

        if(level.script == "nazi_zombie_sumpf" || level.script == "nazi_zombie_factory"  || level.script == "hallway" )
        {
            // Anchor target will grab the weapon spawn point inside the box, so the fx will be centered on it too
            anchor = GetEnt(level.chests[level.chest_index].target, "targetname");
            anchorTarget = GetEnt(anchor.target, "targetname");

            level.pandora_light = Spawn( "script_model", anchorTarget.origin );
            level.pandora_light.angles = anchorTarget.angles + (-90, 0, 0);
            //temp_fx_origin rotateto((-90, (box_origin.angles[1] * -1), 0), 0.05);
            level.pandora_light SetModel( "tag_origin" );
            playfxontag(level._effect["lght_marker"], level.pandora_light, "tag_origin");
        }
        // DCS:)
        {
            // Anchor target will grab the weapon spawn point inside the box, so the fx will be centered on it too
            anchor = GetEnt(level.chests[level.chest_index].target, "targetname");
            anchorTarget = GetEnt(anchor.target, "targetname");

            level.pandora_light = Spawn( "script_model", anchorTarget.origin );
            level.pandora_light.angles = (-90, 0, 0);
            level.pandora_light SetModel( "tag_origin" );
            //playfxontag(level._effect["lght_marker"], level.pandora_light, "tag_origin");
        }        
       
        //determine magic box starting location at random or normal
        init_starting_chest_location();
   
    }

    array_thread( level.chests, ::treasure_chest_think );

}

init_starting_chest_location()
{

    for( i = 0; i < level.chests.size; i++ )
    {

        if( isdefined( level.random_pandora_box_start ) && level.random_pandora_box_start == true )
        {
            if( i != 0 )
            {
                level.chests[i] hide_chest();    
            }
            else
            {
                level.chest_index = i;
                unhide_magic_box( i );
            }

        }
        else
        {
            if ( !IsDefined(level.chests[i].script_noteworthy ) || ( level.chests[i].script_noteworthy != "start_chest" ) )
            {
                level.chests[i] hide_chest();    
            }
            else
            {
                level.chest_index = i;
                unhide_magic_box( i );
            }
        }
    }


}

unhide_magic_box( index )
{
   
    //PI CHANGE - altered to allow for more than one piece of rubble
    rubble = getentarray( level.chests[index].script_noteworthy + "_rubble", "script_noteworthy" );
    if ( IsDefined( rubble ) )
    {
        for ( x = 0; x < rubble.size; x++ )
        {
            rubble[x] hide();
        }
        //END PI CHANGE
    }
    else
    {
        println( "^3Warning: No rubble found for magic box" );
    }
}

set_treasure_chest_cost( cost )
{
    level.zombie_treasure_chest_cost = cost;
}

hide_chest()
{
    pieces = self get_chest_pieces();

    for(i=0;i<pieces.size;i++)
    {
        pieces[i] disable_trigger();
        pieces[i] hide();
    }    
}

get_chest_pieces()
{
    // self = trigger

    lid = GetEnt(self.target, "targetname");
    org = GetEnt(lid.target, "targetname");
    box = GetEnt(org.target, "targetname");

    pieces = ;
    pieces[pieces.size] = self;
    pieces[pieces.size] = lid;
    pieces[pieces.size] = org;
    pieces[pieces.size] = box;

    return pieces;
}

play_crazi_sound()
{
    self playlocalsound("laugh_child");
}

show_magic_box()
{
    pieces = self get_chest_pieces();
    for(i=0;i<pieces.size;i++)
    {
        pieces[i] enable_trigger();
    }
   
    // PI_CHANGE_BEGIN - JMA - we want to play another effect on swamp
    anchor = GetEnt(self.target, "targetname");
    anchorTarget = GetEnt(anchor.target, "targetname");

    if(isDefined(level.script) && (level.script != "nazi_zombie_sumpf") && (level.script != "nazi_zombie_factory") )
    {
        playfx( level._effect["poltergeist"],pieces[0].origin);
    }
    else
    {        
        level.pandora_light.angles = (-90, anchorTarget.angles[1] + 180, 0);
        level.pandora_light moveto(anchorTarget.origin, 0.05);
        wait(1);    
        playfx( level._effect["lght_marker_flare"],level.pandora_light.origin );
//        playfxontag(level._effect["lght_marker_flare"], level.pandora_light, "tag_origin");
    }
    // PI_CHANGE_END
   
    playsoundatposition( "box_poof", pieces[0].origin );
    wait(.5);
    for(i=0;i<pieces.size;i++)
    {
        if( pieces[i].classname != "trigger_use" )
        {
            pieces[i] show();
        }
    }
    pieces[0] playsound ( "box_poof_land" );
    pieces[0] playsound( "couch_slam" );
}

treasure_chest_think()
{    
    cost = 950;
    if( IsDefined( level.zombie_treasure_chest_cost ) )
    {
        cost = level.zombie_treasure_chest_cost;
    }
    else
    {
        cost = self.zombie_cost;
    }

    self set_hint_string( self, "default_treasure_chest_" + cost );
    self setCursorHint( "HINT_NOICON" );

    //self thread decide_hide_show_chest_hint( "move_imminent" );

    // waittill someuses uses this
    user = undefined;
    while( 1 )
    {
        self waittill( "trigger", user );

        if( user in_revive_trigger() )
        {
            wait( 0.1 );
            continue;
        }

        // make sure the user is a player, and that they can afford it
        if( is_player_valid( user ) && user.score >= cost )
        {
            user maps\_zombiemode_score::minus_to_player_score( cost );
            break;
        }
        else if ( user.score < cost )
        {
            user thread maps\_zombiemode_perks::play_no_money_perk_dialog();
            continue;    
        }

        wait 0.05;
    }

    // trigger_use->script_brushmodel lid->script_origin in radiant
    lid = getent( self.target, "targetname" );
    weapon_spawn_org = getent( lid.target, "targetname" );

    //open the lid
    lid thread treasure_chest_lid_open();

    // SRS 9/3/2008: added to help other functions know if we timed out on grabbing the item
    self.timedOut = false;

    // mario kart style weapon spawning
    weapon_spawn_org thread treasure_chest_weapon_spawn( self, user );

    // the glowfx    
    weapon_spawn_org thread treasure_chest_glowfx();

    // take away usability until model is done randomizing
    self disable_trigger();

    weapon_spawn_org waittill( "randomization_done" );

    if (flag("moving_chest_now"))
    {
        user thread treasure_chest_move_vo();
        self treasure_chest_move(lid);

    }
    else
    {
        // Let the player grab the weapon and re-enable the box //
        self.grab_weapon_hint = true;
        self.chest_user = user;
        self sethintstring( &"ZOMBIE_TRADE_WEAPONS" );
        self setCursorHint( "HINT_NOICON" );
        self setvisibletoplayer( user );

        // Limit its visibility to the player who bought the box
        self enable_trigger();
        self thread treasure_chest_timeout();

        // make sure the guy that spent the mo

 
Last Edit: October 24, 2021, 06:54:46 pm by 5jasonc

 
Loading ...