Communal Box (Share Box Weapons)
COMMUNAL BOX (SHARE BOX WEAPONS)
This will make the box weapon take-able for all players, not just the person that hit the box.All changes will be in your _zombiemode_weapons.gsc, treasure_chest_think() function.I have provided two options, the few steps necessary for this, or at the bottom of the page you can select and replace the entire function.
Step-by-step
Locate the treasure_chest_think() function.
Replace the following:
self setvisibletoplayer( user );
with
self setvisibletoplayer( user ); self thread GiveMeASecond(); //gives the player who hit the box time to take weapon
Replace the following:
if( grabber == user || grabber == level )
with
if( is_player_valid(grabber) || grabber == level )
Replace the following:
if( grabber == user && is_player_valid( user ) && user GetCurrentWeapon() != "mine_bouncing_betty" )
with
user = grabber; if( is_player_valid( user ) && user GetCurrentWeapon() != "mine_bouncing_betty" )
Then add the following function after the treasure_chest_think() function function
GiveMeASecond(){ wait(3); //gives the buyer 3 seconds to chose to take it self SetVisibleToAll(); }
or, if it is easier for you, just replace your whole treasure_chest_think() function with this:
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 ); self thread GiveMeASecond(); // 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 money gets the item // SRS 9/3/2008: ...or item goes back into the box if we time out while( 1 ) { self waittill( "trigger", grabber ); if( is_player_valid(grabber) || grabber == level ) { user = grabber; if( is_player_valid( user ) && user GetCurrentWeapon() != "mine_bouncing_betty" ) { bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type magic_accept", user.playername, user.score, level.round_number, cost, weapon_spawn_org.weapon_string, self.origin ); self notify( "user_grabbed_weapon" ); user thread treasure_chest_give_weapon( weapon_spawn_org.weapon_string ); break; } else if( grabber == level ) { // it timed out self.timedOut = true; bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type magic_reject", user.playername, user.score, level.round_number, cost, weapon_spawn_org.weapon_string, self.origin ); break; } } wait 0.05; } self.grab_weapon_hint = false; self.chest_user = undefined; weapon_spawn_org notify( "weapon_grabbed" ); //increase counter of amount of time weapon grabbed. if(level.script != "nazi_zombie_prototype") { level.chest_accessed += 1; // PI_CHANGE_BEGIN // JMA - we only update counters when it's available if( isDefined(level.DLC3.useChestPulls) && level.DLC3.useChestPulls ) { level.pulls_since_last_ray_gun += 1; } if( isDefined(level.DLC3.useChestPulls) && level.DLC3.useChestPulls ) { level.pulls_since_last_tesla_gun += 1; } // PI_CHANGE_END } self disable_trigger(); // spend cash here... // give weapon here... lid thread treasure_chest_lid_close( self.timedOut ); //Chris_P //magic box dissapears and moves to a new spot after a predetermined number of uses wait 3; self enable_trigger(); self setvisibletoall(); } flag_clear("moving_chest_now"); self thread treasure_chest_think(); } GiveMeASecond(){ wait(3); self SetVisibleToAll(); }