I'm using omni.py and I want my bot to fire its weapon once inverted, in order to self-right. How would I do this?
also lol at most toxic guy around calling others out on this sh**
I think SM is a pretty cool guy, eh builds unicycle-bots and doesn't afraid of anything
Hi there, I'm using popup.py for my popup bot (which I took from the starcore 4 ai pack, I don't know where can I find the latest version of it), and noticed that weapons fire only when the chassis of the opponent enters the smart zone but not when the chassis is inside it. This means if my popup bot shoves up the opponent before the razors retract, the opponent can sit on the top of my bot without firing the weapons. Is it possible to fix this, somehow or do you know an update version of this file?
Let me have a look at the popup.py
from __future__ import generatorsimport plusimport AIfrom AI import vector3import Arenasimport Gooeyimport mathimport Tacticsclass Popup(AI.SuperAI): "Like Omni, but fires its weapon only upon smartzone contact with an opponent's chassis." name = "Popup" def __init__(self, **args): AI.SuperAI.__init__(self, **args) self.zone1 = "weapon" self.triggers1 = ["Fire"] self.triggers2 = ["Srimech"] if 'zone' in args: self.zone = args['zone'] if 'triggers' in args: self.triggers1 = args['triggers'] if 'triggers' in args: self.triggers2 = args['triggers'] self.tactics.append(Tactics.Engage(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("") self.RegisterSmartZone(self.zone1, 1) return AI.SuperAI.Activate(self, active) def Tick(self): # fire weapon targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] bReturn = AI.SuperAI.Tick(self) return bReturn def InvertHandler(self): # fire all weapons once per second (until we're upright!) while 1: for trigger in self.triggers2: self.Input(trigger, 0, 1) for i in range(0, 8): yield 0 def LostComponent(self, id): # if we lose all our weapons, stop using the Engage tactic and switch to Shove if id in self.weapons: self.weapons.remove(id) if not self.weapons: tactic = [x for x in self.tactics if x.name == "Engage"] if len(tactic) > 0: self.tactics.remove(tactic[0]) self.tactics.append(Tactics.Shove(self)) self.tactics.append(Tactics.Charge(self)) 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) def SmartZoneEvent(self, direction, id, robot, chassis): if id == 1 and self.weapons: if chassis: if direction == 1: for trigger in self.triggers1: self.Input(trigger, 0, 1) return True AI.register(Popup)
def SmartZoneEvent(self, direction, id, robot, chassis): if id == 1 and self.weapons: if chassis: if direction == 1: for trigger in self.triggers1: self.Input(trigger, 0, 1) return True
def Tick(self): # fire weapon targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] bReturn = AI.SuperAI.Tick(self) return bReturn
def Tick(self): # fire weapon if self.weapons: targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] if len(targets) > 0: for trigger in self.triggers1: self.Input(trigger, 0, 1) return AI.SuperAI.Tick(self)
if 'triggers' in args: self.triggers2 = args['triggers']
if 'srimech' in args: self.triggers2 = args['srimech']
if 'zone' in args: self.zone = args['zone']
if 'zone' in args: self.zone1 = args['zone']
The goal of the popup.py is hitting other bot only when the chassis is within the smart zone.
What does nochassistime actually do?
Ok made the changes except the SmartZoneEvent thing. The goal of the popup.py is hitting other bot only when the chassis is within the smart zone. Do you have info what does the arguments for this SmartZoneEvent method mean?