if ( WatchForPoison == null ) { global WatchForPoison = { /////////////////////////////////////////////////////// //configurable options CanBeCured = true, //can med packs cure poison? /////////////////////////////////////////////////////// ModName = null, Begin = function( bot ) { if ( !WatchForPoison.ModName ) { WatchForPoison.ModName = GetModName(); } //don't start if in Limbo or etmain if ( (GetEntFlags( bot.GetGameEntity(), ENTFLAG.LIMBO)) || ( WatchForPoison.ModName == "etmain" ) ) { return; } if ( WatchForPoison.ModName == "noquarter" ) { WatchForPoison.CanBeCured = false; } if(bot.WatchForPoisonThread) { threadKill(bot.WatchForPoisonThread); } bot.WatchForPosionThread = bot:thread(WatchForPoison.ThreadFunc); }, ThreadFunc = function() { counter = 0; if ( !this.BotPropertiesSet ) { //print("setting original bot properties"); this.MaxView = this.MaxViewDistance; this.FOV = this.FieldOfView; this.Reaction = this.ReactionTime; this.Persistance = this.AimPersistance; this.Tolerance = this.AimTolerance; this.TurnSpeed = this.MaxTurnSpeed; this.VisionBlurred = false; this.BotPropertiesSet = true; } while (1) { if ( this.HasEntityFlag(ENTFLAG.POISONED) && !this.VisionBlurred ) { //print("setting poisoned properties"); this.MaxViewDistance = 50; //think it's ok to hardcode this one... this.FieldOfView = this.FOV / 2; this.ReactionTime = this.Reaction * 2; this.AimPersistance = this.Persistance / 2; this.AimTolerance = this.Tolerance * 3; this.MaxTurnSpeed = this.FOV / 1.25; //all levels have same turnspeed... this.VisionBlurred = true; } if ( !this.HasEntityFlag(ENTFLAG.POISONED) && this.VisionBlurred ) { //print("setting original properties"); this.MaxViewDistance = this.MaxView; this.FieldOfView = this.FOV; this.ReactionTime = this.Reaction; this.AimPersistance = this.Persistance; this.AimTolerance = this.Tolerance; this.MaxTurnSpeed = this.TurnSpeed; this.VisionBlurred = false; counter = 0; } if ( this.HasEntityFlag(ENTFLAG.LIMBO) && !this.VisionBlurred ) { //print("killing thread"); this.SetScriptControlledWeapons(false); threadKill(this.WatchForPoisonThread); } //properties set and bot still poisoned, so script some additional behaviors if ( this.HasEntityFlag(ENTFLAG.POISONED) && this.VisionBlurred ) { //reset goals if camp / defend. this will keep them from standing in place at these goals //todo: possibly add an interval to reset other type goals based on difficulty level if ( this.GoalName == "GOAL_ATTACK" || this.GoalName == "GOAL_DEFEND" ) { this.ResetSubGoals(); } //medics should give themselves a pack to get rid of poison if ( this.GetClass() == CLASS.MEDIC && this.IsWeaponCharged(WEAPON.MEDKIT) && WatchForPoison.CanBeCured ) { this.SetScriptControlledWeapons(true); dowhile( this.GetCurrentWeapon() != WEAPON.MEDKIT ) { this.SelectWeapon(WEAPON.MEDKIT); yield(); } dowhile( this.HasEntityFlag(ENTFLAG.POISONED) && this.IsWeaponCharged(WEAPON.MEDKIT) ) { this.FireWeapon(); yield(); } this.SelectBestWeapon(); this.SetScriptControlledWeapons(false); } else if ( WatchForPoison.CanBeCured ) { counter += 1; //call for a medic every ten seconds if ( counter >= 9 ) { this.SayVoice(VOICE.NEED_MEDIC); counter = 0; } } //todo: extend functionality here... } sleep(1); } }, }; }