Advertisement
techforce

Botai2.qc (Tekbotctf+)

Sep 13th, 2011
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Clone C 64.26 KB | None | 0 0
  1.  
  2. float () BotShouldDischarge =
  3. {
  4. local float num_we_will_fry;
  5. local entity p;
  6.  
  7. if ((self.waterlevel != 3))
  8. {
  9. return (FALSE);
  10. }
  11. if (!(self.items & IT_LIGHTNING))
  12. {
  13. return (FALSE);
  14. }
  15. if ((self.ammo_cells == action))
  16. {
  17. return (FALSE);
  18. }
  19. if (((self.items & IT_LIGHTNING) && (self.ammo_cells > 25)))
  20. {
  21. return (FALSE);
  22. }
  23. if (((self.items & IT_ROCKET_LAUNCHER) && (self.ammo_rockets > 25)))
  24. {
  25. return (FALSE);
  26. }
  27. if (((self.items & IT_GRENADE_LAUNCHER) && (self.ammo_rockets > 25)))
  28. {
  29. return (FALSE);
  30. }
  31. if (((self.items & IT_SUPER_NAILGUN) && (self.ammo_nails > 25)))
  32. {
  33. return (FALSE);
  34. }
  35. num_we_will_fry = action;
  36. p = findradius (self.origin, 1000);
  37. while ((p != world))
  38. {
  39. if (((p.classname == "player") || (p.classname == "bot")))
  40. {
  41. if ((p.team != self.team))
  42. {
  43. if ((p.health > action))
  44. {
  45. if (!(p.observer_flags & PLAYER_NO_TARGET))
  46. {
  47. if (!p.observer)
  48. {
  49. if ((pointcontents (p.origin) == CONTENT_WATER))
  50. {
  51. if (BotCanSeePlayer (p))
  52. {
  53. num_we_will_fry = (num_we_will_fry + 1);
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. p = p.chain;
  62. }
  63. if ((num_we_will_fry > 1))
  64. {
  65. if ((random () < 0.02))
  66. {
  67. if ((bot_debug >= 1))
  68. {
  69. dprint (self.netname);
  70. dprint (" decides to discharge\n");
  71. }
  72. return (TRUE);
  73. }
  74. }
  75. return (FALSE);
  76. };
  77.  
  78. float () Bot_BestWeapon =
  79. {
  80. local float it;
  81. local vector vrng;
  82. local float rng;
  83. local float good_grenade_range;
  84. local float safe_dist;
  85. local float bestw;
  86. local float goodzrange;
  87. local float dis;
  88. self.altweap = 0;
  89. it = self.items;
  90. safe_dist = -1;
  91. if ((self.enemy != world))
  92. {
  93. rng = vlen ((self.origin - self.enemy.origin));
  94. rng = (rng + (((((random () * random ()) * -1) - 1) * 50) * self.bot_skill_inverse));
  95. if (!self.hooked_on_someone && self.health > 75 && rng < 75 && self.enemy.attacked < time)
  96. return (IT_HOOK);
  97.  
  98.  
  99. if (((it & IT_LIGHTNING) && (self.ammo_cells >= 1)))
  100. {
  101. dis = FALSE;
  102. dis = BotShouldDischarge ();
  103. if (((rng < 600) && ((self.waterlevel <= 1) || dis)))
  104. {
  105. return (IT_LIGHTNING);
  106. }
  107. }
  108. if (((it & IT_ROCKET_LAUNCHER) && (self.ammo_rockets >= 1)))
  109. {
  110. if ((teamplay & TEAM_NOSELFHURT))
  111. {
  112. safe_dist = action;
  113. }
  114. else
  115. {
  116. if ((self.health < TEAM_CAPTURE_FLAG_RETURN_TIME))
  117. {
  118. safe_dist = 100000000;
  119. }
  120. else
  121. {
  122. if (((self.armortype == 0.3) && (self.armorvalue > 75)))
  123. {
  124. safe_dist = 80;
  125. }
  126. else
  127. {
  128. if (((self.armortype == 0.6) && (self.armorvalue > VOTEEXIT_TIME_LIMIT)))
  129. {
  130. safe_dist = VOTEEXIT_TIME_LIMIT;
  131. }
  132. else
  133. {
  134. if (((self.armortype == 0.8) && (self.armorvalue > 50)))
  135. {
  136. safe_dist = 35;
  137. }
  138. else
  139. {
  140. safe_dist = 100;
  141. }
  142. }
  143. }
  144. }
  145. }
  146. if ((self.player_flag & ITEM_RUNE2_FLAG))
  147. {
  148. safe_dist = (safe_dist * SPAWNFLAG_LASER);
  149. }
  150. if ((self.player_flag & ITEM_RUNE4_FLAG))
  151. {
  152. safe_dist = (safe_dist / 3);
  153. }
  154. if ((self.player_flag & ITEM_RUNE1_FLAG))
  155. {
  156. safe_dist = (safe_dist / SPAWNFLAG_LASER);
  157. }
  158. if ((self.super_damage_finished > time))
  159. {
  160. safe_dist = (safe_dist * SECRET_1ST_DOWN);
  161. }
  162. if ((self.invincible_finished > time))
  163. {
  164. safe_dist = action;
  165. }
  166. if ((rng > safe_dist))
  167. {
  168. return (IT_ROCKET_LAUNCHER);
  169. }
  170. }
  171. if (((it & IT_GRENADE_LAUNCHER) && (self.ammo_rockets >= 1)))
  172. {
  173. if ((safe_dist == -1))
  174. {
  175. if ((self.health < 50))
  176. {
  177. safe_dist = 100000000;
  178. }
  179. else
  180. {
  181. if (((self.armortype == 0.3) && (self.armorvalue > 75)))
  182. {
  183. safe_dist = 100;
  184. }
  185. else
  186. {
  187. if (((self.armortype == 0.6) && (self.armorvalue > VOTEEXIT_TIME_LIMIT)))
  188. {
  189. safe_dist = 80;
  190. }
  191. else
  192. {
  193. if (((self.armortype == 0.8) && (self.armorvalue > 50)))
  194. {
  195. safe_dist = VOTEEXIT_TIME_LIMIT;
  196. }
  197. else
  198. {
  199. safe_dist = 100;
  200. }
  201. }
  202. }
  203. }
  204. if ((self.player_flag & ITEM_RUNE2_FLAG))
  205. {
  206. safe_dist = (safe_dist * SPAWNFLAG_LASER);
  207. }
  208. if ((self.player_flag & ITEM_RUNE4_FLAG))
  209. {
  210. safe_dist = (safe_dist / 3);
  211. }
  212. if ((self.player_flag & ITEM_RUNE1_FLAG))
  213. {
  214. safe_dist = (safe_dist / -1);
  215. }
  216. if ((self.super_damage_finished > time))
  217. {
  218. safe_dist = (safe_dist * SECRET_1ST_DOWN);
  219. }
  220. if ((self.invincible_finished > time))
  221. {
  222. safe_dist = action;
  223. }
  224. }
  225. goodzrange = FALSE;
  226. if ((self.origin_z > self.enemy.origin_z))
  227. {
  228. goodzrange = TRUE;
  229. }
  230. else
  231. {
  232. if (((self.enemy.origin_z - self.origin_z) < 250))
  233. {
  234. goodzrange = TRUE;
  235. }
  236. }
  237. if ((((rng < 600) && (rng > safe_dist)) && goodzrange))
  238. {
  239. good_grenade_range = TRUE;
  240. }
  241. else
  242. {
  243. if ((((rng < 1500) && (rng > (safe_dist * 0.6))) && (self.origin_z > (self.enemy.origin_z + 50))))
  244. {
  245. good_grenade_range = TRUE;
  246. }
  247. else
  248. {
  249. good_grenade_range = FALSE;
  250. }
  251. }
  252. if (good_grenade_range)
  253. {
  254. return (IT_GRENADE_LAUNCHER);
  255. }
  256. }
  257. if (((self.ammo_nails >= 1) && (it & IT_SUPER_NAILGUN)))
  258. {
  259. return (IT_SUPER_NAILGUN);
  260. }
  261. if (((self.ammo_shells >= 1) && (it & IT_SUPER_SHOTGUN)))
  262. {
  263. return (IT_SUPER_SHOTGUN);
  264. }
  265. if (((self.ammo_nails >= 1) && (it & IT_NAILGUN)))
  266. {
  267. if ((self.player_flag & ITEM_RUNE3_FLAG))
  268. {
  269. if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
  270. {
  271. return (IT_SHOTGUN);
  272. }
  273. }
  274. else
  275. {
  276. if (self.waterlevel < 2 && rng < 300 && self.enemy.waterlevel < 2)
  277. {
  278. self.altweap = 1;
  279. return (IT_NAILGUN);
  280. }
  281. else
  282. return (IT_NAILGUN);
  283. }
  284. }
  285. if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
  286. {
  287. return (IT_SHOTGUN);
  288. }
  289. if ((!self.ammo_shells || (it & IT_SHOTGUN)))
  290. {
  291. return (IT_HOOK);
  292. }
  293. }
  294. else
  295. {
  296. if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
  297. {
  298. return (IT_SHOTGUN);
  299. }
  300. }
  301. if (((((rng < SPAWNFLAG_LASER) && (self.health > 70)) && (self.enemy.health < 20)) && (time < self.enemy.attack_finished)))
  302. {
  303. if ((self.enemy.angles_y != vectoyaw ((self.enemy.origin - self.origin))))
  304. {
  305. return (IT_HOOK);
  306. }
  307. }
  308. else
  309. {
  310. return (IT_AXE);
  311. }
  312. };
  313.  
  314. float () IsExactlyOnePlayer =
  315. {
  316. local entity p;
  317. local float nm;
  318.  
  319. p = find (world, classname, "player");
  320. nm = action;
  321. while ((p != world))
  322. {
  323. nm = (nm + 1);
  324. if ((nm > 1))
  325. {
  326. return (FALSE);
  327. }
  328. p = find (p, classname, "player");
  329. }
  330. return (TRUE);
  331. };
  332.  
  333. float (entity bot, entity item) IsGoodItem =
  334. {
  335. local float val;
  336. local entity p;
  337. local entity targ;
  338.  
  339. if (item.altname == "weapon")
  340. if (bot.items & item.weapon)
  341. return(0);
  342.  
  343.  
  344.  
  345. if ((item.classname == "bonus"))
  346. {
  347. return (10000);
  348. }
  349. if ((item.classname == "mine"))
  350. {
  351. if (EntityInFieldOfView (item))
  352. {
  353. if ((item.owner.team != self.team))
  354. {
  355. if ((self.items && SECRET_NEVER))
  356. {
  357. self.weapon = SECRET_NEVER;
  358. }
  359. if ((self.items & SECRET_YES_SHOOT))
  360. {
  361. self.weapon = SECRET_YES_SHOOT;
  362. }
  363. self.enemy = item;
  364. return (action);
  365. }
  366. else
  367. {
  368. BotEvade (item);
  369. }
  370. }
  371. }
  372. if ((item.classname == "trigger_teleport"))
  373. {
  374. targ = find (item, targetname, item.target);
  375. if (!targ)
  376. {
  377. return (action);
  378. }
  379. else
  380. {
  381. return (1000);
  382. }
  383. }
  384. if (!item.bot_wants_item)
  385. {
  386. return (action);
  387. }
  388. if ((((item.team != bot.team) && (item.classname == "grenade")) || (item.classname == "missile")))
  389. {
  390. if (EntityInFieldOfView (item))
  391. {
  392. if ((item.model == "progs/missile.mdl"))
  393. BotEvade (item);
  394. if ((vlen ((bot.origin - item.origin)) < 25))
  395. {
  396. bot.attacked = (time + 3.3);
  397. bot.turn = (bot.origin - item.origin);
  398. if ((self.flags & FL_ONGROUND))
  399. self.velocity = (self.velocity * -1.77);
  400. else
  401. {
  402. self.nextjump = 10;
  403. self.swing = 0.33;
  404. BotFireHookUpRandomly (20);
  405. }
  406. if (!EntityInFieldOfView (item.owner))
  407. {
  408. self.suspicious_about = item.owner.origin;
  409. self.suspicious_about_time = time;
  410. }
  411. return (action);
  412. }
  413. }
  414. }
  415. if ((((((item.classname == "light_torch_small_walltorch") || (item.classname == "mine")) || (item.model == "progs/spike.mdl")) || (item.model == "progs/s_spike.mdl")) || (item.model == "progs/laser.mdl")))
  416. {
  417. return (action);
  418. }
  419. if ((item.classname == "item_health"))
  420. {
  421. if ((bot.health < 25))
  422. {
  423. return (10000);
  424. }
  425. else
  426. {
  427. if ((bot.health < 50))
  428. {
  429. return (5000);
  430. }
  431. else
  432. {
  433. if ((bot.health < 75))
  434. {
  435. return (500);
  436. }
  437. else
  438. {
  439. if ((bot.health < 100))
  440. {
  441. if ((item.spawnflags & H_MEGA))
  442. {
  443. if ((bot.player_flag & ITEM_RUNE4_FLAG))
  444. {
  445. return (1000);
  446. }
  447. else
  448. {
  449. return ((250 - bot.health));
  450. }
  451. }
  452. else
  453. {
  454. if ((item.spawnflags & H_ROTTEN))
  455. {
  456. return ((115 - bot.health));
  457. }
  458. else
  459. {
  460. return ((125 - bot.health));
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. }
  468. else
  469. {
  470. if ((item.classname == "item_shells"))
  471. {
  472. return ((25 - bot.ammo_shells));
  473. }
  474. else
  475. {
  476. if ((item.classname == "item_nails"))
  477. {
  478. return ((100 - bot.ammo_nails));
  479. }
  480. else
  481. {
  482. if ((item.classname == "item_rockets"))
  483. {
  484. return ((50 - bot.ammo_rockets));
  485. }
  486. else
  487. {
  488. if ((item.classname == "item_cells"))
  489. {
  490. return ((50 - bot.ammo_cells));
  491. }
  492. else
  493. {
  494. if ((item.classname == "backpack"))
  495. {
  496. return (150);
  497. }
  498. else
  499. {
  500. if ((item.classname == "weapon_supershotgun"))
  501. {
  502. if ((deathmatch & DM_WEAPONS_STAY))
  503. {
  504. if (!(bot.items & IT_SUPER_SHOTGUN))
  505. {
  506. return (VOTEEXIT_TIME_LIMIT);
  507. }
  508. }
  509. else
  510. {
  511. if (((bot.items & IT_SUPER_NAILGUN) && (bot.ammo_nails >= LMQUOTA_HEALTH)))
  512. {
  513. return (TEAM_CAPTURE_CAPTURE_BONUS);
  514. }
  515. else
  516. {
  517. if (((bot.items & IT_GRENADE_LAUNCHER) && (bot.ammo_rockets >= 5)))
  518. {
  519. return (TEAM_CAPTURE_CAPTURE_BONUS);
  520. }
  521. else
  522. {
  523. if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
  524. {
  525. return (TEAM_CAPTURE_CAPTURE_BONUS);
  526. }
  527. else
  528. {
  529. if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
  530. {
  531. return (TEAM_CAPTURE_CAPTURE_BONUS);
  532. }
  533. else
  534. {
  535. if (!(bot.items & IT_SUPER_SHOTGUN))
  536. {
  537. return (VOTEEXIT_TIME_LIMIT);
  538. }
  539. else
  540. {
  541. if (!(deathmatch & DM_WEAPONS_STAY))
  542. {
  543. return ((VOTEEXIT_TIME_LIMIT - bot.ammo_shells));
  544. }
  545. }
  546. }
  547. }
  548. }
  549. }
  550. }
  551. }
  552. else
  553. {
  554. if ((item.classname == "weapon_nailgun"))
  555. {
  556. if ((deathmatch & DM_WEAPONS_STAY))
  557. {
  558. if (!(bot.items & IT_NAILGUN))
  559. {
  560. return (LMQUOTA_HEALTH);
  561. }
  562. }
  563. else
  564. {
  565. if (((bot.items & IT_SUPER_NAILGUN) && (bot.ammo_nails >= LMQUOTA_HEALTH)))
  566. {
  567. return (TEAM_CAPTURE_CAPTURE_BONUS);
  568. }
  569. else
  570. {
  571. if (((bot.items & IT_GRENADE_LAUNCHER) && (bot.ammo_rockets >= 5)))
  572. {
  573. return (TEAM_CAPTURE_CAPTURE_BONUS);
  574. }
  575. else
  576. {
  577. if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
  578. {
  579. return (TEAM_CAPTURE_CAPTURE_BONUS);
  580. }
  581. else
  582. {
  583. if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
  584. {
  585. return (TEAM_CAPTURE_CAPTURE_BONUS);
  586. }
  587. else
  588. {
  589. if (!(bot.items & IT_NAILGUN))
  590. {
  591. return (LMQUOTA_HEALTH);
  592. }
  593. else
  594. {
  595. if (!(deathmatch & DM_WEAPONS_STAY))
  596. {
  597. return ((80 - bot.ammo_nails));
  598. }
  599. }
  600. }
  601. }
  602. }
  603. }
  604. }
  605. }
  606. else
  607. {
  608. if ((item.classname == "weapon_supernailgun"))
  609. {
  610. if ((deathmatch & DM_WEAPONS_STAY))
  611. {
  612. if (!(bot.items & IT_SUPER_NAILGUN))
  613. {
  614. return (75);
  615. }
  616. }
  617. else
  618. {
  619. if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
  620. {
  621. return ((80 - bot.ammo_nails));
  622. }
  623. else
  624. {
  625. if (!(bot.items & IT_SUPER_NAILGUN))
  626. {
  627. return (75);
  628. }
  629. else
  630. {
  631. if (!(deathmatch & DM_WEAPONS_STAY))
  632. {
  633. return ((80 - bot.ammo_nails));
  634. }
  635. }
  636. }
  637. }
  638. }
  639. else
  640. {
  641. if ((item.classname == "weapon_grenadelauncher"))
  642. {
  643. if ((deathmatch & DM_WEAPONS_STAY))
  644. {
  645. if (!(bot.items & IT_GRENADE_LAUNCHER))
  646. {
  647. return (130);
  648. }
  649. }
  650. else
  651. {
  652. if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
  653. {
  654. return ((50 - bot.ammo_rockets));
  655. }
  656. else
  657. {
  658. if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
  659. {
  660. return ((50 - bot.ammo_rockets));
  661. }
  662. else
  663. {
  664. if (!(bot.items & IT_GRENADE_LAUNCHER))
  665. {
  666. return (130);
  667. }
  668. else
  669. {
  670. if (!(deathmatch & DM_WEAPONS_STAY))
  671. {
  672. return ((50 - bot.ammo_rockets));
  673. }
  674. }
  675. }
  676. }
  677. }
  678. }
  679. else
  680. {
  681. if ((item.classname == "weapon_rocketlauncher"))
  682. {
  683. if (!(bot.items & IT_ROCKET_LAUNCHER))
  684. {
  685. return (140);
  686. }
  687. else
  688. {
  689. if (!(deathmatch & DM_WEAPONS_STAY))
  690. {
  691. return ((50 - bot.ammo_rockets));
  692. }
  693. }
  694. }
  695. else
  696. {
  697. if ((item.classname == "weapon_lightning"))
  698. {
  699. if (!(bot.items & IT_LIGHTNING))
  700. {
  701. return (150);
  702. }
  703. else
  704. {
  705. if (!(deathmatch & DM_WEAPONS_STAY))
  706. {
  707. return ((50 - bot.ammo_cells));
  708. }
  709. }
  710. }
  711. else
  712. {
  713. if ((item.classname == "item_armor1"))
  714. {
  715. if (((bot.armortype * bot.armorvalue) < (0.3 * 100)))
  716. {
  717. return (300);
  718. }
  719. }
  720. else
  721. {
  722. if ((item.classname == "item_armor2"))
  723. {
  724. if (((bot.armortype * bot.armorvalue) < (0.6 * 150)))
  725. {
  726. return (600);
  727. }
  728. }
  729. else
  730. {
  731. if ((item.classname == "item_armorInv"))
  732. {
  733. if (((bot.armortype * bot.armorvalue) < (0.8 * 200)))
  734. {
  735. return (800);
  736. }
  737. }
  738. else
  739. {
  740. if ((item.classname == "item_flag_team1"))
  741. {
  742. if ((bot.team == TEAM_COLOR2))
  743. {
  744. return (20000);
  745. }
  746. else
  747. {
  748. if ((bot.player_flag & ITEM_ENEMY_FLAG))
  749. {
  750. return (100000);
  751. }
  752. else
  753. {
  754. if ((item.cnt == 2))
  755. {
  756. return (50000);
  757. }
  758. }
  759. }
  760. }
  761. else
  762. {
  763. if ((item.classname == "item_flag_team2"))
  764. {
  765. if ((bot.team == TEAM_COLOR1))
  766. {
  767. return (20000);
  768. }
  769. else
  770. {
  771. if ((bot.player_flag & ITEM_ENEMY_FLAG))
  772. {
  773. return (100000);
  774. }
  775. else
  776. {
  777. if ((item.cnt == 2))
  778. {
  779. return (50000);
  780. }
  781. }
  782. }
  783. }
  784. else
  785. {
  786. if (((((item.classname == "item_rune1") || (item.classname == "item_rune2")) || (item.classname == "item_rune3")) || (item.classname == "item_rune4")))
  787. {
  788. if (!(bot.player_flag & ITEM_RUNE_MASK))
  789. {
  790. return (1000);
  791. }
  792. }
  793. else
  794. {
  795. if ((item.classname == "item_artifact_envirosuit"))
  796. {
  797. if ((self.waterlevel == 3))
  798. {
  799. return (1000);
  800. }
  801. else
  802. {
  803. return (50);
  804. }
  805. }
  806. else
  807. {
  808. if ((item.classname == "item_artifact_invulnerability"))
  809. {
  810. return (1500);
  811. }
  812. else
  813. {
  814. if ((item.classname == "item_artifact_invisibility"))
  815. {
  816. return (500);
  817. }
  818. else
  819. {
  820. if ((item.classname == "item_artifact_super_damage"))
  821. {
  822. return (1500);
  823. }
  824. }
  825. }
  826. }
  827. }
  828. }
  829. }
  830. }
  831. }
  832. }
  833. }
  834. }
  835. }
  836. }
  837. }
  838. }
  839. }
  840. }
  841. }
  842. }
  843. }
  844. }
  845. return (action);
  846. };
  847.  
  848. float (entity item) IsImmovableGettableItem =
  849. {
  850. if ((item.classname == "item_flag_team1"))
  851. {
  852. return (TRUE);
  853. }
  854. else
  855. {
  856. if ((item.classname == "item_flag_team2"))
  857. {
  858. return (TRUE);
  859. }
  860. else
  861. {
  862. if ((item.classname == "item_artifact_envirosuit"))
  863. {
  864. return (TRUE);
  865. }
  866. else
  867. {
  868. if ((item.classname == "item_artifact_invulnerability"))
  869. {
  870. return (TRUE);
  871. }
  872. else
  873. {
  874. if ((item.classname == "item_artifact_invisibility"))
  875. {
  876. return (TRUE);
  877. }
  878. else
  879. {
  880. if ((item.classname == "item_artifact_super_damage"))
  881. {
  882. return (TRUE);
  883. }
  884. else
  885. {
  886. if ((item.classname == "weapon_supershotgun"))
  887. {
  888. return (TRUE);
  889. }
  890. else
  891. {
  892. if ((item.classname == "weapon_nailgun"))
  893. {
  894. return (TRUE);
  895. }
  896. else
  897. {
  898. if ((item.classname == "weapon_supernailgun"))
  899. {
  900. return (TRUE);
  901. }
  902. else
  903. {
  904. if ((item.classname == "weapon_grenadelauncher"))
  905. {
  906. return (TRUE);
  907. }
  908. else
  909. {
  910. if ((item.classname == "weapon_rocketlauncher"))
  911. {
  912. return (TRUE);
  913. }
  914. else
  915. {
  916. if ((item.classname == "weapon_lightning"))
  917. {
  918. return (TRUE);
  919. }
  920. else
  921. {
  922. if ((item.classname == "item_shells"))
  923. {
  924. return (TRUE);
  925. }
  926. else
  927. {
  928. if ((item.classname == "item_nails"))
  929. {
  930. return (TRUE);
  931. }
  932. else
  933. {
  934. if ((item.classname == "item_rockets"))
  935. {
  936. return (TRUE);
  937. }
  938. else
  939. {
  940. if ((item.classname == "item_cells"))
  941. {
  942. return (TRUE);
  943. }
  944. else
  945. {
  946. if ((item.classname == "item_armor1"))
  947. {
  948. return (TRUE);
  949. }
  950. else
  951. {
  952. if ((item.classname == "item_armor2"))
  953. {
  954. return (TRUE);
  955. }
  956. else
  957. {
  958. if ((item.classname == "item_armorInv"))
  959. {
  960. return (TRUE);
  961. }
  962. else
  963. {
  964. if ((item.classname == "item_health"))
  965. {
  966. return (TRUE);
  967. }
  968. }
  969. }
  970. }
  971. }
  972. }
  973. }
  974. }
  975. }
  976. }
  977. }
  978. }
  979. }
  980. }
  981. }
  982. }
  983. }
  984. }
  985. }
  986. }
  987. return (FALSE);
  988. };
  989.  
  990. float () BotSayStart =
  991. {
  992. if ((time < (self.last_say + 5)))
  993. {
  994. return (FALSE);
  995. }
  996. self.last_say = time;
  997. if (bots_have_normal_names)
  998. {
  999. bprint (self.talkname);
  1000. bprint ("º ");
  1001. }
  1002. else
  1003. {
  1004. if ((self.team == TEAM_COLOR1))
  1005. {
  1006. bprint ("ÒåäÂïôº ");
  1007. }
  1008. else
  1009. {
  1010. if ((self.team == TEAM_COLOR2))
  1011. {
  1012. bprint ("ÂìõåÂïôº ");
  1013. }
  1014. else
  1015. {
  1016. bprint ("Âïôº ");
  1017. }
  1018. }
  1019. }
  1020. return (TRUE);
  1021. };
  1022.  
  1023. float () BotSayTeamStart =
  1024. {
  1025. if ((time < (self.last_say + 4.5)))
  1026. {
  1027. return (FALSE);
  1028. }
  1029. self.last_say = time;
  1030. if (bots_have_normal_names)
  1031. {
  1032. bprintteam ("¨");
  1033. bprintteam (self.talkname);
  1034. bprintteam ("©º ");
  1035. }
  1036. else
  1037. {
  1038. if ((self.team == TEAM_COLOR1))
  1039. {
  1040. bprintteam ("ÒåäÂïôº ");
  1041. }
  1042. else
  1043. {
  1044. if ((self.team == TEAM_COLOR2))
  1045. {
  1046. bprintteam ("ÂìõåÂïôº ");
  1047. }
  1048. else
  1049. {
  1050. bprintteam ("Âïôº ");
  1051. }
  1052. }
  1053. }
  1054. return (TRUE);
  1055. };
  1056.  
  1057. void () BotSayStart2 =
  1058. {
  1059. if (bots_have_normal_names)
  1060. {
  1061. bprint (self.talkname);
  1062. bprint ("º ");
  1063. }
  1064. else
  1065. {
  1066. if ((self.team == TEAM_COLOR1))
  1067. {
  1068. bprint ("ÒåäÂïôº ");
  1069. }
  1070. else
  1071. {
  1072. if ((self.team == TEAM_COLOR2))
  1073. {
  1074. bprint ("ÂìõåÂïôº ");
  1075. }
  1076. else
  1077. {
  1078. bprint ("Âïôº ");
  1079. }
  1080. }
  1081. }
  1082. };
  1083.  
  1084. void () BotSayTeamStart2 =
  1085. {
  1086. if (bots_have_normal_names)
  1087. {
  1088. bprintteam (self.talkname);
  1089. bprintteam ("º ");
  1090. }
  1091. else
  1092. {
  1093. if ((self.team == TEAM_COLOR1))
  1094. {
  1095. bprintteam ("ÒåäÂïôº ");
  1096. }
  1097. else
  1098. {
  1099. if ((self.team == TEAM_COLOR2))
  1100. {
  1101. bprintteam ("ÂìõåÂïôº ");
  1102. }
  1103. else
  1104. {
  1105. bprintteam ("Âïôº ");
  1106. }
  1107. }
  1108. }
  1109. };
  1110.  
  1111. void (string st) BotSayMiddle =
  1112. {
  1113. bprint (st);
  1114. };
  1115.  
  1116. void (string st) BotSayTeamMiddle =
  1117. {
  1118. bprintteam (st);
  1119. };
  1120.  
  1121. void () BotSayEnd =
  1122. {
  1123. bprint ("\n");
  1124. sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
  1125. };
  1126.  
  1127. void () BotPlayTeamTalkBeep =
  1128. {
  1129. local entity p;
  1130.  
  1131. p = find (world, classname, "player");
  1132. while ((p != world))
  1133. {
  1134. if ((p.team == self.team))
  1135. {
  1136. stuffcmd (p, "play misc/talk.wav\n");
  1137. }
  1138. p = find (p, classname, "player");
  1139. }
  1140. };
  1141.  
  1142. void () BotSayTeamEnd =
  1143. {
  1144. BotPlayTeamTalkBeep ();
  1145. bprintteam ("\n");
  1146. };
  1147.  
  1148. void (string st) BotSay =
  1149. {
  1150. if (BotSayStart ())
  1151. {
  1152. BotSayMiddle (st);
  1153. BotSayEnd ();
  1154. }
  1155. };
  1156.  
  1157. void (string st) BotSayTeam =
  1158. {
  1159. if (BotSayTeamStart ())
  1160. {
  1161. BotSayTeamMiddle (st);
  1162. BotSayTeamEnd ();
  1163. }
  1164. };
  1165.  
  1166. void (entity player) BotSayEscort =
  1167. {
  1168. local entity flag1;
  1169. local entity flag2;
  1170. local entity p;
  1171. local float r;
  1172.  
  1173. if (bot_chatter_off)
  1174. {
  1175. return;
  1176. }
  1177. if ((random () < 0.3))
  1178. {
  1179. r = random ();
  1180. if ((r < 0.125))
  1181. {
  1182. flag1 = find (world, classname, "item_flag_team1");
  1183. flag2 = find (world, classname, "item_flag_team2");
  1184. if ((self.team != TEAM_COLOR1))
  1185. {
  1186. p = flag1;
  1187. flag1 = flag2;
  1188. flag2 = p;
  1189. }
  1190. if ((flag2.cnt == 0))
  1191. {
  1192. if (BotSayTeamStart ())
  1193. {
  1194. BotSayTeamMiddle ("let's get their flag ");
  1195. BotSayTeamMiddle (player.netname);
  1196. BotSayTeamEnd ();
  1197. }
  1198. }
  1199. }
  1200. else
  1201. {
  1202. if ((r < 0.25))
  1203. {
  1204. p = find (world, classname, "item_artifact_invulnerability");
  1205. if (((p != world) && (p.solid != SOLID_NOT)))
  1206. {
  1207. if (BotSayTeamStart ())
  1208. {
  1209. BotSayTeamMiddle ("go get the pentagram ");
  1210. BotSayTeamMiddle (player.netname);
  1211. BotSayTeamEnd ();
  1212. }
  1213. }
  1214. else
  1215. {
  1216. p = find (world, classname, "item_artifact_super_damage");
  1217. if (((p != world) && (p.solid != SOLID_NOT)))
  1218. {
  1219. if (BotSayTeamStart ())
  1220. {
  1221. BotSayTeamMiddle ("go get the quad ");
  1222. BotSayTeamMiddle (player.netname);
  1223. BotSayTeamEnd ();
  1224. }
  1225. }
  1226. else
  1227. {
  1228. if ((!bot_chatter_rated_g && BotSayStart ()))
  1229. {
  1230. BotSayTeamMiddle ("let's kill them ");
  1231. BotSayTeamMiddle (player.netname);
  1232. BotSayTeamEnd ();
  1233. }
  1234. }
  1235. }
  1236. }
  1237. else
  1238. {
  1239. if ((r < 0.375))
  1240. {
  1241. BotSayTeam ("let's go get 'em");
  1242. }
  1243. else
  1244. {
  1245. if ((r < fAutoBotRand))
  1246. {
  1247. BotSayTeam ("let's attack");
  1248. }
  1249. else
  1250. {
  1251. if ((!bot_chatter_rated_g && (r < 0.75)))
  1252. {
  1253. BotSayTeam ("let's kick some ass");
  1254. }
  1255. else
  1256. {
  1257. if ((r < 0.995))
  1258. {
  1259. BotSayTeam ("go for it");
  1260. }
  1261. else
  1262. {
  1263. if (BotSayTeamStart ())
  1264. {
  1265. BotSayTeamMiddle ("you're awesome ");
  1266. BotSayTeamMiddle (player.netname);
  1267. BotSayTeamEnd ();
  1268. }
  1269. }
  1270. }
  1271. }
  1272. }
  1273. }
  1274. }
  1275. }
  1276. };
  1277.  
  1278. void () BotSayDefense =
  1279. {
  1280. local entity p;
  1281. local float r;
  1282.  
  1283. if ((self.team != last_pickup_team))
  1284. {
  1285. if ((random () < 0.01))
  1286. {
  1287. if ((self.team == TEAM_COLOR1))
  1288. {
  1289. p = find (world, classname, "item_flag_team1");
  1290. }
  1291. else
  1292. {
  1293. if ((self.team == TEAM_COLOR2))
  1294. {
  1295. p = find (world, classname, "item_flag_team2");
  1296. }
  1297. }
  1298. if ((p.cnt == 0))
  1299. {
  1300. return;
  1301. }
  1302. r = random ();
  1303. if ((r < 0.1))
  1304. {
  1305. BotSay ("LOOK OUT!!");
  1306. }
  1307. else
  1308. {
  1309. if ((r < 0.2))
  1310. {
  1311. BotSay ("Enemy sited near base! ");
  1312. }
  1313. else
  1314. {
  1315. if ((r < 0.3))
  1316. {
  1317. BotSay ("Ever hear of Defense guys? ");
  1318. }
  1319. else
  1320. {
  1321. if ((!bot_chatter_rated_g && (r < LMQUOTA_ARMOR)))
  1322. {
  1323. BotSay ("defense dammit");
  1324. }
  1325. else
  1326. {
  1327. if ((r < fAutoBotRand))
  1328. {
  1329. BotSay ("Im on him guys.");
  1330. }
  1331. else
  1332. {
  1333. if ((!bot_chatter_rated_g && (r < 0.6)))
  1334. {
  1335. BotSay ("kill the carrier");
  1336. }
  1337. else
  1338. {
  1339. if ((r < 0.7))
  1340. {
  1341. BotSay ("My team needs viagra");
  1342. }
  1343. else
  1344. {
  1345. if ((!bot_chatter_rated_g && (r < 0.8)))
  1346. {
  1347. BotSay ("Awww man!");
  1348. }
  1349. else
  1350. {
  1351. if ((r < 0.9))
  1352. {
  1353. BotSay ("we need more defense");
  1354. }
  1355. else
  1356. {
  1357. if ((r < 0.95))
  1358. {
  1359. self.repeat = (time + (random () * 2));
  1360. self.repeated = "Return The Flag!!\n";
  1361. }
  1362. else
  1363. {
  1364. if (!bot_chatter_rated_g)
  1365. {
  1366. BotSay ("dammit");
  1367. }
  1368. }
  1369. }
  1370. }
  1371. }
  1372. }
  1373. }
  1374. }
  1375. }
  1376. }
  1377. }
  1378. }
  1379. }
  1380. };
  1381.  
  1382. void () BotSayDammit =
  1383. {
  1384. local float r;
  1385.  
  1386. if ((self.team != last_capture_team))
  1387. {
  1388. if ((random () < 0.01))
  1389. {
  1390. r = random ();
  1391. if ((r < 0.1))
  1392. {
  1393. BotSay ("no way");
  1394. }
  1395. else
  1396. {
  1397. if ((!bot_chatter_rated_g && (r < 0.2)))
  1398. {
  1399. BotSay ("we gotta escort more");
  1400. }
  1401. else
  1402. {
  1403. if ((!bot_chatter_rated_g && (r < 0.3)))
  1404. {
  1405. BotSay ("wtf?");
  1406. }
  1407. else
  1408. {
  1409. if ((!bot_chatter_rated_g && (r < LMQUOTA_ARMOR)))
  1410. {
  1411. BotSay ("no freakin way");
  1412. }
  1413. else
  1414. {
  1415. if ((!bot_chatter_rated_g && (r < fAutoBotRand)))
  1416. {
  1417. BotSay ("dammit!");
  1418. }
  1419. else
  1420. {
  1421. if ((r < 0.6))
  1422. {
  1423. BotSay ("i can't believe it");
  1424. }
  1425. else
  1426. {
  1427. if ((r < 0.7))
  1428. {
  1429. BotSay ("ok, Revenge time...");
  1430. }
  1431. else
  1432. {
  1433. if ((!bot_chatter_rated_g && (r < 0.8)))
  1434. {
  1435. BotSay ("what the hell?");
  1436. }
  1437. else
  1438. {
  1439. if ((!bot_chatter_rated_g && (r < 0.9)))
  1440. {
  1441. BotSay (" lets return the favor");
  1442. }
  1443. else
  1444. {
  1445. if (!bot_chatter_rated_g)
  1446. {
  1447. BotSay ("total bs");
  1448. }
  1449. }
  1450. }
  1451. }
  1452. }
  1453. }
  1454. }
  1455. }
  1456. }
  1457. }
  1458. }
  1459. }
  1460. };
  1461.  
  1462. void () BotSayGoodGame =
  1463. {
  1464. local float r;
  1465.  
  1466. if ((mapname == "start"))
  1467. {
  1468. return;
  1469. }
  1470. if ((random () < 0.01))
  1471. {
  1472. r = random ();
  1473. if ((r < 0.1))
  1474. {
  1475. BotSay ("good game");
  1476. }
  1477. else
  1478. {
  1479. if ((r < 0.2))
  1480. {
  1481. BotSay ("that was fun");
  1482. }
  1483. else
  1484. {
  1485. if ((r < 0.3))
  1486. {
  1487. BotSay ("nice game");
  1488. }
  1489. else
  1490. {
  1491. if ((r < 0.4))
  1492. {
  1493. BotSay ("GG");
  1494. }
  1495. else
  1496. {
  1497. if ((r < 0.5))
  1498. {
  1499. BotSay (" :)");
  1500. }
  1501. else
  1502. {
  1503. if ((r < 0.6))
  1504. {
  1505. BotSay ("LAG");
  1506. }
  1507. else
  1508. {
  1509. if ((r < 0.7))
  1510. {
  1511. BotSay ("GG All...");
  1512. }
  1513. else
  1514. {
  1515. if ((r < 0.8))
  1516. {
  1517. BotSay ("Cya's!!");
  1518. }
  1519. else
  1520. {
  1521. if ((r < 0.9))
  1522. {
  1523. BotSay ("good game everyone");
  1524. }
  1525. else
  1526. {
  1527. BotSay ("Be back later..");
  1528. }
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. }
  1535. }
  1536. }
  1537. }
  1538. };
  1539.  
  1540. void (entity p) BotSayTaunt =
  1541. {
  1542. local float n;
  1543. local float r;
  1544.  
  1545. if ((p == world))
  1546. {
  1547. return;
  1548. }
  1549. if (bot_chatter_rated_g)
  1550. {
  1551. return;
  1552. }
  1553. if ((random () < 0.01))
  1554. {
  1555. n = random ();
  1556. if ((n < 0.2))
  1557. {
  1558. BotSay ("Ownage???");
  1559. }
  1560. else
  1561. {
  1562. if ((n < LMQUOTA_ARMOR))
  1563. {
  1564. BotSay ("Hehe!!");
  1565. }
  1566. else
  1567. {
  1568. if ((n < 0.6))
  1569. {
  1570. BotSay (" Heh Heh..");
  1571. }
  1572. else
  1573. {
  1574. if ((n < 0.8))
  1575. {
  1576. self.repeat = (time + (random () * 2));
  1577. self.repeated = "Come Get Some!!!!!!!\n";
  1578. }
  1579. else
  1580. {
  1581. if ((n > 0.9))
  1582. {
  1583. self.repeat = (time + (random () * 2));
  1584. self.repeated = " <<< Laughs Out Loud!!!!\n";
  1585. }
  1586. }
  1587. }
  1588. }
  1589. }
  1590. return;
  1591. }
  1592. if ((random () < 0.003))
  1593. {
  1594. if (BotSayStart ())
  1595. {
  1596. r = random ();
  1597. if ((r < 0.1))
  1598. {
  1599. BotSayMiddle ("how'd you like that one ");
  1600. }
  1601. else
  1602. {
  1603. if ((r < 0.2))
  1604. {
  1605. BotSayMiddle ("nice try ");
  1606. }
  1607. else
  1608. {
  1609. if ((r < 0.3))
  1610. {
  1611. BotSayMiddle ("almost had me ");
  1612. }
  1613. else
  1614. {
  1615. if ((r < LMQUOTA_ARMOR))
  1616. {
  1617. BotSayMiddle ("no soup for you ");
  1618. }
  1619. else
  1620. {
  1621. if ((r < fAutoBotRand))
  1622. {
  1623. BotSayMiddle ("poorly executed ");
  1624. }
  1625. else
  1626. {
  1627. if ((r < 0.6))
  1628. {
  1629. BotSayMiddle ("i'm still here ");
  1630. }
  1631. else
  1632. {
  1633. if ((r < 0.7))
  1634. {
  1635. BotSayMiddle ("no can do ");
  1636. }
  1637. else
  1638. {
  1639. if ((r < 0.8))
  1640. {
  1641. BotSayMiddle ("I expected better ");
  1642. }
  1643. else
  1644. {
  1645. if ((r < 0.9))
  1646. {
  1647. BotSayMiddle ("missed me ");
  1648. }
  1649. else
  1650. {
  1651. BotSayMiddle ("sorry ");
  1652. }
  1653. }
  1654. }
  1655. }
  1656. }
  1657. }
  1658. }
  1659. }
  1660. }
  1661. BotSayMiddle (p.netname);
  1662. BotSayEnd ();
  1663. }
  1664. }
  1665. };
  1666. void (entity p) BotSayNiceOne1 =
  1667. {
  1668. local float r;
  1669. r = random ();
  1670. if ((r < 0.1))
  1671. {
  1672. BotSayMiddle ("not bad ");
  1673. }
  1674. else
  1675. {
  1676. if ((r < 0.2))
  1677. {
  1678. BotSayMiddle ("great shot ");
  1679. }
  1680. else
  1681. {
  1682. if ((r < 0.3))
  1683. {
  1684. BotSayMiddle ("interesting tactics ");
  1685. }
  1686. else
  1687. {
  1688. if ((r < LMQUOTA_ARMOR))
  1689. {
  1690. BotSayMiddle ("great combat ");
  1691. }
  1692. else
  1693. {
  1694. if ((r < 0.45))
  1695. {
  1696. BotSayMiddle ("BS ");
  1697. }
  1698. else
  1699. {
  1700. if ((!bot_chatter_rated_g && (r < fAutoBotRand)))
  1701. {
  1702. BotSayMiddle ("you're a psycho killer ");
  1703. }
  1704. else
  1705. {
  1706. if ((r < 0.6))
  1707. {
  1708. BotSayMiddle ("I'll be baaaak ");
  1709. }
  1710. else
  1711. {
  1712. if ((r < 0.7))
  1713. {
  1714. BotSayMiddle ("you're awesome ");
  1715. }
  1716. else
  1717. {
  1718. if ((r < 0.8))
  1719. {
  1720. BotSayMiddle (p.netname);
  1721. BotSayMiddle (" Blew me off the map");
  1722. BotSayEnd ();
  1723. return;
  1724. }
  1725. else
  1726. {
  1727. if ((r < 0.9))
  1728. {
  1729. BotSayMiddle ("how'd you do that ");
  1730. }
  1731. else
  1732. {
  1733. BotSayMiddle ("you're incredible ");
  1734. }
  1735. }
  1736. }
  1737. }
  1738. }
  1739. }
  1740. }
  1741. }
  1742. }
  1743. }
  1744. BotSayMiddle (p.netname);
  1745. BotSayEnd ();
  1746. };
  1747. void (entity p) BotSayNiceOne2 =
  1748. {
  1749. local float r;
  1750. r = random ();
  1751. if ((r < 0.1))
  1752. {
  1753. BotSayMiddle ("that was fantastic ");
  1754. }
  1755. else
  1756. {
  1757. if ((r < 0.2))
  1758. {
  1759. BotSayMiddle ("you knocked the wind out of me ");
  1760. }
  1761. else
  1762. {
  1763. if ((r < 0.25))
  1764. {
  1765. BotSayMiddle ("Yea Right ");
  1766. }
  1767. else
  1768. {
  1769. if ((r < 0.3))
  1770. {
  1771. BotSayMiddle ("very sneaky ");
  1772. }
  1773. else
  1774. {
  1775. if ((r < LMQUOTA_ARMOR))
  1776. {
  1777. BotSayMiddle ("great tactics ");
  1778. }
  1779. else
  1780. {
  1781. if ((r < 0.45))
  1782. {
  1783. BotSayMiddle ("You're Dead ");
  1784. }
  1785. else
  1786. {
  1787. if ((r < fAutoBotRand))
  1788. {
  1789. BotSayMiddle ("great reflexes ");
  1790. }
  1791. else
  1792. {
  1793. if ((r < 0.6))
  1794. {
  1795. BotSayMiddle ("incredible aim ");
  1796. }
  1797. else
  1798. {
  1799. if ((r < 0.7))
  1800. {
  1801. BotSayMiddle ("you're awesome ");
  1802. }
  1803. else
  1804. {
  1805. if ((r < 0.8))
  1806. {
  1807. BotSayMiddle ("I cant even touch ");
  1808. }
  1809. else
  1810. {
  1811. if ((r < 0.9))
  1812. {
  1813. BotSayMiddle ("that was a nice one ");
  1814. }
  1815. else
  1816. {
  1817. BotSayMiddle ("<<<< Hates ");
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. }
  1824. }
  1825. }
  1826. }
  1827. }
  1828. }
  1829. BotSayMiddle (p.netname);
  1830. BotSayEnd ();
  1831. };
  1832. void (entity p) BotSayNiceOne =
  1833. {
  1834. local float n;
  1835. if ((p == world))
  1836. {
  1837. return;
  1838. }
  1839. if ((random () < 0.01))
  1840. {
  1841. n = random ();
  1842. if ((n < 0.33))
  1843. {
  1844. self.repeat = (time + (random () * 2));
  1845. self.repeated = "BOT DOWN!! BOT DOWN!!!\n";
  1846. }
  1847. else
  1848. {
  1849. if (((n < 0.66) && (n > 0.33)))
  1850. {
  1851. BotSay ("LAG.....");
  1852. }
  1853. else
  1854. {
  1855. if ((n > 0.66))
  1856. {
  1857. BotSay ("My ISP Stinks!!");
  1858. }
  1859. }
  1860. }
  1861. return;
  1862. }
  1863. if ((random () < 0.003))
  1864. {
  1865. if (BotSayStart ())
  1866. {
  1867. if ((random () < fAutoBotRand))
  1868. {
  1869. BotSayNiceOne1 (p);
  1870. }
  1871. else
  1872. {
  1873. BotSayNiceOne2 (p);
  1874. }
  1875. }
  1876. }
  1877. };
  1878.  
  1879. void () BotSayExtras1 =
  1880. {
  1881. local float r;
  1882.  
  1883. if (bot_chatter_rated_g)
  1884. {
  1885. return;
  1886. }
  1887. if ((random () < 0.3))
  1888. {
  1889. r = random ();
  1890. if ((r < 0.05))
  1891. {
  1892. BotSay ("frag them all");
  1893. }
  1894. else
  1895. {
  1896. if ((r < 0.1))
  1897. {
  1898. BotSay ("frag fest baby");
  1899. }
  1900. else
  1901. {
  1902. if ((r < 0.15))
  1903. {
  1904. BotSay ("i want to kill");
  1905. }
  1906. else
  1907. {
  1908. if ((r < 0.2))
  1909. {
  1910. BotSay ("i love ass-kicking");
  1911. }
  1912. else
  1913. {
  1914. if ((r < 0.25))
  1915. {
  1916. BotSay ("i love a good frag fest");
  1917. }
  1918. else
  1919. {
  1920. if ((r < 0.3))
  1921. {
  1922. BotSay ("it's gibbin' time");
  1923. }
  1924. else
  1925. {
  1926. if ((r < 0.35))
  1927. {
  1928. BotSay ("Anyone else lagged?");
  1929. }
  1930. else
  1931. {
  1932. if ((r < LMQUOTA_ARMOR))
  1933. {
  1934. BotSay ("i love killing");
  1935. }
  1936. else
  1937. {
  1938. if ((r < 0.45))
  1939. {
  1940. BotSay ("i'm going to kill you all");
  1941. }
  1942. else
  1943. {
  1944. if ((r < fAutoBotRand))
  1945. {
  1946. BotSay ("killing is my life");
  1947. }
  1948. else
  1949. {
  1950. if ((r < 0.55))
  1951. {
  1952. BotSay ("frag frag frag");
  1953. }
  1954. else
  1955. {
  1956. if ((r < 0.6))
  1957. {
  1958. BotSay ("kill 'em all");
  1959. }
  1960. else
  1961. {
  1962. if ((r < 0.65))
  1963. {
  1964. BotSay ("i love this level");
  1965. }
  1966. else
  1967. {
  1968. if ((r < 0.7))
  1969. {
  1970. BotSay ("me kill good");
  1971. }
  1972. else
  1973. {
  1974. if ((r < 0.75))
  1975. {
  1976. BotSay ("this is my favorite map");
  1977. }
  1978. else
  1979. {
  1980. if ((r < 0.8))
  1981. {
  1982. BotSay ("it's a frag-a-thon");
  1983. }
  1984. else
  1985. {
  1986. if ((r < 0.85))
  1987. {
  1988. BotSay ("welcome to fragtown");
  1989. }
  1990. else
  1991. {
  1992. if ((r < 0.9))
  1993. {
  1994. BotSay ("psycho killer time");
  1995. }
  1996. else
  1997. {
  1998. if ((r < 0.95))
  1999. {
  2000. BotSay ("Whats Grapple impulse here again?");
  2001. }
  2002. else
  2003. {
  2004. BotSay ("shoot 'em if you got 'em");
  2005. }
  2006. }
  2007. }
  2008. }
  2009. }
  2010. }
  2011. }
  2012. }
  2013. }
  2014. }
  2015. }
  2016. }
  2017. }
  2018. }
  2019. }
  2020. }
  2021. }
  2022. }
  2023. }
  2024. }
  2025. };
  2026.  
  2027. void () BotSayExtras2 =
  2028. {
  2029. local float r;
  2030.  
  2031. if (bot_chatter_rated_g)
  2032. {
  2033. return;
  2034. }
  2035. if ((random () < 0.3))
  2036. {
  2037. r = random ();
  2038. if ((r < 0.05))
  2039. {
  2040. BotSay ("you are all dead meat");
  2041. }
  2042. else
  2043. {
  2044. if ((r < 0.1))
  2045. {
  2046. BotSay ("i love quad");
  2047. }
  2048. else
  2049. {
  2050. if ((r < 0.15))
  2051. {
  2052. BotSay ("who else loves quad?");
  2053. }
  2054. else
  2055. {
  2056. if ((r < 0.2))
  2057. {
  2058. BotSay ("me shoot you now");
  2059. }
  2060. else
  2061. {
  2062. if ((r < 0.25))
  2063. {
  2064. BotSay ("this map kicks ass");
  2065. }
  2066. else
  2067. {
  2068. if ((r < 0.3))
  2069. {
  2070. BotSay ("lets go team");
  2071. }
  2072. else
  2073. {
  2074. if ((r < 0.35))
  2075. {
  2076. BotSay ("remember teamwork pays off");
  2077. }
  2078. else
  2079. {
  2080. if ((r < LMQUOTA_ARMOR))
  2081. {
  2082. BotSay ("Someone stay on Defense....");
  2083. }
  2084. else
  2085. {
  2086. if ((r < 0.45))
  2087. {
  2088. BotSay ("Grapple hook is impulse 39 or 22 I think.");
  2089. }
  2090. else
  2091. {
  2092. if ((r < fAutoBotRand))
  2093. {
  2094. BotSay ("heads up everyone");
  2095. }
  2096. else
  2097. {
  2098. if ((r < 0.55))
  2099. {
  2100. BotSay ("this kicks ass");
  2101. }
  2102. else
  2103. {
  2104. if ((r < 0.6))
  2105. {
  2106. BotSay ("i love it");
  2107. }
  2108. else
  2109. {
  2110. if ((r < 0.65))
  2111. {
  2112. BotSay ("gibs everywhere");
  2113. }
  2114. else
  2115. {
  2116. if ((r < 0.7))
  2117. {
  2118. BotSay ("i will now kill");
  2119. }
  2120. else
  2121. {
  2122. if ((r < 0.75))
  2123. {
  2124. BotSay ("kick butt");
  2125. }
  2126. else
  2127. {
  2128. if ((r < 0.8))
  2129. {
  2130. BotSay ("i love watching gibs fly");
  2131. }
  2132. else
  2133. {
  2134. if ((r < 0.85))
  2135. {
  2136. BotSay ("non-stop fragging");
  2137. }
  2138. else
  2139. {
  2140. if ((r < 0.9))
  2141. {
  2142. BotSay ("Hmmmmm.....");
  2143. }
  2144. else
  2145. {
  2146. if ((r < 0.95))
  2147. {
  2148. BotSay ("Dont Block your Teammates!");
  2149. }
  2150. else
  2151. {
  2152. BotSay ("i love the rocket launcher");
  2153. }
  2154. }
  2155. }
  2156. }
  2157. }
  2158. }
  2159. }
  2160. }
  2161. }
  2162. }
  2163. }
  2164. }
  2165. }
  2166. }
  2167. }
  2168. }
  2169. }
  2170. }
  2171. }
  2172. }
  2173. else
  2174. {
  2175. if ((random () < 0.33))
  2176. {
  2177. if ((self.bot_plan == BOT_ATTACK))
  2178. {
  2179. fBotSayTeam (": I'm On Offense....\n");
  2180. }
  2181. if ((self.bot_plan == BOT_DEFEND))
  2182. {
  2183. fBotSayTeam (": I'm On Defense.....\n");
  2184. }
  2185. }
  2186. }
  2187. };
  2188.  
  2189. void () BotSayExtras =
  2190. {
  2191. if (bot_chatter_rated_g)
  2192. {
  2193. return;
  2194. }
  2195. if ((random () < 0.3))
  2196. {
  2197. if ((random () < fAutoBotRand))
  2198. {
  2199. BotSayExtras1 ();
  2200. }
  2201. else
  2202. {
  2203. BotSayExtras2 ();
  2204. }
  2205. }
  2206. };
  2207.  
  2208. float (float fteam) IsHumanOnTeam =
  2209. {
  2210. local entity p;
  2211.  
  2212. p = find (world, classname, "player");
  2213. while ((p != world))
  2214. {
  2215. if ((p.team == fteam))
  2216. {
  2217. return (TRUE);
  2218. }
  2219. p = find (p, classname, "player");
  2220. }
  2221. return (FALSE);
  2222. };
  2223.  
  2224. float (float fteam) GetNumTeamCaptures =
  2225. {
  2226. local entity p;
  2227. local float sum;
  2228.  
  2229. p = find (world, classname, "bot");
  2230. while ((p != world))
  2231. {
  2232. if ((p.team == fteam))
  2233. {
  2234. sum = (sum + p.num_captures);
  2235. }
  2236. p = find (p, classname, "bot");
  2237. }
  2238. p = find (world, classname, "player");
  2239. while ((p != world))
  2240. {
  2241. if ((p.team == fteam))
  2242. {
  2243. sum = (sum + p.num_captures);
  2244. }
  2245. p = find (p, classname, "player");
  2246. }
  2247. return (sum);
  2248. };
  2249.  
  2250. float (float fteam) GetNumTeamFrags =
  2251. {
  2252. local entity p;
  2253. local float sum;
  2254.  
  2255. p = find (world, classname, "bot");
  2256. while ((p != world))
  2257. {
  2258. if ((p.team == fteam))
  2259. {
  2260. sum = (sum + p.frags);
  2261. }
  2262. p = find (p, classname, "bot");
  2263. }
  2264. p = find (world, classname, "player");
  2265. while ((p != world))
  2266. {
  2267. if ((p.team == fteam))
  2268. {
  2269. sum = (sum + p.frags);
  2270. }
  2271. p = find (p, classname, "player");
  2272. }
  2273. return (sum);
  2274. };
  2275.  
  2276. float (float fteam) TeamHasFlag =
  2277. {
  2278. local entity p;
  2279.  
  2280. if ((fteam == TEAM_COLOR1))
  2281. {
  2282. p = find (world, classname, "item_flag_team1");
  2283. }
  2284. else
  2285. {
  2286. if ((fteam == TEAM_COLOR2))
  2287. {
  2288. p = find (world, classname, "item_flag_team2");
  2289. }
  2290. else
  2291. {
  2292. error ("Bogus Team\n");
  2293. }
  2294. }
  2295. if ((p.cnt == FLAG_CARRIED))
  2296. {
  2297. if ((p.owner.team == fteam))
  2298. {
  2299. return (TRUE);
  2300. }
  2301. }
  2302. return (FALSE);
  2303. };
  2304.  
  2305. void (float fteam) PrintTeamStatus =
  2306. {
  2307. local float f;
  2308. local float fe;
  2309. local float fenemyteam;
  2310. local float n_flag;
  2311. local float n_attack;
  2312. local float n_defend;
  2313. local float n_roam;
  2314. local float n_camp;
  2315. local float n_escort;
  2316. local float n_bot;
  2317. local float n_human;
  2318. local entity p;
  2319. local string st;
  2320.  
  2321. if ((self.classname != "player"))
  2322. {
  2323. return;
  2324. }
  2325. n_flag = action;
  2326. n_attack = action;
  2327. n_defend = action;
  2328. n_roam = action;
  2329. n_camp = action;
  2330. n_escort = action;
  2331. p = find (world, classname, "bot");
  2332. while ((p != world))
  2333. {
  2334. if ((p.team == self.team))
  2335. {
  2336. if ((p.player_flag & ITEM_ENEMY_FLAG))
  2337. {
  2338. n_flag = TRUE;
  2339. }
  2340. else
  2341. {
  2342. if ((time < (p.camping_time + CAMPING_TIME)))
  2343. {
  2344. n_camp = (n_camp + 1);
  2345. }
  2346. else
  2347. {
  2348. if ((time < (p.escort_time + ESCORT_TIME)))
  2349. {
  2350. n_escort = (n_escort + 1);
  2351. }
  2352. else
  2353. {
  2354. if ((p.bot_plan == BOT_ATTACK))
  2355. {
  2356. n_attack = (n_attack + 1);
  2357. }
  2358. else
  2359. {
  2360. if ((p.bot_plan == BOT_DEFEND))
  2361. {
  2362. n_defend = (n_defend + 1);
  2363. }
  2364. else
  2365. {
  2366. if ((p.bot_plan == 3))
  2367. {
  2368. n_roam = (n_roam + 1);
  2369. }
  2370. }
  2371. }
  2372. }
  2373. }
  2374. }
  2375. n_bot = (n_bot + 1);
  2376. }
  2377. p = find (p, classname, "bot");
  2378. }
  2379. p = find (world, classname, "player");
  2380. while ((p != world))
  2381. {
  2382. if ((p.team == self.team))
  2383. {
  2384. n_human = (n_human + 1);
  2385. }
  2386. p = find (p, classname, "player");
  2387. }
  2388. sprint (self, "\n");
  2389. if ((self.team == TEAM_COLOR1))
  2390. {
  2391. sprint (self, "Òåä Team Status:\n");
  2392. fenemyteam = TEAM_COLOR2;
  2393. }
  2394. else
  2395. {
  2396. if ((self.team == TEAM_COLOR2))
  2397. {
  2398. sprint (self, "Âìõå Team Status:\n");
  2399. fenemyteam = TEAM_COLOR1;
  2400. }
  2401. }
  2402. if (map_has_waypoints)
  2403. {
  2404. st = ftos (n_attack);
  2405. sprint (self, st);
  2406. sprint (self, " attack, ");
  2407. st = ftos (n_defend);
  2408. sprint (self, st);
  2409. sprint (self, " defend, ");
  2410. st = ftos (n_roam);
  2411. sprint (self, st);
  2412. sprint (self, " roam\n");
  2413. }
  2414. st = ftos (n_escort);
  2415. sprint (self, st);
  2416. sprint (self, " escort, ");
  2417. st = ftos (n_camp);
  2418. sprint (self, st);
  2419. sprint (self, " camp, ");
  2420. if (n_flag)
  2421. {
  2422. sprint (self, "1 flag carrier");
  2423. }
  2424. sprint (self, "\n");
  2425. };
  2426.  
  2427. void (float fteam) MoreBotsDefend =
  2428. {
  2429. local entity p;
  2430. local float found;
  2431.  
  2432. if (!map_has_waypoints)
  2433. {
  2434. sprint (self, "map has no waypoints\n");
  2435. sprint (self, "orders not possible\n");
  2436. return;
  2437. }
  2438. found = FALSE;
  2439. p = find (world, classname, "bot");
  2440. while (((p != world) && !found))
  2441. {
  2442. if ((p.team == fteam))
  2443. {
  2444. if ((time >= (p.camping_time + CAMPING_TIME)))
  2445. {
  2446. if ((time >= (p.escort_time + ESCORT_TIME)))
  2447. {
  2448. if ((p.bot_plan == 3))
  2449. {
  2450. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2451. {
  2452. p.bot_plan = BOT_DEFEND;
  2453. found = TRUE;
  2454. }
  2455. }
  2456. }
  2457. }
  2458. }
  2459. p = find (p, classname, "bot");
  2460. }
  2461. if (!found)
  2462. {
  2463. p = find (world, classname, "bot");
  2464. while (((p != world) && !found))
  2465. {
  2466. if ((p.team == fteam))
  2467. {
  2468. if ((time >= (p.camping_time + CAMPING_TIME)))
  2469. {
  2470. if ((time >= (p.escort_time + ESCORT_TIME)))
  2471. {
  2472. if ((p.bot_plan == BOT_ATTACK))
  2473. {
  2474. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2475. {
  2476. p.bot_plan = BOT_DEFEND;
  2477. found = TRUE;
  2478. }
  2479. }
  2480. }
  2481. }
  2482. }
  2483. p = find (p, classname, "bot");
  2484. }
  2485. }
  2486. if (!found)
  2487. {
  2488. p = find (world, classname, "bot");
  2489. while (((p != world) && !found))
  2490. {
  2491. if ((p.team == fteam))
  2492. {
  2493. if ((time < (p.camping_time + CAMPING_TIME)))
  2494. {
  2495. if ((time >= (p.escort_time + ESCORT_TIME)))
  2496. {
  2497. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2498. {
  2499. if ((p.bot_plan != BOT_DEFEND))
  2500. {
  2501. p.bot_plan = BOT_DEFEND;
  2502. p.camping_time = (time - 99);
  2503. found = TRUE;
  2504. }
  2505. }
  2506. }
  2507. }
  2508. }
  2509. p = find (p, classname, "bot");
  2510. }
  2511. }
  2512. if (!found)
  2513. {
  2514. p = find (world, classname, "bot");
  2515. while (((p != world) && !found))
  2516. {
  2517. if ((p.team == fteam))
  2518. {
  2519. if ((p.bot_plan != BOT_DEFEND))
  2520. {
  2521. if ((time >= (p.camping_time + CAMPING_TIME)))
  2522. {
  2523. if ((time < (p.escort_time + ESCORT_TIME)))
  2524. {
  2525. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2526. {
  2527. p.bot_plan = BOT_DEFEND;
  2528. p.camping_time = (time - 99);
  2529. found = TRUE;
  2530. }
  2531. }
  2532. }
  2533. }
  2534. }
  2535. p = find (p, classname, "bot");
  2536. }
  2537. }
  2538. if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
  2539. {
  2540. sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
  2541. }
  2542. sprint (self, self.netname);
  2543. sprint (self, " orders ÄÅÆÅÎÄ‘ ");
  2544. PrintTeamStatus (self.team);
  2545. };
  2546.  
  2547. void (float fteam) MoreBotsAttack =
  2548. {
  2549. local entity p;
  2550. local float found;
  2551.  
  2552. if (!map_has_waypoints)
  2553. {
  2554. sprint (self, "map has no waypoints\n");
  2555. sprint (self, "orders not possible\n");
  2556. return;
  2557. }
  2558. found = FALSE;
  2559. p = find (world, classname, "bot");
  2560. while (((p != world) && !found))
  2561. {
  2562. if ((p.team == fteam))
  2563. {
  2564. if ((p.bot_plan == 3))
  2565. {
  2566. if ((time >= (p.camping_time + CAMPING_TIME)))
  2567. {
  2568. if ((time >= (p.escort_time + ESCORT_TIME)))
  2569. {
  2570. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2571. {
  2572. p.bot_plan = BOT_ATTACK;
  2573. found = TRUE;
  2574. }
  2575. }
  2576. }
  2577. }
  2578. }
  2579. p = find (p, classname, "bot");
  2580. }
  2581. if (!found)
  2582. {
  2583. p = find (world, classname, "bot");
  2584. while (((p != world) && !found))
  2585. {
  2586. if ((p.team == fteam))
  2587. {
  2588. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2589. {
  2590. if ((time >= (p.camping_time + CAMPING_TIME)))
  2591. {
  2592. if ((time >= (p.escort_time + ESCORT_TIME)))
  2593. {
  2594. if ((p.bot_plan == BOT_DEFEND))
  2595. {
  2596. p.bot_plan = BOT_ATTACK;
  2597. found = TRUE;
  2598. }
  2599. }
  2600. }
  2601. }
  2602. }
  2603. p = find (p, classname, "bot");
  2604. }
  2605. }
  2606. if (!found)
  2607. {
  2608. p = find (world, classname, "bot");
  2609. while (((p != world) && !found))
  2610. {
  2611. if ((p.team == fteam))
  2612. {
  2613. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2614. {
  2615. if ((time >= (p.escort_time + ESCORT_TIME)))
  2616. {
  2617. if ((p.bot_plan != BOT_ATTACK))
  2618. {
  2619. p.bot_plan = BOT_ATTACK;
  2620. p.camping_time = (time - 999);
  2621. if ((p.camping_entity != world))
  2622. {
  2623. remove (p.camping_entity);
  2624. p.camping_entity = world;
  2625. }
  2626. found = TRUE;
  2627. }
  2628. }
  2629. }
  2630. }
  2631. p = find (p, classname, "bot");
  2632. }
  2633. }
  2634. if (!found)
  2635. {
  2636. p = find (world, classname, "bot");
  2637. while (((p != world) && !found))
  2638. {
  2639. if ((p.team == fteam))
  2640. {
  2641. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2642. {
  2643. if ((time >= (p.camping_time + CAMPING_TIME)))
  2644. {
  2645. if ((time < (p.escort_time + ESCORT_TIME)))
  2646. {
  2647. if ((p.bot_plan != BOT_ATTACK))
  2648. {
  2649. p.bot_plan = BOT_ATTACK;
  2650. p.escort_time = (time - 999);
  2651. found = TRUE;
  2652. }
  2653. }
  2654. }
  2655. }
  2656. }
  2657. p = find (p, classname, "bot");
  2658. }
  2659. }
  2660. if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
  2661. {
  2662. sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
  2663. }
  2664. sprint (self, self.netname);
  2665. sprint (self, " orders ÁÔÔÁÃË‘ ");
  2666. PrintTeamStatus (self.team);
  2667. };
  2668.  
  2669. void (float fteam) MoreBotsRoam =
  2670. {
  2671. local entity p;
  2672. local float found;
  2673.  
  2674. if (!map_has_waypoints)
  2675. {
  2676. sprint (self, "map has no waypoints\n");
  2677. sprint (self, "orders not possible\n");
  2678. return;
  2679. }
  2680. found = FALSE;
  2681. p = find (world, classname, "bot");
  2682. while (((p != world) && !found))
  2683. {
  2684. if ((p.team == fteam))
  2685. {
  2686. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2687. {
  2688. if ((time >= (p.camping_time + CAMPING_TIME)))
  2689. {
  2690. if ((time >= (p.escort_time + ESCORT_TIME)))
  2691. {
  2692. if ((p.bot_plan == BOT_ATTACK))
  2693. {
  2694. p.bot_plan = BOT_ROAM;
  2695. found = TRUE;
  2696. }
  2697. }
  2698. }
  2699. }
  2700. }
  2701. p = find (p, classname, "bot");
  2702. }
  2703. if (!found)
  2704. {
  2705. p = find (world, classname, "bot");
  2706. while (((p != world) && !found))
  2707. {
  2708. if ((p.team == fteam))
  2709. {
  2710. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2711. {
  2712. if ((time >= (p.camping_time + CAMPING_TIME)))
  2713. {
  2714. if ((time >= (p.escort_time + ESCORT_TIME)))
  2715. {
  2716. if ((p.bot_plan == BOT_DEFEND))
  2717. {
  2718. p.bot_plan = BOT_ROAM;
  2719. found = TRUE;
  2720. }
  2721. }
  2722. }
  2723. }
  2724. }
  2725. p = find (p, classname, "bot");
  2726. }
  2727. }
  2728. if (!found)
  2729. {
  2730. p = find (world, classname, "bot");
  2731. while (((p != world) && !found))
  2732. {
  2733. if ((p.team == fteam))
  2734. {
  2735. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2736. {
  2737. if ((time < (p.camping_time + CAMPING_TIME)))
  2738. {
  2739. if ((time >= (p.escort_time + ESCORT_TIME)))
  2740. {
  2741. if ((p.bot_plan != BOT_ROAM))
  2742. {
  2743. p.bot_plan = BOT_ROAM;
  2744. p.camping_time = (time - 999);
  2745. if ((p.camping_entity != world))
  2746. {
  2747. remove (p.camping_entity);
  2748. p.camping_entity = world;
  2749. }
  2750. found = TRUE;
  2751. }
  2752. }
  2753. }
  2754. }
  2755. }
  2756. p = find (p, classname, "bot");
  2757. }
  2758. }
  2759. if (!found)
  2760. {
  2761. p = find (world, classname, "bot");
  2762. while (((p != world) && !found))
  2763. {
  2764. if ((p.team == fteam))
  2765. {
  2766. if (!(p.player_flag & ITEM_ENEMY_FLAG))
  2767. {
  2768. if ((time >= (p.camping_time + CAMPING_TIME)))
  2769. {
  2770. if ((time < (p.escort_time + ESCORT_TIME)))
  2771. {
  2772. if ((p.bot_plan != BOT_ROAM))
  2773. {
  2774. p.bot_plan = BOT_ROAM;
  2775. p.escort_time = (time - 999);
  2776. found = TRUE;
  2777. }
  2778. }
  2779. }
  2780. }
  2781. }
  2782. p = find (p, classname, "bot");
  2783. }
  2784. }
  2785. if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
  2786. {
  2787. sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
  2788. }
  2789. sprint (self, self.netname);
  2790. sprint (self, " orders ÒÏÁÍ‘ ");
  2791. PrintTeamStatus (self.team);
  2792. };
  2793.  
  2794. void (float fteam) AllBotsDefend =
  2795. {
  2796. local entity p;
  2797.  
  2798. if (!map_has_waypoints)
  2799. {
  2800. sprint (self, "map has no waypoints\n");
  2801. sprint (self, "orders not possible\n");
  2802. return;
  2803. }
  2804. sprint (self, self.netname);
  2805. sprint (self, " orders ");
  2806. if ((self.team == TEAM_COLOR1))
  2807. {
  2808. sprint (self, "Òåä team to defend\n");
  2809. last_order_time_team1 = time;
  2810. }
  2811. else
  2812. {
  2813. if ((self.team == TEAM_COLOR2))
  2814. {
  2815. sprint (self, "Âìõå team to defend\n");
  2816. last_order_time_team2 = time;
  2817. }
  2818. else
  2819. {
  2820. return;
  2821. }
  2822. }
  2823. p = find (world, classname, "bot");
  2824. while ((p != world))
  2825. {
  2826. if ((p.team == fteam))
  2827. {
  2828. p.bot_plan = BOT_DEFEND;
  2829. }
  2830. p = find (p, classname, "bot");
  2831. }
  2832. if (!(temp1 & TEMP1_NOMESS))
  2833. {
  2834. sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
  2835. }
  2836. };
  2837.  
  2838. void (float fteam) AllBotsAttack =
  2839. {
  2840. local entity p;
  2841.  
  2842. if (!map_has_waypoints)
  2843. {
  2844. sprint (self, "map has no waypoints\n");
  2845. sprint (self, "orders not possible\n");
  2846. return;
  2847. }
  2848. sprint (self, self.netname);
  2849. sprint (self, " orders\n ");
  2850. if ((self.team == TEAM_COLOR1))
  2851. {
  2852. sprint (self, "Òåä team to attack\n");
  2853. last_order_time_team1 = time;
  2854. }
  2855. else
  2856. {
  2857. if ((self.team == TEAM_COLOR2))
  2858. {
  2859. sprint (self, "Âìõå team to attack\n");
  2860. last_order_time_team2 = time;
  2861. }
  2862. else
  2863. {
  2864. return;
  2865. }
  2866. }
  2867. p = find (world, classname, "bot");
  2868. while ((p != world))
  2869. {
  2870. if (((p.team == fteam) && !(p.player_flag & ITEM_ENEMY_FLAG)))
  2871. {
  2872. p.bot_plan = BOT_ATTACK;
  2873. }
  2874. p = find (p, classname, "bot");
  2875. }
  2876. if (!(temp1 & TEMP1_NOMESS))
  2877. {
  2878. sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
  2879. }
  2880. };
  2881.  
  2882. void () ToggleWaypoints =
  2883. {
  2884. local entity p;
  2885.  
  2886. if (map_has_waypoints)
  2887. {
  2888. map_has_waypoints = FALSE;
  2889. bprint ("waypoints disabled for ");
  2890. }
  2891. else
  2892. {
  2893. p = find (world, classname, "waypoint");
  2894. if ((p != world))
  2895. {
  2896. map_has_waypoints = TRUE;
  2897. bprint ("waypoints re-enabled for ");
  2898. }
  2899. else
  2900. {
  2901. if ((self.classname == "player"))
  2902. {
  2903. bprint ("no waypoints for ");
  2904. }
  2905. }
  2906. }
  2907. bprint (mapname);
  2908. bprint ("\n");
  2909. };
  2910.  
  2911. entity (entity head) FindNextPlayerOrBot =
  2912. {
  2913. local entity h;
  2914.  
  2915. h = head;
  2916. if ((h.classname == "bot"))
  2917. {
  2918. h = find (h, classname, "bot");
  2919. }
  2920. else
  2921. {
  2922. h = find (h, classname, "player");
  2923. if ((h == world))
  2924. {
  2925. h = find (world, classname, "bot");
  2926. }
  2927. }
  2928. if (h.observer)
  2929. h.team = -50;
  2930. return (h);
  2931. };
  2932.  
  2933. void () RemoveAllBots =
  2934. {
  2935. local entity p,m;
  2936. local entity old_self;
  2937. local entity removebot;
  2938.  
  2939. p = find (world, classname, "bot");
  2940. if ((p != world))
  2941. {
  2942. while ((p != world))
  2943. {
  2944. old_self = self;
  2945. self = p;
  2946. self.skin = 0;
  2947. set_suicide_frame ();
  2948. self.flags = self.flags - FL_CLIENT;
  2949. self.colormap = -1;
  2950. clientSetFree (self.fClientNo);
  2951. ClientDisconnect ();
  2952. self = old_self;
  2953. dropclient(p);
  2954. remove (p);
  2955. p = find (world, classname, "bot");
  2956. }
  2957. next_bot_num = 0;
  2958. next_bot_red = 0;
  2959. next_bot_blue = 0;
  2960. botmastermind = 2;
  2961. bprint ("All bots have been removed\n");
  2962. waypoint_idle = 300;
  2963. Waypoint_Toggle ();
  2964.  
  2965.  
  2966. }
  2967. };
  2968.  
  2969. void () BotKeepTeamsEven =
  2970. {
  2971. local entity p;
  2972. local entity oself;
  2973. local float n_red;
  2974. local float n_blue;
  2975. local float i;
  2976. local float svaim;
  2977. local float tmp;
  2978. local float added;
  2979. local float bskill;
  2980. local float bskill2;
  2981. local float vary_skill;
  2982. local string st;
  2983. local float teamsize_blue;
  2984. local float teamsize_red;
  2985.  
  2986. if (intermission_running || gameover)
  2987. return;
  2988.  
  2989.  
  2990. /*
  2991. if (!(temp1 & TEMP1_AUTO_EVEN_TEAMS))
  2992. {
  2993. return;
  2994. }
  2995. */
  2996.  
  2997.  
  2998. n_red = action;
  2999. p = find (world, classname, "bot");
  3000. while ((p != world))
  3001. {
  3002. if ((p.team == TEAM_COLOR1))
  3003. {
  3004. n_red = (n_red + 1);
  3005. }
  3006. p = FindNextPlayerOrBot (p);
  3007. }
  3008. n_blue = action;
  3009. p = find (world, classname, "bot");
  3010. while ((p != world))
  3011. {
  3012. if ((p.team == TEAM_COLOR2))
  3013. {
  3014. n_blue = (n_blue + 1);
  3015. }
  3016. p = FindNextPlayerOrBot (p);
  3017. }
  3018. p = find (world, classname, "player");
  3019. if ((p == world))
  3020. {
  3021. dprint ("No human players\n");
  3022. //RemoveAllBots ();
  3023. }
  3024. //oself = self;
  3025. //self = p;
  3026.  
  3027. added = FALSE;
  3028. svaim = cvar ("sv_aim");
  3029. if (((svaim >= action) && (svaim <= 1)))
  3030. {
  3031. return;
  3032. }
  3033. bskill = action;
  3034. if ((svaim & 1))
  3035. {
  3036. svaim = (svaim - 1);
  3037. bskill = (bskill + 1);
  3038. }
  3039. if ((svaim & SPAWNFLAG_LASER))
  3040. {
  3041. svaim = (svaim - SPAWNFLAG_LASER);
  3042. bskill = (bskill + SPAWNFLAG_LASER);
  3043. }
  3044. if ((svaim & TEAM_STATIC_TEAMS))
  3045. {
  3046. svaim = (svaim - TEAM_STATIC_TEAMS);
  3047. vary_skill = TRUE;
  3048. }
  3049. else
  3050. {
  3051. vary_skill = FALSE;
  3052. }
  3053. bskill = (bskill + (svaim - floor (svaim)));
  3054. svaim = floor (svaim);
  3055. teamsize_blue = (svaim / 128);
  3056. teamsize_blue = floor (teamsize_blue);
  3057. svaim = (svaim - (teamsize_blue * 128));
  3058. teamsize_red = (svaim / 4);
  3059. teamsize_red = floor (teamsize_red);
  3060.  
  3061.  
  3062. if ((n_red < teamsize_red))
  3063. {
  3064. i = (teamsize_red - n_red);
  3065. bprint ("*keeping teams even:\nAdding ");
  3066. st = ftos (i);
  3067. bprint (st);
  3068. bprint (" ÒÅÄ bots\n");
  3069. added = TRUE;
  3070. while ((i > action))
  3071. {
  3072. bskill2 = bskill;
  3073. if (vary_skill)
  3074. {
  3075. bskill2 = (bskill2 + (random () - fAutoBotRand));
  3076. }
  3077. if ((bskill2 > 3))
  3078. {
  3079. bskill2 = 3;
  3080. }
  3081. if ((bskill2 < action))
  3082. {
  3083. bskill2 = action;
  3084. }
  3085.  
  3086. CreateRedBot (bskill2);
  3087. i = (i - 1);
  3088. }
  3089. }
  3090. else
  3091. {
  3092. if ((n_red > teamsize_red))
  3093. {
  3094. i = (n_red - teamsize_red);
  3095. bprint ("keeping teams even:\nRemoving ");
  3096. st = ftos (i);
  3097. bprint (st);
  3098. bprint (" ÒÅÄ bots\n");
  3099. added = TRUE;
  3100. while ((i > action))
  3101. {
  3102. RemoveBestBot (TEAM_COLOR1);
  3103. i = (i - 1);
  3104. }
  3105. }
  3106. }
  3107. if ((n_blue < teamsize_blue))
  3108. {
  3109. i = (teamsize_blue - n_blue);
  3110. bprint ("**keeping teams even:\nAdding ");
  3111. st = ftos (i);
  3112. bprint (st);
  3113. bprint (" ÂÌÕÅ bots\n");
  3114. added = TRUE;
  3115. while ((i > action))
  3116. {
  3117. bskill2 = bskill;
  3118. if (vary_skill)
  3119. {
  3120. bskill2 = (bskill2 + (random () - fAutoBotRand));
  3121. }
  3122. if ((bskill2 > 3))
  3123. {
  3124. bskill2 = 3;
  3125. }
  3126. if ((bskill2 < action))
  3127. {
  3128. bskill2 = action;
  3129. }
  3130.  
  3131. CreateBlueBot (bskill2);
  3132. i = (i - 1);
  3133. }
  3134. }
  3135. else
  3136. {
  3137. if ((n_blue > teamsize_blue))
  3138. {
  3139. i = (n_blue - teamsize_blue);
  3140. bprint ("keeping teams even:\nRemoving ");
  3141. st = ftos (i);
  3142. bprint (st);
  3143. bprint (" ÂÌÕÅ bots\n");
  3144. added = TRUE;
  3145. while ((i > action))
  3146. {
  3147. RemoveBestBot (TEAM_COLOR2);
  3148. i = (i - 1);
  3149. }
  3150. }
  3151. }
  3152. //self = oself;
  3153. };
  3154.  
  3155. void () TempWaypointTouch =
  3156. {
  3157. if ((other.classname == "bot"))
  3158. {
  3159. remove (self);
  3160. }
  3161. };
  3162.  
  3163. void (vector org, float timeout, float fteam) SpawnTempWaypoint =
  3164. {
  3165. local entity p;
  3166.  
  3167. p = spawn ();
  3168. p.classname = "waypoint_temp";
  3169. p.team = fteam;
  3170. p.solid = SOLID_TRIGGER;
  3171. p.movetype = MOVETYPE_NONE;
  3172. p.origin = org;
  3173. setorigin (p, p.origin);
  3174. setmodel (p, string_null);
  3175. p.touch = TempWaypointTouch;
  3176. p.think = SUB_Remove;
  3177. p.nextthink = (time + timeout);
  3178. };
  3179.  
  3180. entity () SpawnFollow =
  3181. {
  3182. local entity p;
  3183.  
  3184. p = spawn ();
  3185. p.classname = "follow_ent";
  3186. p.solid = SOLID_NOT;
  3187. p.movetype = MOVETYPE_NONE;
  3188. setmodel (p, string_null);
  3189. p.origin = (self.origin + '0 0 16');
  3190. setorigin (p, p.origin);
  3191. p.owner = self;
  3192. return (p);
  3193. };
  3194.  
  3195. void () SpawnFollowEntity =
  3196. {
  3197. local entity e;
  3198.  
  3199. if ((time < (self.last_follow_spawn + LMQUOTA_ARMOR)))
  3200. {
  3201. return;
  3202. }
  3203. if ((self.num_follows > 3))
  3204. {
  3205. if ((self.follow_tail != world))
  3206. {
  3207. e = self.follow_tail.follow_prev;
  3208. remove (self.follow_tail);
  3209. self.follow_tail = e;
  3210. self.num_follows = (self.num_follows - 1);
  3211. }
  3212. }
  3213. e = SpawnFollow ();
  3214. self.num_follows = (self.num_follows + 1);
  3215. if ((self.follow_head == world))
  3216. {
  3217. e.follow_next = world;
  3218. e.follow_prev = world;
  3219. self.follow_head = e;
  3220. self.follow_tail = e;
  3221. }
  3222. else
  3223. {
  3224. e.follow_next = self.follow_head;
  3225. e.follow_prev = world;
  3226. self.follow_head.follow_prev = e;
  3227. self.follow_head = e;
  3228. }
  3229. self.last_follow_spawn = time;
  3230. };
  3231.  
  3232. void () SwitchBotNames =
  3233. {
  3234. local entity p;
  3235.  
  3236. bots_have_normal_names = !bots_have_normal_names;
  3237. if (bots_have_normal_names)
  3238. {
  3239. bprint ("Bots now have normal names\n");
  3240. }
  3241. else
  3242. {
  3243. bprint ("Bots now have bot names\n");
  3244. }
  3245. p = find (world, classname, "bot");
  3246. while ((p != world))
  3247. {
  3248. if (bots_have_normal_names)
  3249. {
  3250. p.netname = p.altname;
  3251. }
  3252. else
  3253. {
  3254. p.netname = p.botname;
  3255. }
  3256. p = find (p, classname, "bot");
  3257. }
  3258. };
  3259.  
  3260. void (float fteam) ReportIn =
  3261. {
  3262. local entity p;
  3263. local entity oldself;
  3264.  
  3265. p = find (world, classname, "bot");
  3266. while ((p != world))
  3267. {
  3268. if ((p.team == fteam))
  3269. {
  3270. oldself = self;
  3271. self = p;
  3272. BotSayTeamStart2 ();
  3273. if ((p.player_flag & ITEM_ENEMY_FLAG))
  3274. {
  3275. BotSayTeamMiddle ("Have Flag! Heading back with ");
  3276. }
  3277. else
  3278. {
  3279. if ((time < (p.camping_time + CAMPING_TIME)))
  3280. {
  3281. BotSayTeamMiddle ("I camp with ");
  3282. }
  3283. else
  3284. {
  3285. if ((time < (p.escort_time + ESCORT_TIME)))
  3286. {
  3287. BotSayMiddle ("I escort ");
  3288. if ((p.escort_entity == world))
  3289. {
  3290. BotSayTeamMiddle ("???");
  3291. }
  3292. else
  3293. {
  3294. BotSayTeamMiddle (p.escort_entity.netname);
  3295. }
  3296. BotSayTeamMiddle (" with ");
  3297. }
  3298. else
  3299. {
  3300. if ((p.bot_plan == BOT_DEFEND))
  3301. {
  3302. BotSayTeamMiddle ("I defend with ");
  3303. }
  3304. else
  3305. {
  3306. if ((p.bot_plan == BOT_ATTACK))
  3307. {
  3308. BotSayTeamMiddle ("Heading to Enemy base with ");
  3309. }
  3310. else
  3311. {
  3312. if ((p.bot_plan == 3))
  3313. {
  3314. BotSayTeamMiddle ("I roam with ");
  3315. }
  3316. else
  3317. {
  3318. BotSayTeamMiddle ("???? with ");
  3319. }
  3320. }
  3321. }
  3322. }
  3323. }
  3324. }
  3325. if (((p.items & IT_LIGHTNING) && (p.ammo_cells > action)))
  3326. {
  3327. BotSayTeamMiddle ("thunderbolt");
  3328. }
  3329. else
  3330. {
  3331. if (((p.items & IT_ROCKET_LAUNCHER) && (p.ammo_rockets > action)))
  3332. {
  3333. BotSayTeamMiddle ("rocket launcher");
  3334. }
  3335. else
  3336. {
  3337. if (((p.items & IT_GRENADE_LAUNCHER) && (p.ammo_rockets > action)))
  3338. {
  3339. BotSayTeamMiddle ("grenade launcher");
  3340. }
  3341. else
  3342. {
  3343. if (((p.items & IT_SUPER_NAILGUN) && (p.ammo_nails > action)))
  3344. {
  3345. BotSayTeamMiddle ("super nailgun");
  3346. }
  3347. else
  3348. {
  3349. if (((p.items & IT_NAILGUN) && (p.ammo_nails > action)))
  3350. {
  3351. BotSayTeamMiddle ("nailgun");
  3352. }
  3353. else
  3354. {
  3355. if (((p.items & IT_SUPER_SHOTGUN) && (p.ammo_shells > action)))
  3356. {
  3357. BotSayTeamMiddle ("double shotgun");
  3358. }
  3359. else
  3360. {
  3361. BotSayTeamMiddle ("shotgun");
  3362. }
  3363. }
  3364. }
  3365. }
  3366. }
  3367. }
  3368. BotSayTeamEnd ();
  3369. self = oldself;
  3370. }
  3371. p = find (p, classname, "bot");
  3372. }
  3373. };
  3374.  
  3375. void () BotSaySomething =
  3376. {
  3377. if (bot_chatter_off)
  3378. {
  3379. return;
  3380. }
  3381. if ((random () < 0.001))
  3382. {
  3383. BotSayExtras ();
  3384. }
  3385. else
  3386. {
  3387. if (((time > (last_flag_capture + 3)) && (time < (last_flag_capture + SECRET_NO_SHOOT))))
  3388. {
  3389. BotSayDammit ();
  3390. }
  3391. else
  3392. {
  3393. if (((time > (last_flag_pickup + 3)) && (time < (last_flag_pickup + SECRET_NO_SHOOT))))
  3394. {
  3395. BotSayDefense ();
  3396. }
  3397. else
  3398. {
  3399. if (((time + TEAM_CAPTURE_CAPTURE_BONUS) > (cvar ("timelimit") * VOTEEXIT_TIME_LIMIT)))
  3400. {
  3401. BotSayGoodGame ();
  3402. }
  3403. else
  3404. {
  3405. if (((time > (self.last_kill_time + 3)) && (time < (self.last_kill_time + SECRET_NO_SHOOT))))
  3406. {
  3407. BotSayTaunt (self.last_kill_ent);
  3408. }
  3409. else
  3410. {
  3411. if (((time > (self.last_die_time + 3)) && (time < (self.last_die_time + SECRET_NO_SHOOT))))
  3412. {
  3413. BotSayNiceOne (self.last_die_ent);
  3414. }
  3415. }
  3416. }
  3417. }
  3418. }
  3419. }
  3420. };
  3421.  
  3422. void (entity p) BPrintFrags =
  3423. {
  3424. local string st;
  3425.  
  3426. if ((p.frags < 1000))
  3427. {
  3428. bprint (" ");
  3429. }
  3430. if ((p.frags < 100))
  3431. {
  3432. bprint (" ");
  3433. }
  3434. if ((p.frags < TEAM_CAPTURE_CAPTURE_BONUS))
  3435. {
  3436. bprint (" ");
  3437. }
  3438. st = ftos (p.frags);
  3439. bprint (st);
  3440. bprint (" ");
  3441. if ((p.team == TEAM_COLOR1))
  3442. {
  3443. bprint ("ÒÅÄ  ");
  3444. }
  3445. else
  3446. {
  3447. if ((p.team == TEAM_COLOR2))
  3448. {
  3449. bprint ("ÂÌÕÅ ");
  3450. }
  3451. }
  3452. bprint (p.netname);
  3453. if ((p.classname == "bot"))
  3454. {
  3455. bprint (" [skill ");
  3456. st = ftos (p.bot_skill);
  3457. bprint (st);
  3458. bprint ("]");
  3459. }
  3460. bprint ("\n");
  3461. };
  3462.  
  3463. void (entity p) PrintFrags =
  3464. {
  3465. local string st;
  3466.  
  3467. if ((p.frags < 1000))
  3468. {
  3469. sprint (self, " ");
  3470. }
  3471. if ((p.frags < 100))
  3472. {
  3473. sprint (self, " ");
  3474. }
  3475. if ((p.frags < TEAM_CAPTURE_CAPTURE_BONUS))
  3476. {
  3477. sprint (self, " ");
  3478. }
  3479. st = ftos (p.frags);
  3480. sprint (self, st);
  3481. sprint (self, " ");
  3482. if ((p.team == TEAM_COLOR1))
  3483. {
  3484. sprint (self, "ÒÅÄ  ");
  3485. }
  3486. else
  3487. {
  3488. if ((p.team == TEAM_COLOR2))
  3489. {
  3490. sprint (self, "ÂÌÕÅ ");
  3491. }
  3492. }
  3493. sprint (self, p.netname);
  3494. if ((p.classname == "bot"))
  3495. {
  3496. sprint (self, " [skill ");
  3497. st = ftos (p.bot_skill);
  3498. sprint (self, st);
  3499. sprint (self, "]");
  3500. }
  3501. sprint (self, "\n");
  3502. };
  3503.  
  3504. void (float broadcst) PrintFragList =
  3505. {
  3506. local entity p;
  3507. local entity best;
  3508. local float best_frags;
  3509. local float done;
  3510.  
  3511. if (((self.classname != "player") && !broadcst))
  3512. {
  3513. return;
  3514. }
  3515. p = find (world, classname, "player");
  3516. while ((p != world))
  3517. {
  3518. p.bsort = FALSE;
  3519. p = FindNextPlayerOrBot (p);
  3520. }
  3521. done = FALSE;
  3522. if (broadcst)
  3523. {
  3524. bprint ("\nžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžŸ\n");
  3525. bprint ("   Òáîëéîçó‘\n");
  3526. }
  3527. else
  3528. {
  3529. sprint (self, "\nžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžŸ\n");
  3530. sprint (self, "   Òáîëéîçó‘\n");
  3531. }
  3532. while (!done)
  3533. {
  3534. best_frags = action;
  3535. best = world;
  3536. p = find (world, classname, "player");
  3537. while ((p != world))
  3538. {
  3539. if (!p.bsort)
  3540. {
  3541. if ((p.frags >= best_frags))
  3542. {
  3543. best = p;
  3544. best_frags = p.frags;
  3545. }
  3546. }
  3547. p = FindNextPlayerOrBot (p);
  3548. }
  3549. if ((best == world))
  3550. {
  3551. done = TRUE;
  3552. }
  3553. else
  3554. {
  3555. if (broadcst)
  3556. {
  3557. BPrintFrags (best);
  3558. }
  3559. else
  3560. {
  3561. PrintFrags (best);
  3562. }
  3563. best.bsort = TRUE;
  3564. }
  3565. }
  3566. };
  3567.  
  3568. void (float broadcst) PrintFragList0 =
  3569. {
  3570. local entity p;
  3571. local float num_rbots;
  3572. local float num_bbots;
  3573. local float num_rhumans;
  3574. local float num_bhumans;
  3575. local string st;
  3576.  
  3577. if (((self.classname != "player") && !broadcst))
  3578. {
  3579. return;
  3580. }
  3581. p = find (world, classname, "player");
  3582. while ((p != world))
  3583. {
  3584. if ((p.team == TEAM_COLOR1))
  3585. {
  3586. num_rhumans = (num_rhumans + 1);
  3587. }
  3588. else
  3589. {
  3590. if ((p.team == TEAM_COLOR2))
  3591. {
  3592. num_bhumans = (num_bhumans + 1);
  3593. }
  3594. }
  3595. if (broadcst)
  3596. {
  3597. BPrintFrags (p);
  3598. }
  3599. else
  3600. {
  3601. PrintFrags (p);
  3602. }
  3603. p = find (p, classname, "player");
  3604. }
  3605. p = find (world, classname, "bot");
  3606. while ((p != world))
  3607. {
  3608. if ((p.team == TEAM_COLOR1))
  3609. {
  3610. num_rbots = (num_rbots + 1);
  3611. }
  3612. else
  3613. {
  3614. if ((p.team == TEAM_COLOR2))
  3615. {
  3616. num_bbots = (num_bbots + 1);
  3617. }
  3618. }
  3619. if (broadcst)
  3620. {
  3621. BPrintFrags (p);
  3622. }
  3623. else
  3624. {
  3625. PrintFrags (p);
  3626. }
  3627. p = find (p, classname, "bot");
  3628. }
  3629. };
  3630.  
  3631. void (float fteam) RemoveBestBot =
  3632. {
  3633. local entity best_bot;
  3634. local entity bot;
  3635. local float best_num;
  3636. local string st;
  3637. local entity old_self;
  3638. local entity check;
  3639.  
  3640.  
  3641. best_num = 99999997952;
  3642. best_bot = world;
  3643. bot = find (world, classname, "bot");
  3644. while ((bot != world))
  3645. {
  3646. if (((bot.frags < best_num) && (bot.team == fteam)))
  3647. {
  3648. best_bot = bot;
  3649. best_num = bot.frags;
  3650. }
  3651. bot = find (bot, classname, "bot");
  3652. }
  3653. if ((best_bot != world))
  3654. {
  3655. bprint (best_bot.netname);
  3656. bprint (" [skill ");
  3657. st = ftos (best_bot.bot_skill);
  3658. bprint (st);
  3659. bprint ("] has been removed\n");
  3660. old_self = self;
  3661. self = best_bot;
  3662. self.skin = 0;
  3663. set_suicide_frame ();
  3664. clientSetFree (self.fClientNo);
  3665. dropclient(self);
  3666. ClientDisconnect ();
  3667. self = old_self;
  3668. //remove (best_bot);
  3669. check = find (world, classname, "bot");
  3670. if (!check)
  3671. {
  3672. waypoint_idle = 300;
  3673. Waypoint_Toggle ();
  3674. }
  3675. }
  3676. };
  3677.  
  3678. void () InitCPU =
  3679. {
  3680. local float cur_bot_cpu;
  3681.  
  3682. cur_bot_cpu = 0.9; 
  3683. large_pulse_dist_base = 1000;
  3684. awareness_dist_base = 300;
  3685. item_large_pulse_dist_base = 400;
  3686. item_awareness_dist_base = 300;
  3687. large_pulse_dist = (large_pulse_dist_base * cur_bot_cpu);
  3688. awareness_dist = (awareness_dist_base * cur_bot_cpu);
  3689. item_large_pulse_dist = (item_large_pulse_dist_base * cur_bot_cpu);
  3690. item_awareness_dist = (item_awareness_dist_base * cur_bot_cpu);
  3691. };
  3692.  
  3693. void (float fteam) StartNewPath =
  3694. {
  3695. if ((fteam == TEAM_COLOR1))
  3696. {
  3697. dprint ("Staring new ÒÅÄ path\n");
  3698. current_red_waypoint = action;
  3699. }
  3700. else
  3701. {
  3702. if ((fteam == TEAM_COLOR2))
  3703. {
  3704. dprint ("Staring new ÂÌÕÅ path\n");
  3705. current_blue_waypoint = action;
  3706. }
  3707. else
  3708. {
  3709. error ("Bogus team\n");
  3710. }
  3711. }
  3712. sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
  3713. dprint ("Remember to use -condebug option!\n");
  3714. spawning_waypoints = TRUE;
  3715. spawning_general_waypoints = FALSE;
  3716. };
  3717.  
  3718. void () StartNewGeneralPath =
  3719. {
  3720. dprint ("Staring new general path\n");
  3721. current_waypoint = action;
  3722. sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
  3723. dprint ("Remember to use -condebug option!\n");
  3724. spawning_waypoints = TRUE;
  3725. spawning_general_waypoints = TRUE;
  3726. };
  3727.  
  3728. void (float make_visible) SetWaypointsVisible =
  3729. {
  3730. local entity e;
  3731.  
  3732. e = find (world, classname, "waypoint");
  3733. while ((e != world))
  3734. {
  3735. if (make_visible)
  3736. {
  3737. setmodel (e, "progs/s_bubble.spr");
  3738. }
  3739. else
  3740. {
  3741. setmodel (e, string_null);
  3742. }
  3743. e = find (e, classname, "waypoint");
  3744. }
  3745. };
  3746.  
  3747. void () PrintCloseWaypoint =
  3748. {
  3749. local entity e;
  3750.  
  3751. if ((spawning_waypoints || bot_debug))
  3752. {
  3753. e = find (world, classname, "waypoint");
  3754. while ((e != world))
  3755. {
  3756. if ((vlen ((self.origin - e.origin)) < TEAM_CAPTURE_FLAG_RETURN_TIME))
  3757. {
  3758. if ((e.team == TEAM_COLOR1))
  3759. {
  3760. dprint ("ÒÅÄ");
  3761. }
  3762. else
  3763. {
  3764. if ((e.team == TEAM_COLOR2))
  3765. {
  3766. dprint ("ÂÌÕÅ");
  3767. }
  3768. else
  3769. {
  3770. if ((e.team == -1))
  3771. {
  3772. dprint ("general");
  3773. }
  3774. else
  3775. {
  3776. error ("Bogus team\n");
  3777. }
  3778. }
  3779. }
  3780. if ((e.waypoint_num == -1))
  3781. {
  3782. dprint ("Defensive waypoint\n");
  3783. }
  3784. else
  3785. {
  3786. dprint (" waypoint number ");
  3787. dprintfloat (e.waypoint_num);
  3788. dprint ("\n");
  3789. }
  3790. }
  3791. e = find (e, classname, "waypoint");
  3792. }
  3793. e = find (world, classname, "inaccessible_from_here");
  3794. while ((e != world))
  3795. {
  3796. e = find (e, classname, "inaccessible_from_here");
  3797. }
  3798. }
  3799. };
  3800.  
  3801. void () PrintWaypoints =
  3802. {
  3803. local entity e;
  3804.  
  3805. dprint ("============\n");
  3806. dprint ("============\n");
  3807. dprint ("waypoints for ");
  3808. dprint (mapname);
  3809. dprint ("\n\n");
  3810. dprint ("============\n");
  3811. dprint ("============\n");
  3812. dprint ("   else if (mname == ");
  3813. dprint ("\"");
  3814. dprint (mapname);
  3815. dprint ("\")\n  {\n     // CTF Bot 1.3 waypoints by ");
  3816. dprint (self.netname);
  3817. dprint ("\n\n");
  3818. e = find (world, classname, "waypoint");
  3819. while ((e != world))
  3820. {
  3821. dprint ("       SpawnWaypointNum('");
  3822. dprintfloat (e.origin_x);
  3823. dprint (" ");
  3824. dprintfloat (e.origin_y);
  3825. dprint (" ");
  3826. dprintfloat (e.origin_z);
  3827. dprint ("', ");
  3828. dprintfloat (e.team);
  3829. dprint (", ");
  3830. dprintfloat (e.waypoint_num);
  3831. dprint (", us);\n");
  3832. e = find (e, classname, "waypoint");
  3833. }
  3834. dprint ("       return TRUE;\n  }\n\n");
  3835. dprint ("============\n");
  3836. dprint ("============\n");
  3837. sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
  3838. dprint ("no longer spawning waypoints\n");
  3839. spawning_waypoints = FALSE;
  3840. };
  3841.  
  3842. void () OrderCamping =
  3843. {
  3844. local entity head;
  3845. local entity selected;
  3846. local entity e;
  3847. local entity oldself;
  3848. local float dist;
  3849.  
  3850. if ((self.classname != "player"))
  3851. {
  3852. return;
  3853. }
  3854. head = findradius (self.origin, 600);
  3855. dist = 999999;
  3856. while (head)
  3857. {
  3858. if ((head.classname == "bot"))
  3859. {
  3860. if ((head.team == self.team))
  3861. {
  3862. if (BotCanSeeItem (head))
  3863. {
  3864. if ((vlen ((head.origin - self.origin)) < dist))
  3865. {
  3866. selected = head;
  3867. dist = vlen ((head.origin - self.origin));
  3868. }
  3869. }
  3870. }
  3871. }
  3872. head = head.chain;
  3873. }
  3874. if ((selected != world))
  3875. {
  3876. if (selected.camping_entity)
  3877. {
  3878. remove (selected.camping_entity);
  3879. selected.camping_entity = world;
  3880. }
  3881. e = spawn ();
  3882. e.classname = "waypoint";
  3883. e.origin = (self.origin + '0 0 16');
  3884. setorigin (e, e.origin);
  3885. e.solid = SOLID_NOT;
  3886. e.movetype = MOVETYPE_NONE;
  3887. setmodel (e, string_null);
  3888. setsize (e, VEC_ORIGIN, VEC_ORIGIN);
  3889. e.nextthink = ((time + CAMPING_TIME) + 1);
  3890. e.think = SUB_Remove;
  3891. selected.camping_entity = e;
  3892. oldself = self;
  3893. self = selected;
  3894. BotSayTeamStart2 ();
  3895. if ((time < (self.escort_time + ESCORT_TIME)))
  3896. {
  3897. BotSayTeamMiddle ("I'll stop escorting ");
  3898. if ((self.escort_entity == oldself))
  3899. {
  3900. BotSayTeamMiddle ("you");
  3901. }
  3902. else
  3903. {
  3904. BotSayTeamMiddle (self.escort_entity.netname);
  3905. }
  3906. BotSayTeamMiddle (" and camp here, ");
  3907. self.escort_time = (time - 999);
  3908. self.escort_entity = world;
  3909. }
  3910. else
  3911. {
  3912. BotSayTeamMiddle ("I'll camp here, ");
  3913. }
  3914. BotSayTeamMiddle (oldself.netname);
  3915. BotSayTeamEnd ();
  3916. self = oldself;
  3917. selected.camping_spot = e.origin;
  3918. selected.camping_time = time;
  3919. }
  3920. else
  3921. {
  3922. sprint (self, "No bot nearby\n");
  3923. }
  3924. };
  3925.  
  3926. void () OrderEscort =
  3927. {
  3928. local entity head;
  3929. local entity selected;
  3930. local entity e;
  3931. local entity oldself;
  3932. local float dist;
  3933.  
  3934. if ((self.classname != "player"))
  3935. {
  3936. return;
  3937. }
  3938. head = findradius (self.origin, 600);
  3939. dist = 999999;
  3940. while (head)
  3941. {
  3942. if ((head.classname == "bot"))
  3943. {
  3944. if ((head.team == self.team))
  3945. {
  3946. if (BotCanSeeItem (head))
  3947. {
  3948. if ((vlen ((head.origin - self.origin)) < dist))
  3949. {
  3950. selected = head;
  3951. dist = vlen ((head.origin - self.origin));
  3952. }
  3953. }
  3954. }
  3955. }
  3956. head = head.chain;
  3957. }
  3958. if ((selected != world))
  3959. {
  3960. selected.escort_entity = self;
  3961. selected.escort_time = time;
  3962. oldself = self;
  3963. self = selected;
  3964. BotSayTeamStart2 ();
  3965. if ((time < (self.camping_time + CAMPING_TIME)))
  3966. {
  3967. BotSayTeamMiddle ("I'll stop camping and escort you, ");
  3968. self.camping_time = (time - 999);
  3969. if ((self.camping_entity != world))
  3970. {
  3971. remove (self.camping_entity);
  3972. self.camping_entity = world;
  3973. }
  3974. }
  3975. else
  3976. {
  3977. BotSayTeamMiddle ("I'll escort you, ");
  3978. }
  3979. BotSayTeamMiddle (oldself.netname);
  3980. BotSayTeamEnd ();
  3981. self = oldself;
  3982. }
  3983. else
  3984. {
  3985. sprint (self, "No bot nearby\n");
  3986. }
  3987. };
  3988.  
  3989. void () OrderDropStuff =
  3990. {
  3991. local entity head;
  3992. local entity selected;
  3993. local entity e;
  3994. local entity oldself;
  3995. local entity item;
  3996. local float dist;
  3997. local float oldweapon;
  3998.  
  3999. if ((self.classname != "player"))
  4000. {
  4001. return;
  4002. }
  4003. head = findradius (self.origin, 600);
  4004. dist = 999999;
  4005. while (head)
  4006. {
  4007. if ((head.classname == "bot"))
  4008. {
  4009. if ((head.team == self.team))
  4010. {
  4011. if (BotCanSeeItem (head))
  4012. {
  4013. if (((!(teamplay & TEAM_NO_RUNE_DROP) && (head.player_flag & ITEM_RUNE_MASK)) && !(self.player_flag & ITEM_RUNE_MASK)))
  4014. {
  4015. oldself = self;
  4016. self = head;
  4017. BotSayTeamStart2 ();
  4018. BotSayTeamMiddle ("I dropped ");
  4019. if ((head.player_flag & ITEM_RUNE1_FLAG))
  4020. {
  4021. BotSayTeamMiddle ("Resistance");
  4022. }
  4023. else
  4024. {
  4025. if ((head.player_flag & ITEM_RUNE2_FLAG))
  4026. {
  4027. BotSayTeamMiddle ("Strength");
  4028. }
  4029. else
  4030. {
  4031. if ((head.player_flag & ITEM_RUNE3_FLAG))
  4032. {
  4033. BotSayTeamMiddle ("Haste");
  4034. }
  4035. else
  4036. {
  4037. if ((head.player_flag & ITEM_RUNE4_FLAG))
  4038. {
  4039. BotSayTeamMiddle ("Regeneration");
  4040. }
  4041. }
  4042. }
  4043. }
  4044. BotSayTeamEnd ();
  4045. item = PlayerDropRune ();
  4046. if ((item != world))
  4047. {
  4048. item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
  4049. item.bot_ignore_team = self.team;
  4050. }
  4051. self = oldself;
  4052. return;
  4053. }
  4054. }
  4055. }
  4056. }
  4057. head = head.chain;
  4058. }
  4059. head = findradius (self.origin, 600);
  4060. dist = 999999;
  4061. while (head)
  4062. {
  4063. if ((head.classname == "bot"))
  4064. {
  4065. if ((head.team == self.team))
  4066. {
  4067. if (BotCanSeeItem (head))
  4068. {
  4069. if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_LIGHTNING)) && (head.ammo_cells > action)) && !(self.items & IT_LIGHTNING)))
  4070. {
  4071. oldself = self;
  4072. self = head;
  4073. BotSayTeamStart2 ();
  4074. BotSayTeamMiddle ("I dropped lightning gun");
  4075. BotSayTeamEnd ();
  4076. oldweapon = self.weapon;
  4077. self.weapon = IT_LIGHTNING;
  4078. if ((temp1 & TEMP1_MULTI))
  4079. {
  4080. set_player_weapon ();
  4081. }
  4082. item = TossWeaponBackpack (IT_LIGHTNING, oldself);
  4083. if ((item != world))
  4084. {
  4085. item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
  4086. item.bot_ignore_team = self.team;
  4087. }
  4088. self.weapon = oldweapon;
  4089. if ((temp1 & TEMP1_MULTI))
  4090. {
  4091. set_player_weapon ();
  4092. }
  4093. self = oldself;
  4094. return;
  4095. }
  4096. }
  4097. }
  4098. }
  4099. head = head.chain;
  4100. }
  4101. head = findradius (self.origin, 600);
  4102. dist = 999999;
  4103. while (head)
  4104. {
  4105. if ((head.classname == "bot"))
  4106. {
  4107. if ((head.team == self.team))
  4108. {
  4109. if (BotCanSeeItem (head))
  4110. {
  4111. if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_ROCKET_LAUNCHER)) && (head.ammo_rockets > action)) && !(self.items & IT_ROCKET_LAUNCHER)))
  4112. {
  4113. oldself = self;
  4114. self = head;
  4115. BotSayTeamStart2 ();
  4116. BotSayTeamMiddle ("I dropped rocket launcher");
  4117. BotSayTeamEnd ();
  4118. oldweapon = self.weapon;
  4119. self.weapon = IT_ROCKET_LAUNCHER;
  4120. if ((temp1 & TEMP1_MULTI))
  4121. {
  4122. set_player_weapon ();
  4123. }
  4124. item = TossWeaponBackpack (IT_ROCKET_LAUNCHER, oldself);
  4125. if ((item != world))
  4126. {
  4127. item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
  4128. item.bot_ignore_team = self.team;
  4129. }
  4130. self.weapon = oldweapon;
  4131. if ((temp1 & TEMP1_MULTI))
  4132. {
  4133. set_player_weapon ();
  4134. }
  4135. self = oldself;
  4136. return;
  4137. }
  4138. }
  4139. }
  4140. }
  4141. head = head.chain;
  4142. }
  4143. head = findradius (self.origin, 600);
  4144. dist = 999999;
  4145. while (head)
  4146. {
  4147. if ((head.classname == "bot"))
  4148. {
  4149. if ((head.team == self.team))
  4150. {
  4151. if (BotCanSeeItem (head))
  4152. {
  4153. if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_GRENADE_LAUNCHER)) && (head.ammo_rockets > action)) && !(self.items & IT_GRENADE_LAUNCHER)))
  4154. {
  4155. oldself = self;
  4156. self = head;
  4157. BotSayTeamStart2 ();
  4158. BotSayTeamMiddle ("I dropped grenade launcher");
  4159. BotSayTeamEnd ();
  4160. oldweapon = self.weapon;
  4161. self.weapon = IT_GRENADE_LAUNCHER;
  4162. if ((temp1 & TEMP1_MULTI))
  4163. {
  4164. set_player_weapon ();
  4165. }
  4166. item = TossWeaponBackpack (IT_GRENADE_LAUNCHER, oldself);
  4167. if ((item != world))
  4168. {
  4169. item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
  4170. item.bot_ignore_team = self.team;
  4171. }
  4172. self.weapon = oldweapon;
  4173. if ((temp1 & TEMP1_MULTI))
  4174. {
  4175. set_player_weapon ();
  4176. }
  4177. self = oldself;
  4178. return;
  4179. }
  4180. }
  4181. }
  4182. }
  4183. head = head.chain;
  4184. }
  4185. head = findradius (self.origin, 600);
  4186. dist = 999999;
  4187. while (head)
  4188. {
  4189. if ((head.classname == "bot"))
  4190. {
  4191. if ((head.team == self.team))
  4192. {
  4193. if (BotCanSeeItem (head))
  4194. {
  4195. if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_SUPER_NAILGUN)) && (head.ammo_nails > action)) && !(self.items & IT_SUPER_NAILGUN)))
  4196. {
  4197. oldself = self;
  4198. self = head;
  4199. BotSayTeamStart2 ();
  4200. BotSayTeamMiddle ("I dropped super nailgun");
  4201. BotSayTeamEnd ();
  4202. oldweapon = self.weapon;
  4203. self.weapon = IT_SUPER_NAILGUN;
  4204. if ((temp1 & TEMP1_MULTI))
  4205. {
  4206. set_player_weapon ();
  4207. }
  4208. item = TossWeaponBackpack (IT_SUPER_NAILGUN, oldself);
  4209. if ((item != world))
  4210. {
  4211. item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
  4212. item.bot_ignore_team = self.team;
  4213. }
  4214. self.weapon = oldweapon;
  4215. if ((temp1 & TEMP1_MULTI))
  4216. {
  4217. set_player_weapon ();
  4218. }
  4219. self = oldself;
  4220. return;
  4221. }
  4222. }
  4223. }
  4224. }
  4225. head = head.chain;
  4226. }
  4227. sprint (self, "Nothing to drop\n");
  4228. };
  4229.  
  4230. void () PrintWaypointList =
  4231. {
  4232. local entity p;
  4233. local float nm;
  4234. local float nm2;
  4235.  
  4236. nm = action;
  4237. dprint ("----\n");
  4238. dprint ("red\n");
  4239. p = wp_first_red;
  4240. while ((p != world))
  4241. {
  4242. nm = (nm + 1);
  4243. dprint ("waypoint ");
  4244. dprintfloat (p.team);
  4245. dprint (" ");
  4246. dprintfloat (p.waypoint_num);
  4247. dprint ("\n");
  4248. if ((p.wp_chain == world))
  4249. {
  4250. if ((p == wp_last_red))
  4251. {
  4252. dprint ("list terminated correctly\n");
  4253. }
  4254. else
  4255. {
  4256. dprint ("list terminated INCORRECTLY\n");
  4257. }
  4258. }
  4259. p = p.wp_chain;
  4260. }
  4261. dprint ("----\n");
  4262. dprint ("blue\n");
  4263. p = wp_first_blue;
  4264. while ((p != world))
  4265. {
  4266. nm = (nm + 1);
  4267. dprint ("waypoint ");
  4268. dprintfloat (p.team);
  4269. dprint (" ");
  4270. dprintfloat (p.waypoint_num);
  4271. dprint ("\n");
  4272. if ((p.wp_chain == world))
  4273. {
  4274. if ((p == wp_last_blue))
  4275. {
  4276. dprint ("list terminated correctly\n");
  4277. }
  4278. else
  4279. {
  4280. dprint ("list terminated INCORRECTLY\n");
  4281. }
  4282. }
  4283. p = p.wp_chain;
  4284. }
  4285. dprint ("----\n");
  4286. dprint ("general\n");
  4287. p = wp_first_general;
  4288. while ((p != world))
  4289. {
  4290. nm = (nm + 1);
  4291. dprint ("waypoint ");
  4292. dprintfloat (p.team);
  4293. dprint (" ");
  4294. dprintfloat (p.waypoint_num);
  4295. dprint ("\n");
  4296. if ((p.wp_chain == world))
  4297. {
  4298. if ((p == wp_last_general))
  4299. {
  4300. dprint ("list terminated correctly\n");
  4301. }
  4302. else
  4303. {
  4304. dprint ("list terminated INCORRECTLY\n");
  4305. }
  4306. }
  4307. p = p.wp_chain;
  4308. }
  4309. dprint ("----\n");
  4310. dprintfloat (nm);
  4311. dprint (" linked waypoints\n");
  4312. nm2 = action;
  4313. p = find (world, classname, "waypoint");
  4314. while ((p != world))
  4315. {
  4316. nm2 = (nm2 + 1);
  4317. p = find (p, classname, "waypoint");
  4318. }
  4319. dprintfloat (nm2);
  4320. dprint (" waypoints\n");
  4321. if ((nm != nm2))
  4322. {
  4323. dprint ("ERROR\n");
  4324. }
  4325. };
  4326.  
  4327. void (entity wp) InsertWaypointLink =
  4328. {
  4329. if ((wp.team == TEAM_COLOR1))
  4330. {
  4331. if ((wp_first_red == world))
  4332. {
  4333. wp_first_red = wp;
  4334. wp_last_red = wp;
  4335. }
  4336. else
  4337. {
  4338. wp_last_red.wp_chain = wp;
  4339. wp_last_red = wp;
  4340. wp_last_red.wp_chain = world;
  4341. }
  4342. }
  4343. else
  4344. {
  4345. if ((wp.team == TEAM_COLOR2))
  4346. {
  4347. if ((wp_first_blue == world))
  4348. {
  4349. wp_first_blue = wp;
  4350. wp_last_blue = wp;
  4351. }
  4352. else
  4353. {
  4354. wp_last_blue.wp_chain = wp;
  4355. wp_last_blue = wp;
  4356. wp_last_blue.wp_chain = world;
  4357. }
  4358. }
  4359. else
  4360. {
  4361. if ((wp.team == -1))
  4362. {
  4363. if ((wp_first_general == world))
  4364. {
  4365. wp_first_general = wp;
  4366. wp_last_general = wp;
  4367. }
  4368. else
  4369. {
  4370. wp_last_general.wp_chain = wp;
  4371. wp_last_general = wp;
  4372. wp_last_general.wp_chain = world;
  4373. }
  4374. }
  4375. }
  4376. }
  4377. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement