// Default ET Bot Profile // Default ET Bot Profile print( "Sample Default Bot Profile" ); // Load some scripts we might use. // FieldOfView is the angle(in degrees) that the bot can 'see' in front of them. //this.FieldOfView = 90.0; // ReactionTime is the time delay(in seconds) from when a bot first see's a target, to when // the bot will begin to react and target them. this.ReactionTime = 0.0; // MemorySpan is how long it takes(in seconds) for a bot to consider his memory of someone or something // 'out of date' and not considered for targeting and such this.MemorySpan = 2.0; // AimPersistance is how long the bot will aim in the direction of a target after the target has gone out of view. // This is useful for keeping the bot aiming toward the target in the event of brief obstructions of their view. this.AimPersistance = 2.0; // MaxViewDistance is the maximum distance(in game units) the bot is capable of seeing something. // This could be tweaked lower for maps with fog or for a closer to human view distance // Typically this value is best set in the map script in the OnBotJoin callback. //this.MaxViewDistance = 10000.0; // These 3 values are aim properties. Care must be taken when tweaking aim properties, since // improper values can produce aim oscillations and hurt the bots combat abilities. this.MaxTurnSpeed = 720.0; // degree's / second this.AimStiffness = 75.0; this.AimDamping = 10.0; this.Events[EVENT.SPAWNED] = function() { // disable the bot, both weapon and locomotion //this.SetScriptControlled(true); //this.SetScriptControlledWeapons(true); //this.EnableItemUse(false); EnableDebugWindow(true); this.SetDebugFlag(DEBUG.GOALS, true); }; this.Events[EVENT.FEEL_PAIN] = function(Inflictor) { if(Inflictor) { who = GetEntName(Inflictor); this.Say("Hurt by ", who); } }; this.Events[EVENT.PLAYER_USE] = function(Who) { p = GetEntName(Who); this.Say("Used by ", p); }; this.Events[EVENT.HEAR_SOUND] = function(Source, Origin, SoundId, SoundName) { this.Say("Heard Sound ", SoundName); }; this.Events[EVENT.DEATH] = function(Inflictor, MeansOfDeath) { who = GetEntName(Inflictor); if(who) { this.Say(who, " killed me with ", MeansOfDeath); } else { this.Say("I died from ", MeansOfDeath); } }; this.Events[EVENT.WEAPON_FIRE] = function(WeaponId, Projectile) { this.Say("Fired Weapon ", WeaponId, " projectile: ", Projectile); if(Projectile) { endTime = GetTime() + 5000; dowhile(GetTime() < endTime) { projVel = GetEntVelocity(Projectile); print("Projectile Velocity ", projVel.Length()); yield(); } } }; this.Events[EVENT.KILLEDSOMEONE] = function(Victim, MeansOfDeath) { who = GetEntName(Victim); this.Say("I killed ", Victim, " with ", MeansOfDeath); }; chatfunc = function( WhoSaidIt, Message ) { if(Message && Message.Find("bot") == 0) { cmd = Message.RightAt(4); if(cmd == "go") { this.Say("going."); this.SetScriptControlled(false); this.SetScriptControlledWeapons(false); } else if(cmd == "stop") { this.Say("stopped."); this.SetScriptControlled(true); this.SetScriptControlledWeapons(true); } else if(cmd == "shootoff") { this.Say("not shooting."); this.SetScriptControlledWeapons(true); } else if(cmd == "shooton") { this.Say("shooting."); this.SetScriptControlledWeapons(false); } else if(cmd == "itemoff") { this.Say("not shooting."); this.EnableItemUse(false); } else if(cmd == "itemon") { this.Say("shooting."); this.EnableItemUse(true); } else if(cmd == "nomove") { this.Say("not moving."); this.SetScriptControlled(true); } else if(cmd == "lookatme") { this.Say("watching", GetEntName(0)); this.SetWatchEntity(0); } else if(cmd == "dontlookatme") { this.Say("not watching", GetEntName(0)); this.ClearWatchEntity(); } else if(cmd == "jump") { this.PressButton(BTN.JUMP); } else if(cmd.Find("selectweapon")==0) { wpn = cmd.RightAt(12); this.SelectWeapon(wpn.Int()); } else if(cmd == "reload") { this.PressButton(BTN.RELOAD); } else if(cmd == "shoot") { this.HoldButton(BTN.ATTACK1, 5); } else if(cmd == "shoot2") { this.HoldButton(BTN.ATTACK2, 5); } else if(cmd == "crouch") { this.HoldButton(BTN.CROUCH, 5); } else if(cmd == "holdcrouch") { this.HoldButton(BTN.CROUCH, -1); } else if(cmd == "releasecrouch") { this.ReleaseButton(BTN.CROUCH); } else if(cmd == "come") { this.Say("omw."); sc = this.IsScriptControlled(); wsc = this.IsScriptControlledWeapons(); vPos = GetEntPosition(0); vFace = GetEntFacing(0); this.SetScriptControlled(true); this.GoTo(vPos, vFace); res = block(EVENT.GOAL_SUCCESS, EVENT.GOAL_FAILED); if(res == EVENT.GOAL_FAILED) { this.Say("Can't do it!"); } else { this.Say("Did it!"); } this.SetScriptControlled(sc); this.SetScriptControlledWeapons(wsc); } else { this.Say("Command: ", cmd); this.ExecCommand(cmd); } } }; this.Events[EVENT.TEAM_CHAT_MSG] = chatfunc; this.Events[EVENT.GLOBAL_CHAT_MSG] = chatfunc;