[ZM] Attempting to change box weapon checks

Topic created · 2 Posts · 69 Views
  • So before the latest update I used a script that replaced _zm_magicbox.gsc (forum.plutonium.pw/topic/2648/release-zombies-no-weapon-limits-for-mystery-box), but after the update that obviously won't work anymore. I attempted a fix myself using my limited gsc knowledge by replacing the classes in _zm_magicbox.gsc with the slightly edited versions from the earlier script.

    #include maps/mp/zombies/_zm_stats;
    #include maps/mp/_demo;
    #include maps/mp/zombies/_zm_audio;
    #include maps/mp/zombies/_zm_score;
    #include maps/mp/zombies/_zm_pers_upgrades_functions;
    #include maps/mp/zombies/_zm_audio_announcer;
    #include maps/mp/zombies/_zm_unitrigger;
    #include maps/mp/zombies/_zm_weapons;
    #include maps/mp/zombies/_zm_utility;
    #include maps/mp/_utility;
    #include common_scripts/utility;
    #include maps/mp/zombies/_zm_magicbox_lock;
    
    init()
    {
        level thread onPlayerConnect();
        level.treasure_chest_canplayerreceiveweapon = scripts/zm/boxRNG::boxRNG;
        level.treasure_chest_chooseweightedrandomweapon = scripts/zm/boxRNG::chestTest;
    }
    
    onPlayerConnect()
    {
        for(;;)
        {
            level waittill("connected", player);
        }
    }
    
    boxRNG( player, weapon, pap_triggers )
    {
    	if ( !get_is_in_box( weapon ) )
    	{
    		return 0;
    	}
    	return 1;
    }
    
    chestTest( player )
    {
    	keys = array_randomize( getarraykeys( level.zombie_weapons ) );
    	if ( isDefined( level.customrandomweaponweights ) )
    	{
    		keys = player [[ level.customrandomweaponweights ]]( keys );
    	}
    	/*
    /#
    	forced_weapon = getDvar( "scr_force_weapon" );
    	if ( forced_weapon != "" && isDefined( level.zombie_weapons[ forced_weapon ] ) )
    	{
    		arrayinsert( keys, forced_weapon, 0 );
    #/
    	}
    	*/
    	pap_triggers = getentarray( "specialty_weapupgrade", "script_noteworthy" );
    	for ( i = 0; i < keys.size; i++ )
    	{
    		if ( treasure_chest_canplayerreceiveweapon( player, keys[ i ], pap_triggers ) )
    		{
    			return keys[ i ];
    		}
    	}
    	return keys[ 0 ];
    }
    

    If it's clear that this is definitely incorrect, please say so lol. I'd appreciate any and all advice here.

  • Hey @Killerbro Did you end up testing this? If so, does it work?

Log in to reply