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";
63 self.playermodel = "models/player/marine.zym";
68 self.playermodel = "models/player/specop.zym";
73 self.playermodel = "models/player/mulder.zym";
78 self.playermodel = "models/player/fshock.zym";
83 self.playermodel = "models/player/lurk.zym";
88 self.playermodel = "models/player/headhunter.zym";
93 self.playermodel = "models/player/robot.zym";
98 string () PickARandomName =
109 test = ceil(random() * 16);
111 t = find(world, netname, h);
120 // I didn't like the old code so this is very stripped down
129 3 - team message "friendly eyes"
130 4 - team message "on your back"
131 5 - team message "need back up"
136 8 - welcoming someone onto server
137 9 - ridicule lost frag (killed self?)
138 10 - ridicule lost frag (lava)
144 void(float tpic) bot_start_topic =
158 if (b_options & OPT_NOCHAT)
160 r = ceil (random() * 6);
162 if (self.b_chattime > time)
164 if (self.b_skill < 2)
165 self.keys = self.button0 = self.button2 = 0;
168 else if (self.b_chattime)
172 if (b_originator == self)
176 BotSay(": lo all\n");
181 BotSay(": hey everyone\n");
186 BotSay(": prepare to be fragged!\n");
191 BotSay(": boy this is laggy\n");
196 BotSay(": #mm getting some lag here\n");
201 BotSay(": hi everyone\n");
206 else if (b_topic == 2)
208 if (b_originator == self)
211 BotSay(": take that\n");
213 BotSay(": yehaww!\n");
217 BotSay(": j00_sawk();\n");
219 BotSay(": i rule\n");
221 BotSay(": eat that\n");
225 else if (b_topic == 3)
227 if (b_originator == self)
230 BotSayTeam(": friendly eyes\n");
232 BotSayTeam(": team eyes\n");
236 else if (b_topic == 4)
238 if (b_originator == self)
241 BotSayTeam(": on your back\n");
243 BotSayTeam(": I'm with you\n");
247 else if (b_topic == 5)
249 if (b_originator == self)
252 BotSayTeam(": I need help\n");
254 BotSayTeam(": need backup\n");
258 else if (b_topic == 6)
260 if (b_originator == self)
264 BotSay(": sun got in my eyes\n");
269 BotSay(": mouse needs cleaning\n");
274 BotSay(": i meant to do that\n");
284 BotSay(": killer lag\n");
289 BotSay(": 100% lag\n");
294 else if (b_topic == 7)
299 BotSay(": gg all\n");
301 BotSay(": that was fun\n");
303 BotSay(": good game\n");
310 else if (b_topic == 8)
312 if (b_originator != self)
321 BotSay(": welcome\n");
328 BotSay2(b_originator.netname);
336 BotSay2(b_originator.netname);
353 else if (b_topic == 9)
355 if (b_originator != self)
364 BotSay2(": good work ");
365 BotSay2(b_originator.netname);
372 BotSay2(b_originator.netname);
382 else if (b_topic == 10)
384 if (b_originator != self)
387 BotSay(": have a nice dip?\n");
389 BotSay(": bah I hate levels with lava\n");
393 BotSay2(": good job ");
394 BotSay2(b_originator.netname);
400 BotSay2(": nice backflip ");
401 BotSay2(b_originator.netname);
405 BotSay(": watch your step\n");
412 else if (b_topic == 11)
414 if (b_originator != self)
419 BotSay2(": yeah right ");
420 BotSay2(b_originator.netname);
431 BotSay(": shuddup, you're an lpb\n");
436 BotSay(": lag my eye\n");
446 BotSay(": totally\n");
457 if (self == b_originator)
460 self.b_chattime = time + 2;
465 self.b_chattime = time + 2;
472 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
476 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
482 ty = find(world, classname, "player");
493 ty = find(ty, classname, "player");
500 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
502 Simplified origin checking.
504 God, I wish I had inline
506 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
509 vector(entity ent) realorigin =
511 // even more simplified...
512 return (ent.absmin + ent.absmax) * 0.5;
516 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
520 a version of visible that checks for corners
521 of the bounding boxes
523 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
526 float (entity targ) fisible =
528 local vector spot1, org;
529 local float thruwater, pc1, pc2;
531 org = realorigin(targ);
532 spot1 = self.origin + self.view_ofs;
534 if (targ.solid == SOLID_BSP)
536 traceline (spot1, org, TRUE, self);
537 if (trace_ent == targ)
539 else if (trace_fraction == 1)
545 pc1 = pointcontents(org);
546 pc2 = pointcontents(spot1);
547 if (targ.classname == "player")
549 else if (pc1 == CONTENT_LAVA)
555 if (pc1 < -1) // targ's origin is in water or other liquid
559 // look for their head
560 traceline (spot1, org + targ.mins, TRUE, self);
561 // cross the water check
566 if (trace_ent == targ)
568 else if (trace_fraction == 1)
577 traceline (spot1, org + targ.maxs, TRUE, self);
582 if (trace_ent == targ)
584 else if (trace_fraction == 1)
589 traceline (spot1, org, TRUE, self);
590 if (trace_ent == targ)
592 else if (trace_fraction == 1)
594 traceline (spot1, org + targ.maxs, TRUE, self);
595 if (trace_ent == targ)
597 else if (trace_fraction == 1)
599 traceline (spot1, org + targ.mins, TRUE, self);
600 if (trace_ent == targ)
602 else if (trace_fraction == 1)
609 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
613 goes through movable brushes/entities, used
616 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
619 // this is used for waypoint stuff....
620 float (entity targ1, entity targ2) wisible =
622 local vector spot1, spot2;
625 spot1 = targ1.origin;
626 spot2 = realorigin(targ2);
631 traceline (spot1, spot2, TRUE, ignore);
632 spot1 = realorigin(trace_ent);
634 } while ((trace_ent != world) && (trace_fraction != 1));
635 if (trace_endpos == spot2)
643 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
647 Now this is getting ridiculous. Simple visible,
648 used when we need just a simple traceline nothing else
650 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
653 float (entity targ) sisible =
655 traceline (self.origin, targ.origin, TRUE, self);
656 if (trace_ent == targ)
658 else if (trace_fraction == 1)
663 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
667 subtracts one angle from another
669 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
672 float (float y1, float y2) angcomp =
674 y1 = frik_anglemod(y1);
675 y2 = frik_anglemod(y2);
680 answer = (360 - answer) * -1;
681 else if (answer < -180)
682 answer = answer + 360;
687 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
691 is the entity in the bot's field of view
693 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
695 float (entity targ) fov =
699 yawn = realorigin(targ);
700 yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
701 yawn = normalize(yawn);
702 yawn = vectoangles(yawn);
703 g = angcomp(self.v_angle_x, yawn_x);
706 g = angcomp(self.v_angle_y, yawn_y);
714 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
718 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
720 float(float v) frik_anglemod =
722 return v - floor(v/360) * 360;