ALERT- Another WS coming up...
I'm fine with hugging reier
class SnSV1(AI.Tactic): name = "SnSV1" # Tactic based on Charge def __init__(self, ai): AI.Tactic.__init__(self, ai) self.regroupPos = None self.regroupDir = True self.regroupTime = 0 def Evaluate(self): self.priority = 0 self.target_id, range = self.ai.GetNearestEnemy() if self.target_id != None: heading = self.ai.GetHeadingToID(self.target_id, False) # better turn than move : priority higher if no heading self.priority = 50 + (abs(heading) * 20) clear_path = self.ai.IsStraightPathClear(self.ai.GetLocation(), plus.getLocation(self.target_id)) if not clear_path: self.priority -= 35 def Execute(self): if self.target_id != None: self.ai.enemy_id = self.target_id heading = self.ai.GetHeadingToID(self.target_id, False) target_loc = plus.getLocation(self.target_id) clear_path = self.ai.IsStraightPathClear(self.ai.GetLocation(), target_loc) distance = (vector3(target_loc) - vector3(self.ai.GetLocation())).length() speed = self.ai.GetSpeed() # if we're close but not moving very fast, turn as fast as possible if (distance < 5 ) and clear_path: self.ai.Throttle(120) self.ai.Turn(100) elif distance > 5 or not clear_path: self.ai.DriveToLocation(plus.getLocation(self.target_id)) else: # stop charging if we're near the edge! if plus.getGameType() == "TABLETOP": a = Arenas.currentArena loc = vector3(self.ai.GetLocation()) # check to see if we're already over dist, over, h = a.DistanceToEdge(loc.asTuple()) if over: return False # now check to see if we're heading over angle = self.ai.GetHeading(False) dir = vector3(math.sin(angle), 0, math.cos(angle)) speed = self.ai.GetSpeed() look_ahead = .5 loc += dir * speed * look_ahead dist, over, h = a.DistanceToEdge(loc.asTuple()) if over: return False # drive as fast as we can toward the target self.ai.AimToHeading(heading) self.ai.Throttle(100) self.regroupPos = None return True else: return False
from __future__ import generatorsimport plusimport AIfrom AI import vector3import Arenasimport Gooeyimport mathimport Tacticsclass SnSV1(AI.SuperAI): "SnSV1!" name = "SnSV1" def __init__(self, **args): AI.SuperAI.__init__(self, **args) self.tactics.append(Tactics.SnSV1(self)) def Activate(self, active): if active: if AI.SuperAI.debugging: self.debug = Gooey.Plain("watch", 0, 75, 100, 75) tbox = self.debug.addText("line0", 0, 0, 100, 15) tbox.setText("Throttle") tbox = self.debug.addText("line1", 0, 15, 100, 15) tbox.setText("Turning") tbox = self.debug.addText("line2", 0, 30, 100, 15) tbox.setText("") tbox = self.debug.addText("line3", 0, 45, 100, 15) tbox.setText("") return AI.SuperAI.Activate(self, active) def LostComponent(self, id): return AI.SuperAI.LostComponent(self, id) def DebugString(self, id, string): if self.debug: if id == 0: self.debug.get("line0").setText(string) elif id == 1: self.debug.get("line1").setText(string) elif id == 2: self.debug.get("line2").setText(string) elif id == 3: self.debug.get("line3").setText(string)AI.register(SnSV1)
list.append( ("Bomb", "SnSV1", { 'turnspeed' : 1.7, 'topspeed' : 12.0, 'weapons': (8, 12, 14, 15) }) )
I may have come up with a possible solution to my flail shell spinner problem. What if I treated it like a sit n' spin when its motors is running, and when it moves toward the opponent, it shuts its weapon motor off, thus allowing it to drive properly, then reactivate the motor and start spinning again when the opponent comes in range.
Okay.... I have another AIing dilema. I have a one-wheeled SnS, and in order for it to be able to driver toward the opponent it has to only have the forward/backward analogue wired. The problem is, once the opponent is in the whipzone, I need the bot to start spinning around. The AI won't do this because it needs the Left/right analogue also wired. Does anyone know how to get my SnS to function properly?
You got my vote for RA2 Wizard. Always and forever.