Buyable Auto Turrets

From CustomCoD Wiki

Jump to: navigation, search

Contents

Information

This will teach you how to get auto turrets that are buyable in your map. These turrets will automatically shoot at the zombies.

Radiant

Make a trigger_use and give it a KVP of:

"targetname" "activate_mg"

Now, create a misc_turret or several of them. Give it these KVPs:

"targetname" "auto_mg"
"model" "mounted_usa_30cal_bipod_lmg"
"weaponinfo" "30cal_bipod_stand"

Available model values

mounted_usa_30cal_bipod_lmg
mounted_ger_mg42_bipod_mg
mounted_ger_fg42_bipod_lmg
mounted_jap_type99_bipod_lmg
mounted_rus_dp28_bipod_lmg
mounted_usa_bar_bipod_lmg

Available weaponinfo values

mg42_bipod_stand
30cal_bipod_stand
bar_bipod_stand
fg42_bipod_stand
type99_lmg_bipod_stand
dp28_bipod_stand

GSC Files

Create a new GSC file and name it auto_turrets.gsc. Put this code in it:

#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_utility;

main()
{
   level thread manage_mg();
}

manage_mg()
{
   while(1)
   {
      // SET COST HERE
      cost = 1000;

      player = undefined;
      trigs = getentarray( "activate_mg", "targetname");

      for(i = 0; i < trigs.size; i++)
      {
         trig = trigs[i];
      
         trig setcursorhint("HINT_NOICON");
         trig usetriggerrequirelookat();
         trig sethintstring("Press &&1 to activate Auto Turrets [Cost: " + cost + "]");
         trig waittill("trigger", player);

         if(!is_player_valid(player))
         {
            continue;
         }

         if(player.score >= cost)
         {
            level thread activate_mg();
            player playsound("cha_ching");
            player maps\_zombiemode_score::minus_to_player_score( cost );
            trig sethintstring("^3Auto Turrets ^2ON!");
            wait(30); // Wait 30 seconds and then turn them off
            trig sethintstring("Auto Turrets are currently unavailable");
            wait(120); // Cool-down for 120 seconds
            trig sethintstring("Press &&1 to activate Auto Turrets [Cost: " + cost + "]");
         }
         else
         {
            player playsound("no_cha_ching");
         }
      }
      wait(0.05);
   }
}
         
activate_mg()
{
   mgs = getentarray( "auto_mg", "targetname" );
            
   for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
      mg setTurretTeam( "allies" );
      mg SetMode( "auto_nonai" );
      mg thread maps\_mgturret::burst_fire_unmanned();
   }

   wait(30); // Leave turrets on for 30 seconds
            
   for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
      mg notify("stop_burst_fire_unmanned");
      mg SetMode( "manual" );
   }
}


Next, open nazi_zombie_yourmap.gsc [Root]raw\maps and put this in the main() function:

maps\auto_turrets::main();

Mod Folder

Open the mod folder for your map [Root]mods\nazi_zombie_yourmaphere.

Now, create a new folder and name it maps.

Go to [Root]raw\maps and copy _mgturret.gsc and auto_turrets.gsc into [Root]mods\yourmap\nazi_zombie_yourmaphere\maps.

Mod Builder

Open Launcher and go to the Mod Builder. Check these options:

- Build mod.ff Fastfile - Build IWD File

Then, in the IWD File List, check this:

- maps

Click "Build Mod".


Tutorial by, HOGRampage

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