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 =
153 string () PickARandomName =
164 test = ceil(random() * 16);
166 t = find(world, netname, h);
175 // I didn't like the old code so this is very stripped down
184 3 - team message "friendly eyes"
185 4 - team message "on your back"
186 5 - team message "need back up"
191 8 - welcoming someone onto server
192 9 - ridicule lost frag (killed self?)
193 10 - ridicule lost frag (lava)
199 void(float tpic) bot_start_topic =
213 if (b_options & OPT_NOCHAT)
215 r = ceil (random() * 6);
217 if (self.b_chattime > time)
219 if (self.b_skill < 2)
220 self.keys = self.button0 = self.button2 = 0;
223 else if (self.b_chattime)
227 if (b_originator == self)
231 BotSay(": lo all\n");
236 BotSay(": hey everyone\n");
241 BotSay(": prepare to be fragged!\n");
246 BotSay(": boy this is laggy\n");
251 BotSay(": #mm getting some lag here\n");
256 BotSay(": hi everyone\n");
261 else if (b_topic == 2)
263 if (b_originator == self)
266 BotSay(": take that\n");
268 BotSay(": yehaww!\n");
272 BotSay(": j00_sawk();\n");
274 BotSay(": i rule\n");
276 BotSay(": eat that\n");
280 else if (b_topic == 3)
282 if (b_originator == self)
285 BotSayTeam(": friendly eyes\n");
287 BotSayTeam(": team eyes\n");
291 else if (b_topic == 4)
293 if (b_originator == self)
296 BotSayTeam(": on your back\n");
298 BotSayTeam(": I'm with you\n");
302 else if (b_topic == 5)
304 if (b_originator == self)
307 BotSayTeam(": I need help\n");
309 BotSayTeam(": need backup\n");
313 else if (b_topic == 6)
315 if (b_originator == self)
319 BotSay(": sun got in my eyes\n");
324 BotSay(": mouse needs cleaning\n");
329 BotSay(": i meant to do that\n");
339 BotSay(": killer lag\n");
344 BotSay(": 100% lag\n");
349 else if (b_topic == 7)
354 BotSay(": gg all\n");
356 BotSay(": that was fun\n");
358 BotSay(": good game\n");
365 else if (b_topic == 8)
367 if (b_originator != self)
376 BotSay(": welcome\n");
383 BotSay2(b_originator.netname);
391 BotSay2(b_originator.netname);
408 else if (b_topic == 9)
410 if (b_originator != self)
419 BotSay2(": good work ");
420 BotSay2(b_originator.netname);
427 BotSay2(b_originator.netname);
437 else if (b_topic == 10)
439 if (b_originator != self)
442 BotSay(": have a nice dip?\n");
444 BotSay(": bah I hate levels with lava\n");
448 BotSay2(": good job ");
449 BotSay2(b_originator.netname);
455 BotSay2(": nice backflip ");
456 BotSay2(b_originator.netname);
460 BotSay(": watch your step\n");
467 else if (b_topic == 11)
469 if (b_originator != self)
474 BotSay2(": yeah right ");
475 BotSay2(b_originator.netname);
486 BotSay(": shuddup, you're an lpb\n");
491 BotSay(": lag my eye\n");
501 BotSay(": totally\n");
512 if (self == b_originator)
515 self.b_chattime = time + 2;
520 self.b_chattime = time + 2;
527 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
531 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
537 ty = find(world, classname, "player");
548 ty = find(ty, classname, "player");
555 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
557 Simplified origin checking.
559 God, I wish I had inline
561 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
564 vector(entity ent) realorigin =
566 // even more simplified...
567 return (ent.absmin + ent.absmax) * 0.5;
571 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
575 a version of visible that checks for corners
576 of the bounding boxes
578 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
581 float (entity targ) fisible =
583 local vector spot1, org;
584 local float thruwater, pc1, pc2;
586 org = realorigin(targ);
587 spot1 = self.origin + self.view_ofs;
589 if (targ.solid == SOLID_BSP)
591 traceline (spot1, org, TRUE, self);
592 if (trace_ent == targ)
594 else if (trace_fraction == 1)
600 pc1 = pointcontents(org);
601 pc2 = pointcontents(spot1);
602 if (targ.classname == "player")
604 else if (pc1 == CONTENT_LAVA)
610 if (pc1 < -1) // targ's origin is in water or other liquid
614 // look for their head
615 traceline (spot1, org + targ.mins, TRUE, self);
616 // cross the water check
621 if (trace_ent == targ)
623 else if (trace_fraction == 1)
632 traceline (spot1, org + targ.maxs, TRUE, self);
637 if (trace_ent == targ)
639 else if (trace_fraction == 1)
644 traceline (spot1, org, TRUE, self);
645 if (trace_ent == targ)
647 else if (trace_fraction == 1)
649 traceline (spot1, org + targ.maxs, TRUE, self);
650 if (trace_ent == targ)
652 else if (trace_fraction == 1)
654 traceline (spot1, org + targ.mins, TRUE, self);
655 if (trace_ent == targ)
657 else if (trace_fraction == 1)
664 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
668 goes through movable brushes/entities, used
671 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
674 // this is used for waypoint stuff....
675 float (entity targ1, entity targ2) wisible =
677 local vector spot1, spot2;
680 spot1 = targ1.origin;
681 spot2 = realorigin(targ2);
686 traceline (spot1, spot2, TRUE, ignore);
687 spot1 = realorigin(trace_ent);
689 } while ((trace_ent != world) && (trace_fraction != 1));
690 if (trace_endpos == spot2)
698 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
702 Now this is getting ridiculous. Simple visible,
703 used when we need just a simple traceline nothing else
705 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
708 float (entity targ) sisible =
710 traceline (self.origin, targ.origin, TRUE, self);
711 if (trace_ent == targ)
713 else if (trace_fraction == 1)
717 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
721 subtracts one angle from another
723 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
726 float (float y1, float y2) angcomp =
728 y1 = frik_anglemod(y1);
729 y2 = frik_anglemod(y2);
734 answer = (360 - answer) * -1;
735 else if (answer < -180)
736 answer = answer + 360;
741 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
745 is the entity in the bot's field of view
747 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
749 float (entity targ) fov =
753 yawn = realorigin(targ);
754 yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
755 yawn = normalize(yawn);
756 yawn = vectoangles(yawn);
757 g = angcomp(self.v_angle_x, yawn_x);
760 g = angcomp(self.v_angle_y, yawn_y);
768 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
772 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
774 float(float v) frik_anglemod =
776 return v - floor(v/360) * 360;