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 =
274 // if (b_options & OPT_NOCHAT)
276 r = ceil (random() * 6);
278 if (self.b_chattime > time)
280 if (self.b_skill < 2)
281 self.keys = self.button0 = self.button2 = 0;
284 else if (self.b_chattime)
288 if (b_originator == self)
292 BotSay(": lo all\n");
297 BotSay(": hey everyone\n");
302 BotSay(": prepare to be fragged!\n");
307 BotSay(": boy this is laggy\n");
312 BotSay(": #mm getting some lag here\n");
317 BotSay(": hi everyone\n");
322 else if (b_topic == 2)
324 if (b_originator == self)
327 BotSay(": take that\n");
329 BotSay(": yehaww!\n");
333 BotSay(": j00_sawk();\n");
335 BotSay(": i rule\n");
337 BotSay(": eat that\n");
341 else if (b_topic == 3)
343 if (b_originator == self)
346 BotSayTeam(": friendly eyes\n");
348 BotSayTeam(": team eyes\n");
352 else if (b_topic == 4)
354 if (b_originator == self)
357 BotSayTeam(": on your back\n");
359 BotSayTeam(": I'm with you\n");
363 else if (b_topic == 5)
365 if (b_originator == self)
368 BotSayTeam(": I need help\n");
370 BotSayTeam(": need backup\n");
374 else if (b_topic == 6)
376 if (b_originator == self)
380 BotSay(": sun got in my eyes\n");
385 BotSay(": mouse needs cleaning\n");
390 BotSay(": i meant to do that\n");
400 BotSay(": killer lag\n");
405 BotSay(": 100% lag\n");
410 else if (b_topic == 7)
415 BotSay(": gg all\n");
417 BotSay(": that was fun\n");
419 BotSay(": good game\n");
426 else if (b_topic == 8)
428 if (b_originator != self)
437 BotSay(": welcome\n");
444 BotSay2(b_originator.netname);
452 BotSay2(b_originator.netname);
469 else if (b_topic == 9)
471 if (b_originator != self)
480 BotSay2(": good work ");
481 BotSay2(b_originator.netname);
488 BotSay2(b_originator.netname);
498 else if (b_topic == 10)
500 if (b_originator != self)
503 BotSay(": have a nice dip?\n");
505 BotSay(": bah I hate levels with lava\n");
509 BotSay2(": good job ");
510 BotSay2(b_originator.netname);
516 BotSay2(": nice backflip ");
517 BotSay2(b_originator.netname);
521 BotSay(": watch your step\n");
528 else if (b_topic == 11)
530 if (b_originator != self)
535 BotSay2(": yeah right ");
536 BotSay2(b_originator.netname);
547 BotSay(": shuddup, you're an lpb\n");
552 BotSay(": lag my eye\n");
562 BotSay(": totally\n");
573 if (self == b_originator)
576 self.b_chattime = time + 2;
581 self.b_chattime = time + 2;
588 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
592 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
598 ty = find(world, classname, "player");
609 ty = find(ty, classname, "player");
616 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
618 Simplified origin checking.
620 God, I wish I had inline
622 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
625 vector(entity ent) realorigin =
627 // even more simplified...
628 return (ent.absmin + ent.absmax) * 0.5;
632 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
636 a version of visible that checks for corners
637 of the bounding boxes
639 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
642 float (entity targ) fisible =
644 local vector spot1, org;
645 local float thruwater, pc1, pc2;
647 org = realorigin(targ);
648 spot1 = self.origin + self.view_ofs;
650 if (targ.solid == SOLID_BSP)
652 traceline (spot1, org, TRUE, self);
653 if (trace_ent == targ)
655 else if (trace_fraction == 1)
661 pc1 = pointcontents(org);
662 pc2 = pointcontents(spot1);
663 if (targ.classname == "player")
665 else if (pc1 == CONTENT_LAVA)
671 if (pc1 < -1) // targ's origin is in water or other liquid
675 // look for their head
676 traceline (spot1, org + targ.mins, TRUE, self);
677 // cross the water check
682 if (trace_ent == targ)
684 else if (trace_fraction == 1)
693 traceline (spot1, org + targ.maxs, TRUE, self);
698 if (trace_ent == targ)
700 else if (trace_fraction == 1)
705 traceline (spot1, org, TRUE, self);
706 if (trace_ent == targ)
708 else if (trace_fraction == 1)
710 traceline (spot1, org + targ.maxs, TRUE, self);
711 if (trace_ent == targ)
713 else if (trace_fraction == 1)
715 traceline (spot1, org + targ.mins, TRUE, self);
716 if (trace_ent == targ)
718 else if (trace_fraction == 1)
725 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
729 goes through movable brushes/entities, used
732 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
735 // this is used for waypoint stuff....
736 float (entity targ1, entity targ2) wisible =
738 local vector spot1, spot2;
741 spot1 = targ1.origin;
742 spot2 = realorigin(targ2);
747 traceline (spot1, spot2, TRUE, ignore);
748 spot1 = realorigin(trace_ent);
750 } while ((trace_ent != world) && (trace_fraction != 1));
751 if (trace_endpos == spot2)
759 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
763 Now this is getting ridiculous. Simple visible,
764 used when we need just a simple traceline nothing else
766 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
769 float (entity targ) sisible =
771 traceline (self.origin, targ.origin, TRUE, self);
772 if (trace_ent == targ)
774 else if (trace_fraction == 1)
779 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
783 subtracts one angle from another
785 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
788 float (float y1, float y2) angcomp =
790 y1 = frik_anglemod(y1);
791 y2 = frik_anglemod(y2);
796 answer = (360 - answer) * -1;
797 else if (answer < -180)
798 answer = answer + 360;
803 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
807 is the entity in the bot's field of view
809 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
811 float (entity targ) fov =
815 yawn = realorigin(targ);
816 yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
817 yawn = normalize(yawn);
818 yawn = vectoangles(yawn);
819 g = angcomp(self.v_angle_x, yawn_x);
822 g = angcomp(self.v_angle_y, yawn_y);
830 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
834 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
836 float(float v) frik_anglemod =
838 return v - floor(v/360) * 360;