SHARE
TWEET

Untitled

a guest Jun 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\_anim;
  2. #include maps\_utility;
  3. #include common_scripts\utility;
  4. #include maps\_music;
  5. #include maps\_zombiemode_utility;
  6. #include maps\_busing;
  7.  
  8. #using_animtree( "generic_human" );
  9.  
  10. // thief Scripts Begin - Redspace200
  11. // Radiant Script Origin --> "targetname" "thief_teleport_location"
  12.  
  13. init_thief()
  14. {
  15.     level.next_dog_round = 0;
  16.     level thread ai_thief_spawning_func();
  17.     level.next_thief_round = 5;
  18.     level.spawns_with_zom = false;
  19. }
  20. ai_thief_spawning_func()
  21. {
  22.     if (level.spawns_with_zom == false)
  23.         level waittill_either("power_on","juggernog_on");
  24.     while(true)
  25.     {
  26.         level waittill("between_round_over");
  27.         if (level.round_number >= level.next_thief_round)
  28.         {
  29.             if (isdefined(level.moonguy_next) ) level.moonguy_next += 1;
  30.             if (level.spawns_with_zom == false)
  31.             {
  32.                 level.round_spawn_func = ::spawn_thief_ai_boss;
  33.                 level waittill("thief_round_over");
  34.                 level.round_spawn_func = maps\_zombiemode::round_spawning;
  35.             }
  36.             else level spawn_thief_ai_boss();
  37.             level.next_thief_round = level.round_number + randomIntRange(4,6);
  38.         }
  39.     }
  40. }
  41. spawn_thief_ai_boss()
  42. {
  43.     players = getPlayers();
  44.     for(i=0;i<players.size;i++)
  45.         players[i] thread thief_roundSounder("begin");
  46.     level thread thief_alarm();
  47.     spawn_point = undefined; use_spawn_point = undefined;
  48.     teh_spawns = undefined;
  49.     for(am=0;am<50;am++)
  50.     {
  51.         wait .05;
  52.         teh_spawns = level.enemy_spawns;
  53.         for(t=0;t<teh_spawns.size;t++)
  54.         {
  55.             wait .05;
  56.             use_spawn_point = teh_spawns[t];
  57.             if (use_spawn_point.script_noteworthy == "find_flesh") break;
  58.         }
  59.         spawn_points = GetStructArray("find_flesh","script_noteworthy");
  60.         num = randomIntRange(0,spawn_points.size);
  61.         spawn_point = spawn_points[num];
  62.         if (spawn_point inMap() && isdefined(spawn_point) ) { break; }
  63.     }
  64.     ai = spawn_zombie( use_spawn_point ); wait .05;
  65.     if (isdefined(ai) )
  66.     {
  67.         ai forceTeleport(spawn_point.origin);
  68.         ai.is_on_fire = true;
  69.         ai.script_string = "riser";
  70.         ai.boss_enemy = true; wait .01; ai notify("no_rise");
  71.         wait .04;
  72.         ai.gibbed = true;
  73.         ai StopAnimScripted();
  74.         playfx(level._effect["transporter_beam"], ai.origin); wait .05;
  75.         zombie_poi = ai get_zombie_point_of_interest( ai.origin );
  76.         ai.enemyoverride = zombie_poi;
  77.         ai thief_set_movement_animation("walking");
  78.         ai thread thief_visible_thread();
  79.         ai thread thief_get_target_player();
  80.        
  81.         if (!isdefined(ai.favoriteenemy) && isdefined(ai) )
  82.             while (!isdefined(ai.favoriteenemy) && isdefined(ai) )
  83.                 wait .05;
  84.         if (!isdefined(ai) ) return;
  85.        
  86.         ai thread maps\_zombiemode_spawner::zombie_setup_attack_properties();
  87.         ai forceteleport(ai.origin+(0,0,38));
  88.         wait .05;
  89.         ai.ignoreall = true;
  90.         ai DetachAll();
  91.         ai setModel("bo1_c_zom_electrician_body");
  92.         ai.health = (level.zombie_health*18)*getPlayers().size; wait .05;
  93.         ai thread thief_thinker();
  94.         ai thread thief_sounds_thinker();
  95.         ai thread thief_death();
  96.         ai thread thief_fx();
  97.         ai thread thief_roundend_failsafe();
  98.         while(isdefined(ai) && ai.health > 0)
  99.             wait .05;
  100.     }
  101. }
  102. thief_alarm()
  103. {
  104.     level endon("thief_round_over");
  105.     while(true)
  106.     {
  107.         wait 4;
  108.         getPlayers()[0] playSound("thief_alarm");
  109.     }
  110. }
  111. thief_fx()
  112. {
  113.     f = spawn("script_model",self.origin);
  114.     f setModel("tag_origin");
  115.     f linkTo(self);
  116.     playFxOnTag(level._effect["thief_trail"], f, "tag_origin");
  117.     while(self.health > 1 && isdefined(self) ) { f.origin = self.origin+(0,0,16); wait .05; }
  118.     f delete();
  119. }
  120. thief_bad_path()
  121. {
  122.     self endon("death");
  123.     self thread thief_bad_path_checker();
  124.     while(isdefined(self) )
  125.     {
  126.         self waittill("bad_path");
  127.         self.zombie_bad_path = true;
  128.         self waittill("stop_zombie_bad_path");
  129.         self.zombie_bad_path = undefined;
  130.     }
  131. }
  132. thief_bad_path_checker()
  133. {
  134.     self endon("death");
  135.     while(isdefined(self) )
  136.     {
  137.         if (isdefined(self.zombie_bad_path) )
  138.         {
  139.             self animScripted("zombie_taunt", self.origin, self.angles, %ai_thief_idle);
  140.             wait getAnimLength(%ai_thief_idle);
  141.         }
  142.         wait .05;
  143.     }
  144. }
  145. thief_get_target_player()
  146. {
  147.     self endon("death");
  148.     if (!IsDefined(self.target_array) )
  149.     {
  150.         self.target_array = [];
  151.         players = getPlayers();
  152.         for(i=0;i<players.size;i++)
  153.             self.target_array[i] = false;
  154.     }
  155.     if (!IsDefined(self.weapon_stolen_array) )
  156.     {
  157.         self.weapon_stolen_array = [];
  158.         players = getPlayers();
  159.         for(i=0;i<players.size;i++)
  160.             self.weapon_stolen_array[i] = "none";
  161.     }
  162.     while(true)
  163.     {
  164.         wait .05;
  165.         players = getPlayers();
  166.         num = randomIntRange(0,players.size+1);
  167.         if (num>players.size) num = players.size;
  168.         if (self.target_array[players[num] GetEntityNumber()] == false && players[num].sessionstate != "spectator" && isAlive(players[num]) && !isdefined(players[num].revivetrigger) )
  169.         {
  170.             self.target_array[players[num] GetEntityNumber()] = true;
  171.             self thief_set_movement_animation("walking");
  172.             self setVisibleToAll();
  173.             for(i=0;i<players.size;i++)
  174.                 if (self.target_array[players[i] GetEntityNumber()] == false)
  175.                     self setInvisibleToPlayer(players[i]);
  176.             self.favoriteenemy = players[num];
  177.             // iprintln("targeting player: "+num);
  178.             self.thief_targeting = true;
  179.             while(players[num].sessionstate != "spectator" && isAlive(players[num]) && !isdefined(players[num].revivetrigger) && isdefined(self.weapon_stolen_array[num]) && self.weapon_stolen_array[num] == "none" )
  180.             {
  181.                 if (isdefined(self.favoriteenemy) && Distance(self.origin,self.favoriteenemy.origin) <= 62 && !isdefined(self.favoriteenemy.revivetrigger) && isdefined(self.weapon_stolen_array[num]) && self.weapon_stolen_array[num] == "none" && isdefined(self.t) && self.t >= 2)
  182.                 {
  183.                     self thread thief_steal_weapon(self.favoriteenemy);
  184.                     self thread thief_capture_player();
  185.                     wait .08;
  186.                     self thread thief_rotatePlayer(self.favoriteenemy);
  187.                     self waittill("thief_attack_complete");
  188.                     self DetachAll();
  189.                     wait .05;
  190.                     self attach(getWeaponModel(self.weapon_stolen_array[self.favoriteenemy GetEntityNumber()]),"tag_stowed_back",true);
  191.                     break;
  192.                 }
  193.                 else if (!isdefined(self.favoriteenemy) )
  194.                     break;
  195.                 wait .05;
  196.             }
  197.             if (self thief_attacked_all_players() )
  198.                 break;
  199.         }
  200.     }
  201.     self.thief_movetype = "sprint";
  202.     self.thief_targeting = undefined;
  203.     self.favoriteenemy = undefined;
  204.     self.thief_fleeing = true;
  205.     time = (randomIntRange(30,65))/getPlayers().size;
  206.     if (time < 18) time = 18;
  207.     while(isdefined(self) && time > 0)
  208.     {
  209.         if (self.health < 1)
  210.             return;
  211.         time -= .05;
  212.         wait .05;
  213.     }
  214.     if (self.health >= 1)
  215.     {
  216.         playfx(level._effect["transporter_beam"], self.origin);
  217.         self hide();
  218.         self detachAll();
  219.         self notify("alt_death");
  220.         wait .05;
  221.         players = getPlayers();
  222.         for(i=0;i<players.size;i++)
  223.             players[i] thread thief_roundSounder("end");
  224.         wait .05;
  225.         self DoDamage( self.health + 666, self.origin );
  226.     }
  227. }
  228. thief_steal_weapon(player)
  229. {
  230.     wpn = player getCurrentWeapon();
  231.     self.weapon_stolen_array[player GetEntityNumber()] = wpn;
  232.     player takeWeapon(wpn);
  233.     player DisableOffHandWeapons(); player DisableWeaponCycling();
  234.     player giveWeapon("player_hands_lookat"); player switchToWeapon("player_hands_lookat");
  235.     wait 2.65;
  236.     player takeWeapon("player_hands_lookat");
  237.     player EnableOffHandWeapons(); player EnableWeaponCycling();
  238.     self thread thief_teleport(player);
  239.     player freezeControls( false );
  240.     if (player GetWeaponsListPrimaries().size != 0)
  241.         player switchToWeapon( player GetWeaponsListPrimaries()[0] );
  242. }
  243. thief_set_movement_animation(type)
  244. {
  245.     if (!IsDefined(type) ) return;
  246.     if (type == "walking" || type == "walk")
  247.     {
  248.         self.t = 0;
  249.         self.thief_sprinting = undefined;
  250.         self.run_combatanim = level.scr_anim["zombie"]["thief_walk_v"+2];
  251.         self set_run_anim("thief_walk_v"+2);
  252.         self.thief_movetype = "walk";
  253.     }
  254.     if (type == "sprint")
  255.     {
  256.         self.run_combatanim = level.scr_anim["zombie"]["thief_sprint"];
  257.         self set_run_anim("thief_sprint");
  258.         self.thief_movetype = "sprint";
  259.     }
  260. }
  261. thief_attacked_all_players()
  262. {
  263.     players = getPlayers();
  264.     attacked = 0;
  265.     for(i=0;i<players.size;i++)
  266.         if (isdefined(self.weapon_stolen_array[i]) && self.weapon_stolen_array[i] != "none")
  267.             attacked += 1;
  268.     if (attacked == players.size)
  269.         return true;
  270.     else
  271.         return false;
  272. }
  273. thief_death()
  274. {
  275.     self endon("alt_death");
  276.     self thread thief_powerup_dropper();
  277.     self waittill("death");
  278.     self detachAll();
  279.     players = getPlayers();
  280.     for(i=0;i<players.size;i++)
  281.     {
  282.         if (!isdefined(self.weapon_stolen_array) ) break;
  283.         if (self.weapon_stolen_array[i] != "none" && isdefined(self.weapon_stolen_array[i]) )
  284.         {
  285.             if ((players[i] GetWeaponsListPrimaries().size >= 2 && !players[i] hasPerk("specialty_extraammo")) || (players[i] GetWeaponsListPrimaries().size >= 3 && players[i] hasPerk("specialty_extraammo")) )
  286.                 players[i] takeWeapon(players[i] getCurrentWeapon() );
  287.             players[i] giveWeapon(self.weapon_stolen_array[i]);
  288.             players[i] switchToWeapon(self.weapon_stolen_array[i]);
  289.         }
  290.     }
  291.     num = randomIntRange(0,4);
  292.     if (num >= 4) num = 3;
  293.     self playSound("thief_death_"+num);
  294.     players = getPlayers();
  295.     for(i=0;i<players.size;i++)
  296.         players[i] thread thief_roundSounder("end");
  297. }
  298. thief_thinker()
  299. {
  300.     self endon("death");
  301.     self.thief_sprinting = undefined;
  302.     health_sticky = self.health;
  303.     self.t = 0;
  304.     target_position = undefined; new_target_position = undefined;
  305.     while(isdefined(self) )
  306.     {
  307.         // Sticky Vars
  308.         wait .05;
  309.         if (self.t < 3) self.t += .05;
  310.         self.goalradius = 32;
  311.         self.ignore_player = undefined;
  312.         self.ignoreall = true;
  313.         self.is_on_fire = true;
  314.         self.gibbed = true;
  315.         self.deathanim = undefined;
  316.         self OrientMode( "face default" );
  317.         if (IsDefined(self.thief_targeting) && isdefined(self.favoriteenemy) )
  318.         {
  319.             self setGoalPos(self.favoriteenemy.origin);
  320.             if (((Distance(self.favoriteenemy.origin,self.origin) <= 200 && 0 != self.favoriteenemy DamageConeTrace( self.origin, self ) ) || self.health != health_sticky) && !isdefined(self.thief_sprinting) && self.t >= 2.95 )
  321.             {
  322.                 self.thief_sprinting = true;
  323.                 self thread thief_activate_sprint();
  324.             }
  325.         }
  326.         else if (isdefined(self.thief_fleeing) )
  327.         {
  328.             if (!isdefined(target_position) || getDogSpawns().size == 1 )
  329.                 target_position = getDogSpawns()[randomInt(getDogSpawns().size)].origin;
  330.             else
  331.             {
  332.                 while(true)
  333.                 {
  334.                     wait .05;
  335.                     new_target_position = getDogSpawns()[randomInt(getDogSpawns().size)].origin;
  336.                     if (new_target_position != target_position)
  337.                     {
  338.                         target_position = new_target_position;
  339.                         break;
  340.                     }
  341.                 }
  342.             }
  343.             self setGoalPos(target_position);
  344.             while (Distance(self.origin,target_position) > 40)
  345.                 wait .05;
  346.         }
  347.     }
  348. }
  349. thief_visible_thread()
  350. {
  351.     self endon("death");
  352.     self.visible_to_player = [];
  353.     players = getPlayers();
  354.     for(i=0;i<players.size;i++)
  355.         self setInvisibleToPlayer(players[i]);
  356. }
  357. thief_sounds_thinker()
  358. {
  359.     self endon("death");
  360.     while(isdefined(self) )
  361.     {
  362.         wait randomFloatRange(3.2,6.8);
  363.         if (!isdefined(self) || self.health < 1) break;
  364.         if (!isdefined(self.thief_movetype) )
  365.             continue;
  366.         if (self.thief_movetype == "walk")
  367.         {
  368.             num = randomIntRange(0,7);
  369.             if (num >= 7) num = 6;
  370.             self playSound("thief_walk_"+num);
  371.         }
  372.         else if (self.thief_movetype == "sprint")
  373.         {
  374.             num = randomIntRange(0,6);
  375.             if (num >= 6) num = 6;
  376.             self playSound("thief_sprint_"+num);
  377.         }
  378.     }
  379. }
  380. thief_activate_sprint()
  381. {
  382.     self.thief_movetype = undefined;
  383.     num = randomIntRange(0,4);
  384.     if (num >= 4) num = 3;
  385.     self playSound("thief_anger_"+num);
  386.     self animScripted("zombie_taunt", self getOrigin(), self.angles, %ai_thief_anger);
  387.     wait getAnimLength(%ai_thief_anger);
  388.     self thread thief_set_movement_animation("sprint");
  389. }
  390. thief_rotatePlayer(player)
  391. {
  392.     facingGuy = VectorToAngles( self.origin - player.origin );
  393.     player lerp_player_view_to_position( player.origin, facingGuy, 0.15, 1 );
  394.     player FreezeControls( true );
  395. }
  396. thief_capture_player()
  397. {
  398.     self.thief_movetype = undefined;
  399.     self setVisibleToAll();
  400.     self animScripted("zombie_taunt", self getOrigin(), self.angles, %ai_thief_idle);
  401.     wait .4;
  402.     num = randomIntRange(0,4);
  403.     if (num >= 4) num = 3;
  404.     self playSound("thief_steal_"+num);
  405.     faceAngles = VectorToAngles( self.favoriteenemy getTagOrigin("j_head") - self getTagOrigin( "j_head" ) );
  406.     self animScripted("zombie_taunt", self getOrigin(), (0,faceangles[1],0), %ai_thief_attack_v1);
  407. }
  408. thief_teleport(player)
  409. {
  410.     self stopAnimScripted();
  411.     wait .05;
  412.     spawn = getDogSpawns()[randomInt(getDogSpawns().size)].origin;
  413.     player setOrigin(spawn); self forceTeleport(spawn.origin);
  414.     wait .05;
  415.     earthQuake(1, 3, self.origin, 200);
  416.     playfx(level._effect["transporter_beam"], self.origin);
  417.     player stopShellShock();
  418.     self notify("thief_attack_complete");
  419. }
  420. thief_roundSounder(type)
  421. {
  422.     if (!IsDefined(type) ) return;
  423.     if (type == "begin") { play_sound_2D( "dark_sting" ); clientnotify( "dog_start" ); }
  424.     wait 1;
  425.     self playLocalSound("thief_warning");
  426.     wait .85;
  427.     if (type == "begin")
  428.         self playLocalSound("thief_round_begin_vox");
  429.     else if (type == "end")
  430.     {
  431.         self playLocalSound("thief_round_end_vox");
  432.         clientnotify( "dog_stop" );
  433.     }
  434. }
  435. thief_powerup_dropper()
  436. {
  437.     self waittill_either("death","alt_death");
  438.     power_up_origin = self.origin+(0,0,1);
  439.     if( IsDefined( power_up_origin ) )
  440.     {
  441.         for ( i = 0; i < level.zombie_powerup_array.size; i++ )
  442.         {
  443.             if ( level.zombie_powerup_array[i] == "full_ammo" )
  444.             {
  445.                 level.zombie_powerup_index = i;
  446.                 break;
  447.             }
  448.         }
  449.         level notify("thief_round_over");
  450.         play_sound_2D( "bright_sting" );
  451.         level.zombie_vars["zombie_drop_item"] = 1;
  452.         level.powerup_drop_count = 0;
  453.         level thread maps\_zombiemode_powerups::powerup_drop( power_up_origin );
  454.     }
  455. }
  456. thief_roundend_failsafe()
  457. {
  458.     level endon("thief_round_over");
  459.     while(self.health >= 1)
  460.         wait .05;
  461.     wait 5;
  462.     level notify("thief_round_over");
  463. }
  464. inMap()
  465. {
  466.     playableArea = getEntArray("playable_area", "targetname");
  467.     for(m = 0; m < playableArea.size; m++)
  468.         if(self isTouching(playableArea[m]))
  469.             return true;
  470.     return false;
  471. }
  472. getDogspawns()
  473. {
  474.     spawns = getEntArray("thief_teleport_location","targetname");
  475.     return(spawns);
  476. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top