Page 2 of 2
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 15:41
by NoQ
aubergine wrote:How do I find out if a given droid object is a VTOL or not? I know it will be defined in the .droidType property, but can't find a list of possible values for that property :s
I'm also looking for a way to find out how many modules a structure has.
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 17:03
by NoQ
Anyhow, here's my current progress.
I wasn't yet able to figure out how to make modules properly (so don't read module building code plz

), and i was too lazy to add VTOL code, but here's a hopefully-working non-cheating javascript AI that is able to defeat a medium Nexus bot in certain cases (:
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 17:05
by aubergine
Do you know if there's any way to get information about the map - eg. it's size? -- Just spotted the mapWidth and mapHeight globals in the JS API docs.
Also is there any way to set the factory properties - eg. when you right click a factory you can set it so that all units it makes are "fire at long range", etc. And on units you can set them to patrol, etc.
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 19:59
by Per
aubergine wrote:How do I find out if a given droid object is a VTOL or not? I know it will be defined in the .droidType property, but can't find a list of possible values for that property :s
The function isVTOL(droid). It is not set in .droidType. The .droidType values are now defined in the documentation.
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 20:08
by Per
NoQ wrote:I'm also looking for a way to find out how many modules a structure has.
I just added that to relevant structures as the 'modules' property.
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 20:13
by aubergine
Would it be worth doing something similar to droid objects - eg. someDroid.isVTOL ?
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 22:25
by aubergine
@NoQ: Found an issue with Nullbot - if there is a turret near an uncaptured oil resource, nullbot churns out endless numbers of trucks and sends them to their death rather than building an army to attack with - it might make a few tanks, but doesn't reach MIN_ATTACKERS because it's too busy churning out truck lemmings.
Re: Help with creating an AI using JS
Posted: 12 Jan 2012, 22:31
by NoQ
Agreed, it needs to check for threats before building derricks.
Re: Help with creating an AI using JS
Posted: 14 Jan 2012, 08:53
by NoQ
After a git pull, nullbot-0-1.wz has started to crash with the following
Floating Point Exception at the moment it is just about to complete its first lab (or maybe rather when it was just completed). What am i missing?

What has changed?

Re: Help with creating an AI using JS
Posted: 14 Jan 2012, 14:12
by Per
NoQ wrote:After a git pull, nullbot-0-1.wz has started to crash with the following
Floating Point Exception at the moment it is just about to complete its first lab (or maybe rather when it was just completed). What am i missing?

What has changed?

Not exactly sure why, but for some reason a feature has zero health when it is presented to the script. Don't have time to investigate much, but I have fixed the symptom, so it should no longer crash.
Re: Help with creating an AI using JS
Posted: 14 Jan 2012, 15:32
by NoQ
This must have been an oil derrick ... Ok (:
upd: working now, yeah.