1 /***********************************************
4 * "Because you can't name it anything else" *
6 ***********************************************/
9 This program is in the Public Domain. My crack legal
10 team would like to add:
12 RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
13 AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
14 ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
15 FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
16 NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
17 GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
18 EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
19 SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
20 DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
22 You accept this software on the condition that you
23 indemnify and hold harmless Ryan "FrikaC" Smith from
24 any and all liability or damages to third parties,
25 including attorney fees, court costs, and other
26 related costs and expenses, arising out of your use
27 of this software irrespective of the cause of said
30 The export from the United States or the subsequent
31 reexport of this software is subject to compliance
32 with United States export control and munitions
33 control restrictions. You agree that in the event you
34 seek to export this software, you assume full
35 responsibility for obtaining all necessary export
36 licenses and approvals and for assuring compliance
37 with applicable reexport restrictions.
39 Any reproduction of this software must contain
40 this notice in its entirety.
45 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
49 Sets bot's name and colors
51 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
53 string(float r) BotName =
58 self.playermodel = "models/player/visitant.zym";
59 self.playerskin = "0";
64 self.playermodel = "models/player/marine.zym";
65 self.playerskin = "0";
70 self.playermodel = "models/player/specop.zym";
71 self.playerskin = "0";
76 self.playermodel = "models/player/nexus.zym";
77 self.playerskin = "0";
82 self.playermodel = "models/player/skadi.zym";
83 self.playerskin = "0";
88 self.playermodel = "models/player/lurk.zym";
89 self.playerskin = "0";
94 self.playermodel = "models/player/headhunter.zym";
95 self.playerskin = "0";
100 self.playermodel = "models/player/carni.zym";
101 self.playerskin = "0";
106 self.playermodel = "models/player/grunt.zym";
107 self.playerskin = "0";
112 self.playermodel = "models/player/insurrectionist.zym";
113 self.playerskin = "0";
114 return "Insurrectionist";
118 self.playermodel = "models/player/jeandarc.zym";
119 self.playerskin = "0";
124 self.playermodel = "models/player/lycanthrope.zym";
125 self.playerskin = "0";
126 return "Lycanthrope";
130 self.playermodel = "models/player/pyria.zym";
131 self.playerskin = "0";
136 self.playermodel = "models/player/shock.zym";
137 self.playerskin = "0";
142 self.playermodel = "models/player/marine.zym";
143 self.playerskin = "1";
148 self.playermodel = "models/player/nexus.zym";
149 self.playerskin = "1";
154 self.playermodel = "models/player/skadi.zym";
155 self.playerskin = "1";
160 self.playermodel = "models/player/lurk.zym";
161 self.playerskin = "1";
166 self.playermodel = "models/player/crash.zym";
167 self.playerskin = "2";
172 self.playermodel = "models/player/crash.zym";
173 self.playerskin = "1";
178 self.playermodel = "models/player/insurrectionist.zym";
179 self.playerskin = "1";
184 self.playermodel = "models/player/jeandarc.zym";
185 self.playerskin = "1";
190 self.playermodel = "models/player/lycanthrope.zym";
191 self.playerskin = "1";
196 self.playermodel = "models/player/pyria.zym";
197 self.playerskin = "1";
202 self.playermodel = "models/player/rebel.zym";
203 self.playerskin = "0";
208 self.playermodel = "models/player/crash.zym";
209 self.playerskin = "0";
214 string () PickARandomName =
225 test = ceil(random() * 16);
227 t = find(world, netname, h);
236 // I didn't like the old code so this is very stripped down
245 3 - team message "friendly eyes"
246 4 - team message "on your back"
247 5 - team message "need back up"
252 8 - welcoming someone onto server
253 9 - ridicule lost frag (killed self?)
254 10 - ridicule lost frag (lava)
260 void(float tpic) bot_start_topic =
275 if (b_options & OPT_NOCHAT)
277 r = ceil (random() * 6);
279 if (self.b_chattime > time)
281 if (self.b_skill < 2)
282 self.keys = self.button0 = self.button2 = 0;
285 else if (self.b_chattime)
289 if (b_originator == self)
293 BotSay(": lo all\n");
298 BotSay(": hey everyone\n");
303 BotSay(": prepare to be fragged!\n");
308 BotSay(": boy this is laggy\n");
313 BotSay(": #mm getting some lag here\n");
318 BotSay(": hi everyone\n");
323 else if (b_topic == 2)
325 if (b_originator == self)
328 BotSay(": take that\n");
330 BotSay(": yehaww!\n");
334 BotSay(": j00_sawk();\n");
336 BotSay(": i rule\n");
338 BotSay(": eat that\n");
342 else if (b_topic == 3)
344 if (b_originator == self)
347 BotSayTeam(": friendly eyes\n");
349 BotSayTeam(": team eyes\n");
353 else if (b_topic == 4)
355 if (b_originator == self)
358 BotSayTeam(": on your back\n");
360 BotSayTeam(": I'm with you\n");
364 else if (b_topic == 5)
366 if (b_originator == self)
369 BotSayTeam(": I need help\n");
371 BotSayTeam(": need backup\n");
375 else if (b_topic == 6)
377 if (b_originator == self)
381 BotSay(": sun got in my eyes\n");
386 BotSay(": mouse needs cleaning\n");
391 BotSay(": i meant to do that\n");
401 BotSay(": killer lag\n");
406 BotSay(": 100% lag\n");
411 else if (b_topic == 7)
416 BotSay(": gg all\n");
418 BotSay(": that was fun\n");
420 BotSay(": good game\n");
427 else if (b_topic == 8)
429 if (b_originator != self)
438 BotSay(": welcome\n");
445 BotSay2(b_originator.netname);
453 BotSay2(b_originator.netname);
470 else if (b_topic == 9)
472 if (b_originator != self)
481 BotSay2(": good work ");
482 BotSay2(b_originator.netname);
489 BotSay2(b_originator.netname);
499 else if (b_topic == 10)
501 if (b_originator != self)
504 BotSay(": have a nice dip?\n");
506 BotSay(": bah I hate levels with lava\n");
510 BotSay2(": good job ");
511 BotSay2(b_originator.netname);
517 BotSay2(": nice backflip ");
518 BotSay2(b_originator.netname);
522 BotSay(": watch your step\n");
529 else if (b_topic == 11)
531 if (b_originator != self)
536 BotSay2(": yeah right ");
537 BotSay2(b_originator.netname);
548 BotSay(": shuddup, you're an lpb\n");
553 BotSay(": lag my eye\n");
563 BotSay(": totally\n");
574 if (self == b_originator)
577 self.b_chattime = time + 2;
582 self.b_chattime = time + 2;
590 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
594 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
600 ty = find(world, classname, "player");
611 ty = find(ty, classname, "player");
618 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
620 Simplified origin checking.
622 God, I wish I had inline
624 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
627 vector(entity ent) realorigin =
629 // even more simplified...
630 return (ent.absmin + ent.absmax) * 0.5;
634 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
638 a version of visible that checks for corners
639 of the bounding boxes
641 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
644 float (entity targ) fisible =
646 local vector spot1, org;
647 local float thruwater, pc1, pc2;
649 org = realorigin(targ);
650 spot1 = self.origin + self.view_ofs;
652 if (targ.solid == SOLID_BSP)
654 traceline (spot1, org, TRUE, self);
655 if (trace_ent == targ)
657 else if (trace_fraction == 1)
663 pc1 = pointcontents(org);
664 pc2 = pointcontents(spot1);
665 if (targ.classname == "player")
667 else if (pc1 == CONTENT_LAVA)
673 if (pc1 < -1) // targ's origin is in water or other liquid
677 // look for their head
678 traceline (spot1, org + targ.mins, TRUE, self);
679 // cross the water check
684 if (trace_ent == targ)
686 else if (trace_fraction == 1)
695 traceline (spot1, org + targ.maxs, TRUE, self);
700 if (trace_ent == targ)
702 else if (trace_fraction == 1)
707 traceline (spot1, org, TRUE, self);
708 if (trace_ent == targ)
710 else if (trace_fraction == 1)
712 traceline (spot1, org + targ.maxs, TRUE, self);
713 if (trace_ent == targ)
715 else if (trace_fraction == 1)
717 traceline (spot1, org + targ.mins, TRUE, self);
718 if (trace_ent == targ)
720 else if (trace_fraction == 1)
727 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
731 goes through movable brushes/entities, used
734 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
737 // this is used for waypoint stuff....
738 float (entity targ1, entity targ2) wisible =
740 local vector spot1, spot2;
743 spot1 = targ1.origin;
744 spot2 = realorigin(targ2);
749 traceline (spot1, spot2, TRUE, ignore);
750 spot1 = realorigin(trace_ent);
752 } while ((trace_ent != world) && (trace_fraction != 1));
753 if (trace_endpos == spot2)
761 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
765 Now this is getting ridiculous. Simple visible,
766 used when we need just a simple traceline nothing else
768 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
771 float (entity targ) sisible =
773 traceline (self.origin, targ.origin, TRUE, self);
774 if (trace_ent == targ)
776 else if (trace_fraction == 1)
781 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
785 subtracts one angle from another
787 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
790 float (float y1, float y2) angcomp =
792 y1 = frik_anglemod(y1);
793 y2 = frik_anglemod(y2);
798 answer = (360 - answer) * -1;
799 else if (answer < -180)
800 answer = answer + 360;
805 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
809 is the entity in the bot's field of view
811 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
813 float (entity targ) fov =
817 yawn = realorigin(targ);
818 yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
819 yawn = normalize(yawn);
820 yawn = vectoangles(yawn);
821 g = angcomp(self.v_angle_x, yawn_x);
824 g = angcomp(self.v_angle_y, yawn_y);
832 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
836 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
838 float(float v) frik_anglemod =
840 return v - floor(v/360) * 360;