class scheduler: "A 'brain' to schedule a set of actions." resume = 0 done = 1 abort = 99 def __init__(self): self.actions = [] def setActions(self, actions): self.actions = actions def tick(self): "Run the top action and pop them off as they're completed." if len(self.actions) > 0: result = apply(self.actions[0][0], self.actions[0][1]) if result == scheduler.abort: return False elif result == scheduler.done: # this step is done, move to next self.actions.pop(0) return len(self.actions) > 0 else: return True else: return False
... Since all I want is for the bot to hold the weapon button from start to finish without modifying the driving behaviors, is there any way to get around that? ...
Easy to follow method: If you simply want to use the regular AI tactics for AI steering and control, and yet have your weapon(s) fire continuously, then you can: 1. put this line under 'Tick': ....def Tick(self):........self.Input("AlwaysFire", 0, 100) #Analog for flamethrower. 2. then name your in-game analog control the same name: 'AlwaysFire'. .
def Tick(self): self.Input("Spin", 0, 100) return AI.SuperAI.Tick(self)
def Tick(self): if 1 == 1:self.Input("Spin", 0, 100) return AI.SuperAI.Tick(self)
-I know that the 'input' command DOES work fine standing alone under 'Tick'.. -I've also have seen a difference when enlarging the analog value for a fire. Made a couple cool AI like that, a while ago though. -As far as the flamethower's intermittentness, I did notice sometimes on a few freak AI I made that there were 'lapses', for lack of a better word, of consistant firing. One of the lapses that bugs many, including me, is the lapse in consistent cannon fire. I considered that the 2 (fire lapse and cannon lapse) might be related since they both use the co2 means of simulated power...but I never followed up on it.
def Tick(self): # fire weapon if self.weapons: self.Input("Spin", 0, 100) return AI.SuperAI.Tick(self)
I have an AI.py I wrote a while back, for a 'Photon Blaster' bot. I'll PM it to you...Look it over well and let me know of anything needing explained. BTW: Nice to see you diving into the game....
self.Input("Flame", 0, 130)
ALERT- Another WS coming up...
I'm fine with hugging reier