Buyable Satchel Charges

From CustomCoD Wiki

Jump to: navigation, search

Contents

Information

This will show you how to add buyable satchel charges to your map and also fix the problem where they replace one of your weapons, and does not allow you to get another weapon in that slot. It will also show you how to add the them to the random weapon box.

Radiant

Put a trigger_use where you want the buy trigger for the satchel charges to be. Give it the following KVPs:

"targetname" "satchel_purchase"
"zombie_cost" "2000"

Save and close.

Zombie Mode Weapons GSC

Open _zombiemode_weapons.gsc [Root]raw\maps and go to line 939 or search for the function treasure_chest_give_weapon( weapon_string ). Then, replace the function with this (NOTE: This includes the code for the mortar round as well):

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 ( current_weapon == "mine_bouncing_betty" || current_weapon == "mortar_round" || current_weapon == "satchel_charge_new" )
      {
         current_weapon = undefined;
      }

      if( isdefined( current_weapon ) )
      {
         if( !( weapon_string == "fraggrenade" || weapon_string == "stielhandgranate" || weapon_string == "molotov" || weapon_string == "mortar_round" || weapon_string == "satchel_charge_new" ) )
         {
            self TakeWeapon( current_weapon );
         }
      
         if( weapon_string == "mortar_round" )
         {
            self GiveWeapon( "mortar_round");
            self SetActionSlot( 1,"weapon","mortar_round" );
            self SwitchToOffHand( "mortar_round" );
         }

         if( weapon_string == "satchel_charge_new" )
         {
            self GiveWeapon( "satchel_charge_new");
            self setactionslot(1,"weapon","satchel_charge_new");
            self SwitchToOffHand( "satchel_charge_new" );
         }
      }
   }

   if( IsDefined( primaryWeapons ) && !isDefined( current_weapon ) )
   {
      for( i = 0; i < primaryWeapons.size; i++ )
      {
         if( primaryWeapons[i] == "zombie_colt" )
         {
            continue;
         }

         if( weapon_string != "fraggrenade" && weapon_string != "stielhandgranate" && weapon_string != "molotov" && weapon_string != "mortar_round" && weapon_string != "satchel_charge_new" )
         {
            self TakeWeapon( primaryWeapons[i] );
         }
         
         if( weapon_string == "mortar_round" )
         {
            self GiveWeapon( "mortar_round");
            self SetActionSlot( 1,"weapon","mortar_round" );
            self SwitchToOffHand( "mortar_round" );
         }

         if( weapon_string == "satchel_charge_new" )
         {
            self GiveWeapon( "satchel_charge_new");
            self setactionslot(1,"weapon","satchel_charge_new");
            self SwitchToOffHand( "satchel_charge_new" );
         }
      }
   }

   self play_sound_on_ent( "purchase" );

   self GiveWeapon( weapon_string, 0 );
   self GiveMaxAmmo( weapon_string );
   self SwitchToWeapon( weapon_string );

   play_weapon_vo(weapon_string);

   // self playsound (level.zombie_weapons[weapon_string].sound);
}

Save and close.

Map GSC

Open nazi_zombie_yourmap.gsc [Root](raw\maps. First, add this line in main()

maps\_zombiemode_weapons::add_zombie_weapon( "satchel_charge_new",&"ZOMBIE_SATCHEL_PURCHASE", 2000 );
satchel_trigs = getentarray("satchel_purchase","targetname");
array_thread(satchel_trigs,::buy_satchel);

Second, put this in the include_weapons() function:

include_weapon("satchel_charge_new");

Then, create a new function:

buy_satchel()
{
   while(1)
   {
      has_satchel = 0;
      who = undefined;

      self SetCursorHint( "HINT_ACTIVATE" );
      self UseTriggerRequireLookAt();
      self sethintstring( &"ZOMBIE_SATCHEL_PURCHASE" );
      self waittill("trigger", who);

      if( who in_revive_trigger() )
      {
         continue;
      }
                  
      if( is_player_valid( who ) )
      {
         
         if( who.score >= self.zombie_cost )
         {            
            who playsound( "cha_ching" );

            who maps\_zombiemode_score::minus_to_player_score( self.zombie_cost );
            who giveweapon("satchel_charge_new");
            who setactionslot(1,"weapon","satchel_charge_new");
            has_satchel = 1;
         }
         else
         {
            who playsound( "no_cha_ching" );
         }
      }

      level waittill( "between_round_over" );
      {
         if( has_satchel > 0 )
         {
            who givestartammo("satchel_charge_new");
         }
      }
   }
}


Save and close.

Zone Source

Open nazi_zombie_yourmap.csv [Root]zone_source and add the following to it:

weapon,sp/satchel_charge_new
fx,weapon/satchel/fx_explosion_satchel_generic

Save and close.

STR File

Open zombie.str [Root]raw\english\localizedstrings and add the following to it:

REFERENCE           SATCHEL_PURCHASE
LANG_ENGLISH        "Press & hold &&1 to buy Satchel Charges [Cost: 2000]"

Save and close.

Conclusion

This fix will:

- Allow players to buy satchel charges without having a primary weapon replaced - Allow players to get satchel charges from the random weapon box, without having a primary weapon replaced - Limit the amount of satchels the player can use per round to 3 (i.e. Buy from wall; get one from random crate, get one from wall; etc.) - Give a player that already had or bought a satchels 3 satchel charges each round (note that this may count towards the limit of 3 per round) - Allow players to have bouncing betties and satchel charges (satchels have their own slot)

Image:Note.pngNote: As of right now, buying or taking satchel charges will replace mortar rounds.

Tutorial by, HOGRampage

Personal tools
Call of Duty: Black Ops
Call of Duty: World at War