Bots and Simulations > DNA - General
Smart avoiding bahavior
Testlund:
I'm trying to get a bot to swim the hell out of the way when it gets hit by hostile fire, but none of the combinations I try are effective. It either ends up making crazy turns are swim directly at the bot shooting at it. Any suggestions?
This is the best I've found so far but it's not good enough:
--- Code: ---cond
*.shflav -1 =
*.shflav -6 = or
start
*.aim *.shang .setaim store
100 .up store
stop
--- End code ---
Testlund:
I suppose this is the best there is:
*.shang sub .setaim store
*.maxvel .up store
Botsareus:
[Warning]Nooby qustion [/Warning]
Testlund, what does shang do?
Botsareus:
Oh, shot angle, got it. 8)
Sorry, I was cooking, wanted a quick anws.
Numsgil:
--- Quote from: Testlund on September 09, 2014, 05:57:23 PM ---I suppose this is the best there is:
*.shang sub .setaim store
*.maxvel .up store
--- End quote ---
You probably want to use *.shang - .setaim store
That is, sub is a binary command, so it's going to pull two values from teh stack. If there's only one, it'll get a 0 value, and do what you expect, but if there's still a number on the stack for whatever reason it won't do what you expect. The - command is a unary command, and negates the top value of the stack.
See the wiki page on negate for more (well, not really :)) details.
Navigation
[0] Message Index
[#] Next page
Go to full version