I have a problem when I tested the Sniperbolt's pandora boxes... I placed 6 chest on my map (start_chest, chest1, chest2, chest3, chest4, chest5) When I get the teddy bear on the pandora box is formed in the same location.
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; } } }
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[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" );
// 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." );
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." );
if(isDefined(level.DLC3.usePandoraBoxLight) && level.DLC3.usePandoraBoxLight) { // 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: we need a smaller light in the catacombs for paris, the generic one fills the area under the tower. else if(level.script == "nazi_zombie_paris") { // 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");
//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" ); } }
// PI_CHANGE_BEGIN - JMA - we want to play another effect on swamp anchor = GetEnt(self.target, "targetname"); anchorTarget = GetEnt(anchor.target, "targetname");
// 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();
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 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( grabber == user || grabber == level ) {
if( grabber == user && 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; } }
// // Disable trigger if can't buy weapon and also if someone else is using the chest decide_hide_show_chest_hint( endon_notify ) { if( isDefined( endon_notify ) ) { self endon( endon_notify ); }
while( true ) { players = get_players(); for( i = 0; i < players.size; i++ ) { // chest_user defined if someone bought a weapon spin, false when chest closed if ( (IsDefined(self.chest_user) && players[i] != self.chest_user ) || !players[i] can_buy_weapon() ) { self SetInvisibleToPlayer( players[i], true ); } else { self SetInvisibleToPlayer( players[i], false ); } } wait( 0.1 ); } }
//This keeps multiple voice overs from playing on the same player (both killstreaks and headshots). if (level.player_is_speaking != 1 && isDefined(sound)) { level.player_is_speaking = 1; self playsound(sound, "sound_done"); self waittill("sound_done"); level.player_is_speaking = 0; }
//TUEY - Play the 'disappear' sound playsoundatposition ("box_poof", soundpoint.origin); for(i=0;i<fake_pieces.size;i++) { fake_pieces[i] delete(); }
//gzheng-Show the rubble //PI CHANGE - allow for more than one object of rubble per box rubble = getentarray(self.script_noteworthy + "_rubble", "script_noteworthy");
if ( IsDefined( rubble ) ) { for (i = 0; i < rubble.size; i++) { rubble[i] show(); } } else { println( "^3Warning: No rubble found for magic box" ); }
wait(0.1); anchor delete(); soundpoint delete();
old_chest_index = level.chest_index;
wait(5);
//chest moving logic //PI CHANGE - for sumpf, this doesn't work because chest_index is always incremented twice (here and line 724) - while this would work with an odd number of chests, // with an even number it skips half of the chest locations in the map
level.verify_chest = false; //wait(3); //make sure level is asylum, factory, or sumpf and make magic box only appear in location player have open, it's off by default //also make sure box doesn't respawn in old location. //PI WJB: removed check on "magic_box_explore_only" dvar because it is only ever used here and when it is set in _zombiemode.gsc line 446 // where it is declared and set to 0, causing this while loop to never happen because the check was to see if it was equal to 1 if( isDefined(level.DLC3.useChestMoves) && level.DLC3.useChestMoves) { level.chest_index++;
if (level.chest_index >= level.chests.size) { //PI CHANGE - this way the chests won't move in the same order the second time around temp_chest_name = level.chests[level.chest_index - 1].script_noteworthy; level.chest_index = 0; level.chests = array_randomize(level.chests); //in case it happens to randomize in such a way that the chest_index now points to the same location // JMA - want to avoid an infinite loop, so we use an if statement if (temp_chest_name == level.chests[level.chest_index].script_noteworthy) { level.chest_index++; } //END PI CHANGE }
//turn off magic box light. level notify("magic_box_light_switch"); //PI CHANGE - altered to allow for more than one object of rubble per box unhide_magic_box( level.chest_index );
} //verify if that magic box is open to players or not. verify_chest_is_open() {
//for(i = 0; i < 5; i++) //PI CHANGE - altered so that there can be more than 5 valid chest locations for (i = 0; i < level.open_chest_location.size; i++) { if(isdefined(level.open_chest_location[i])) { if(level.open_chest_location[i] == level.chests[level.chest_index].script_noteworthy) { level.verify_chest = true; return; } }
// Check the pack a punch machines to see if they are holding what we're looking for for ( k=0; k<pap_triggers.size; k++ ) { if ( IsDefined(pap_triggers[k].current_weapon) && pap_triggers[k].current_weapon == keys2[q] ) { count++; } }
// Check the pack a punch machines to see if they are holding what we're looking for for ( k=0; k<pap_triggers.size; k++ ) { if ( IsDefined(pap_triggers[k].current_weapon) && pap_triggers[k].current_weapon == keys2[q] ) { count++; } }
//increase the chance of joker appearing from 0-100 based on amount of the time chest has been opened. if(level.script != "nazi_zombie_prototype" && getdvar("magic_chest_movable") == "1") {
if(level.chest_accessed < level.chest_min_move_usage) { // PI_CHANGE_BEGIN - JMA - RandomInt(100) can return a number between 0-99. If it's zero and chance_of_joker is zero // we can possibly have a teddy bear one after another. chance_of_joker = -1; // PI_CHANGE_END } else { chance_of_joker = level.chest_accessed + 20;
// make sure teddy bear appears on the 8th pull if it hasn't moved from the initial spot if( (!isDefined(level.magic_box_first_move) || level.magic_box_first_move == false ) && level.chest_accessed >= 8) { chance_of_joker = 100; }
// pulls 4 thru 8, there is a 15% chance of getting the teddy bear // NOTE: this happens in all cases if( level.chest_accessed >= 4 && level.chest_accessed < 8 ) { if( random < 15 ) { chance_of_joker = 100; } else { chance_of_joker = -1; } }
// after the first magic box move the teddy bear percentages changes if( isDefined(level.magic_box_first_move) && level.magic_box_first_move == true ) { // between pulls 8 thru 12, the teddy bear percent is 30% if( level.chest_accessed >= 8 && level.chest_accessed < 13 ) { if( random < 30 ) { chance_of_joker = 100; } else { chance_of_joker = -1; } }
// after 12th pull, the teddy bear percent is 50% if( level.chest_accessed >= 13 ) { if( random < 50 ) { chance_of_joker = 100; } else { chance_of_joker = -1; } } } }
if (random <= chance_of_joker) { model SetModel("zombie_teddybear"); // model rotateto(level.chests[level.chest_index].angles, 0.01); //wait(1); model.angles = self.angles; wait 1; flag_set("moving_chest_now"); self notify( "move_imminent" ); level.chest_accessed = 0;
player maps\_zombiemode_score::add_to_player_score( 950 );
//allow power weapon to be accessed. level.box_moved = true; } }
self notify( "randomization_done" );
if (flag("moving_chest_now")) { wait .5; // we need a wait here before this notify level notify("weapon_fly_away_start"); wait 2; model MoveZ(500, 4, 3); model waittill("movedone"); model delete(); self notify( "box_moving" ); level notify("weapon_fly_away_end"); } else {
//turn off power weapon, since player just got one if( rand == "tesla_gun" || rand == "ray_gun" ) { // PI_CHANGE_BEGIN - JMA - reset the counters for tesla gun and ray gun pulls if(isDefined(level.DLC3.useWeaponSpawn) && level.DLC3.useWeaponSpawn ) { if( rand == "ray_gun" ) { level.box_moved = false; level.pulls_since_last_ray_gun = 0; }
model thread timer_til_despawn(floatHeight); self waittill( "weapon_grabbed" );
if( !chest.timedOut ) { model Delete(); }
} } timer_til_despawn(floatHeight) {
// SRS 9/3/2008: if we timed out, move the weapon back into the box instead of deleting it putBackTime = 12; self MoveTo( self.origin - ( 0, 0, floatHeight ), putBackTime, ( putBackTime * 0.5 ) ); wait( putBackTime );
// self is the player string comes from the randomization function treasure_chest_give_weapon( weapon_string ) { primaryWeapons = self GetWeaponsListPrimaries(); current_weapon = undefined;
// This should never be true for the first time. if( primaryWeapons.size >= 2 ) // he has two weapons { current_weapon = self getCurrentWeapon(); // get hiss current weapon
if( weapon_string == "molotov" || weapon_string == "molotov_zombie" ) { // PI_CHANGE_BEGIN // JMA 051409 sanity check to see if we have the weapon before we remove it has_weapon = self HasWeapon( "zombie_cymbal_monkey" ); if( isDefined(has_weapon) && has_weapon ) { self TakeWeapon( "zombie_cymbal_monkey" ); } // PI_CHANGE_END } if( weapon_string == "zombie_cymbal_monkey" ) { // PI_CHANGE_BEGIN // JMA 051409 sanity check to see if we have the weapon before we remove it has_weapon = self HasWeapon( "molotov" ); if( isDefined(has_weapon) && has_weapon ) { self TakeWeapon( "molotov" ); }
// Allow people to get ammo off the wall for upgraded weapons player_has_weapon = player has_weapon_or_upgrade( self.zombie_weapon_upgrade ); /* player_has_weapon = false; weapons = player GetWeaponsList(); if( IsDefined( weapons ) ) { for( i = 0; i < weapons.size; i++ ) { if( weapons[i] == self.zombie_weapon_upgrade ) { player_has_weapon = true; } } } */
if( !player_has_weapon ) { // else make the weapon show and give it if( player.score >= cost ) { if( self.first_time_triggered == false ) { model = getent( self.target, "targetname" ); // model show(); model thread weapon_show( player ); self.first_time_triggered = true;
player maps\_zombiemode_score::minus_to_player_score( cost );
bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type weapon", player.playername, player.score, level.round_number, cost, self.zombie_weapon_upgrade, self.origin );
player weapon_give( self.zombie_weapon_upgrade ); } else { play_sound_on_ent( "no_purchase" ); player thread maps\nazi_zombie_sumpf_blockers::play_no_money_purchase_dialog();
} } else { // MM - need to check and see if the player has an upgraded weapon. If so, the ammo cost is much higher if ( player has_upgrade( self.zombie_weapon_upgrade ) ) { ammo_cost = 4500; } else { ammo_cost = get_ammo_cost( self.zombie_weapon_upgrade ); }
// if the player does have this then give him ammo. if( player.score >= ammo_cost ) { if( self.first_time_triggered == false ) { model = getent( self.target, "targetname" ); // model show(); model thread weapon_show( player ); self.first_time_triggered = true; if(!is_grenade) { self SetHintString( &"ZOMBIE_WEAPONCOSTAMMO", cost, get_ammo_cost( self.zombie_weapon_upgrade ) ); } }
if( player HasWeapon( self.zombie_weapon_upgrade ) && player has_upgrade( self.zombie_weapon_upgrade ) ) { ammo_given = player ammo_give( self.zombie_weapon_upgrade, true ); } else if( player has_upgrade( self.zombie_weapon_upgrade ) ) { ammo_given = player ammo_give( self.zombie_weapon_upgrade+"_upgraded" ); } else { ammo_given = player ammo_give( self.zombie_weapon_upgrade ); }
if( ammo_given ) { player maps\_zombiemode_score::minus_to_player_score( ammo_cost ); // this give him ammo to early
bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type ammo", player.playername, player.score, level.round_number, ammo_cost, self.zombie_weapon_upgrade, self.origin ); } } else { play_sound_on_ent( "no_purchase" ); } } } }
//if is not an upgraded perk purchase if( !IsDefined( is_upgrade ) ) { is_upgrade = false; }
// This should never be true for the first time. if( primaryWeapons.size >= 2 ) // he has two weapons { current_weapon = self getCurrentWeapon(); // get his current weapon
if( weapon == "zombie_cymbal_monkey" ) { // PI_CHANGE_BEGIN // JMA 051409 sanity check to see if we have the weapon before we remove it has_weapon = self HasWeapon( "molotov" ); if( isDefined(has_weapon) && has_weapon ) { self TakeWeapon( "molotov" ); }
// Should we give ammo to the player give_ammo = false;
// Check to see if ammo belongs to a primary weapon if( weapon != "fraggrenade" && weapon != "stielhandgranate" && weapon != "molotov" ) { if( isdefined( weapon ) ) { // get the max allowed ammo on the current weapon stockMax = WeaponMaxAmmo( weapon ); if( also_has_upgrade ) { stockMax += WeaponMaxAmmo( weapon+"_upgraded" ); }
// Get the current weapon clip count clipCount = self GetWeaponAmmoClip( weapon );
currStock = self GetAmmoCount( weapon );
// compare it with the ammo player actually has, if more or equal just dont give the ammo, else do if( ( currStock - clipcount ) >= stockMax ) { give_ammo = false; } else { give_ammo = true; // give the ammo to the player } } } else { // Ammo belongs to secondary weapon if( self has_weapon_or_upgrade( weapon ) ) { // Check if the player has less than max stock, if no give ammo if( self getammocount( weapon ) < WeaponMaxAmmo( weapon ) ) { // give the ammo to the player give_ammo = true; } } }
I tried it and it works. But I experienced a strange thing when the treasure_chest_1 box arrives, immediately disappears. I have no idea where, so no more lottery. Maybe it does not work in the case, if there are six boxes (start_chest, chest1, chest2, chest3, chest4 and chest5). Eh?
Last Edit: February 06, 2015, 07:45:04 pm by Deer2014
If you want scripts / features made for you, then contact me by PM or email / skype etc it will cost you tho so if you have no intention of reciprocating don't even waste my time
I tried it and it works. But I experienced a strange thing when the treasure_chest_1 box arrives, immediately disappears. I have no idea where, so no more lottery. Maybe it does not work in the case, if there are six boxes (start_chest, chest1, chest2, chest3, chest4 and chest5). Eh?
Haven't tried with all the boxes but i have tried with 4 and it works.
Looks like random start chest doesn't work with the UGX mod tools patch - sorry.
I build it and test, so.... It's working the level start random and lottery random when there are six boxes with UGX Mod Tools patch, plus I use daedra descent's _zombiemode_weapon.gsc.
I thank you for your guidance, daedra descent and Harry Bo21!.
Last Edit: February 07, 2015, 04:36:31 pm by Deer2014