// Default ET Bot Profile print( "Sample Default Bot Profile" ); // Load some scripts we might use. ExecScript( "health_goal.gm" ); ExecScript( "ammo_goal.gm" ); ExecScript( "disguise_goal.gm" ); ExecScript( "mountvehicle_goal.gm" ); ExecScript( "dispenseammo_goal.gm" ); ExecScript( "dispensehealth_goal.gm" ); ExecScript( "escortvehicle_goal.gm" ); ExecScript( "ridevehicle_goal.gm" ); ExecScript( "useswitch_goal.gm" ); ExecScript( "poisoned.gm" ); //~ ExecScript( "crapshoot_testfunc.gm" ); // 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; ////////////////////////////////////////////////////////////////////////// // Utility Callbacks this.SelectTeam = function() { return null; }; this.SelectClass = function() { return null; }; ////////////////////////////////////////////////////////////////////////// global ClassPrimaryWeaponChoice = function(bot) { myteam = bot.GetTeam(); myclass = bot.GetClass(); if(GetModName() == "noquarter") { if ( myclass == CLASS.SOLDIER ) { if ( myteam == TEAM.ALLIES ) { wpns = { WEAPON.VENOM, WEAPON.BAZOOKA, WEAPON.MOBILE_BROWNING, WEAPON.FLAMETHROWER, }; return wpns[ RandInt( 0, 3 ) ]; } else { wpns = { WEAPON.VENOM, WEAPON.PANZERFAUST, WEAPON.MOBILE_MG42, WEAPON.FLAMETHROWER, }; return wpns[ RandInt( 0, 3 ) ]; } } } else if(GetModName() == "jaymod") { if ( myclass == CLASS.SOLDIER ) { wpns = { WEAPON.PANZERFAUST, WEAPON.MOBILE_MG42, WEAPON.FLAMETHROWER, //WEAPON.MORTAR // dont choose this for now }; return wpns[ RandInt( 0, 2 ) ]; } } else // etmain { if ( myclass == CLASS.SOLDIER ) { wpns = { WEAPON.PANZERFAUST, WEAPON.MOBILE_MG42, WEAPON.FLAMETHROWER, //WEAPON.MORTAR // dont choose this for now }; return wpns[ RandInt( 0, 2 ) ]; } } return null; }; global ClassSecondaryWeaponChoice = function(bot) { return null; }; this.SelectWeapons = function() { myteam = this.GetTeam(); myclass = this.GetClass(); //~ print("SelectWeapons: Class", myclass, "Team", myteam); weaponSelection = {}; weaponSelection.Primary = ClassPrimaryWeaponChoice(this); weaponSelection.Secondary = ClassSecondaryWeaponChoice(this); if ( weaponSelection.Primary ) { this.ChangePrimaryWeapon( weaponSelection.Primary ); } if ( weaponSelection.Secondary ) { this.ChangeSecondaryWeapon( weaponSelection.Secondary ); } }; ////////////////////////////////////////////////////////////////////////// global saySkills = function() { this.mySkills = table(); if(this.GetSkills(this.mySkills)) { this.Say("Battle Sense: ", this.mySkills[SKILL.BATTLE_SENSE]); this.Say("Engineering: ", this.mySkills[SKILL.ENGINEERING]); this.Say("First Aid: ", this.mySkills[SKILL.FIRST_AID]); this.Say("Signals: ", this.mySkills[SKILL.SIGNALS]); this.Say("Lght Wpns: ", this.mySkills[SKILL.LIGHT_WEAPONS]); this.Say("Hvy Wpns: ", this.mySkills[SKILL.HEAVY_WEAPONS]); this.Say("Cov Ops: ", this.mySkills[SKILL.COVERTOPS]); } else { this.Say("Don't know my skills!"); } }; // How about a simple script for field ops and medics when they spawn to drop some ammo/health spawn_func = function() { //yield(); // clear any previously scripted goals. this.scriptgoal = null; this.SetScriptControlled(false); this.SetScriptControlledWeapons(false); //~ ScriptGoals.TestFunc.TestMe(this); // Sample Usage of health_goal.gm //this:thread(ScriptGoals.watch_health.watchHealthFunc); // Check if this bot is a Medic, and drop some Medkits for a few seconds. if(this.GetClass() == CLASS.MEDIC) { this:thread(ScriptGoals.dispense_health.DispenseHealth); } // Check if this bot is a Field-Ops, and drop some Ammo for a few seconds. if(this.GetClass() == CLASS.FIELDOPS) { this:thread(ScriptGoals.dispense_ammo.DispenseAmmo); } this:thread(ScriptGoals.mount_vehicle.watchForMountableVehicles); this:thread(ScriptGoals.escort_vehicle.watchForEscortableVehicles); ScriptGoals.RideVehicle.Begin(this); WatchForPoison.Begin(this); ScriptGoals.UseSwitch.Begin(this); // Sample usage of disguise_goal.gm //if( this.GetClass() == CLASS.COVERTOPS ) //{ // this:thread(ScriptGoals.disguise_goal.LookForDisguiseGoalThread); //} //~ this.SetDebugFlag(DEBUG.GOALS, true); }; death_func = function( Inflictor, MeansOfDeath ) { if( RandRange(0, 100) < 10 ) { this.SayVoice(VOICE.G_GREATSHOT); } }; team_chatmsg_func = function( WhoSaidIt, Message ) { if( Message == "snipe here") { if( this.CanSnipe() ) { this.SayVoice(VOICE.AFFIRMATIVE); sourceEntPos = GetEntPosition(WhoSaidIt); sourceEntFacing = GetEntFacing(WhoSaidIt); if(sourceEntPos && sourceEntFacing) { this.Snipe(sourceEntPos, sourceEntFacing); status = block(EVENT.GOAL_SUCCESS, EVENT.GOAL_FAILED); if(status == EVENT.GOAL_FAILED) { this.Say("Can't do it!"); } } } return; } if( Message == "skills" ) { this:saySkills(); return; } // Restrict it to only when waypoint mode is on for now. if( Wp.IsWaypointViewOn() ) { if(Message == "come") { this.SayVoice(VOICE.AFFIRMATIVE); sourceEntPos = GetEntPosition(WhoSaidIt); sourceEntFacing = GetEntFacing(WhoSaidIt); if(sourceEntPos && sourceEntFacing) { this.SetScriptControlled(true); this.GoTo(sourceEntPos, sourceEntFacing); } status = block(EVENT.GOAL_SUCCESS, EVENT.GOAL_FAILED); if(status == EVENT.GOAL_SUCCESS) { this.Say("Now What?"); } } else if(Message == "roam") { this.SayVoice(VOICE.AFFIRMATIVE); this.SetScriptControlled(false); } } }; // Do this on spawn. Comment this out if you dont want them to do this. this.Events[EVENT.SPAWNED] = spawn_func; //this.Events[EVENT.DEATH] = death_func; this.Events[EVENT.TEAM_CHAT_MSG] = team_chatmsg_func; difficulties.InitBotDifficultyProperties(this);