AI and cyborg mechanic

For AI and campaign script related discussions and questions
Post Reply
p0l1z1
Rookie
Rookie
Posts: 24
Joined: 25 Mar 2012, 07:40
Location: Geneva

AI and cyborg mechanic

Post by p0l1z1 »

Okay ...

After looking everywhere (the guide, other AI script, all the .txt files, this forum, IRC, etc ...) and running I don't know how many tests, I give up. I can't make my AI build a cyborg mechanic. But based on the log I get, it seems that I'm close ... I use :

- "Cyb-Bod-Mechanic" as body
- "CyborgLegs" as propulsion
- DROID_REPAIR as type
- "CyborgRepair" as turret

And I get this :

Code: Select all

error   |06:05:02: [callFunction:109] 0 : <anonymous>()@multiplay/skirmish/ZeligBot.js:299
info    |06:05:02: [callFunction:112] Uncaught exception calling function "ZB_main" at line 299: ReferenceError: validTemplateForFactory(psTemplate, psStruct) failed in js_buildDroid at line 923
info    |06:05:02: [callFunction:112] Assert in Warzone: qtscript.cpp:112 (false), last script event: 'N/A'
error   |06:05:02: [js_buildDroid:923] Invalid template Cyborg Mechanic for factory A0CyborgFactory
All the other combinations I use give me more explicit error that I can fix ... Is it a bug in the code or am I missing something ? I also noticed that neither nullbot nor semperfi seems to use them ...
Lord Apocalypse
Regular
Regular
Posts: 678
Joined: 29 Jul 2009, 18:01

Re: AI and cyborg mechanic

Post by Lord Apocalypse »

I have seen them running around, probably just cannon fodder though. Never really watched to see if they do their job for the AI players.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: AI and cyborg mechanic

Post by aubergine »

Can you post in the exact code you're using?

I imagine it would look something like this:

Code: Select all

buildDroid(cyborgFactoryObj, "Cyb-Mechanic", "Cyb-Bod-Mechanic", "CyborgLegs", "", DROID_REPAIR, "CyborgRepair");
If that doesn't work, have you tried DROID_CYBORG instead of DROID_REPAIR?

Repair cyborgs are great scout units but they are also super useful when used in groups of 2-4 of them sent with tanks in the early stages of the game -- they can make a huge difference to early tank survival.

Really looking forward to see your AI in action :)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
p0l1z1
Rookie
Rookie
Posts: 24
Joined: 25 Mar 2012, 07:40
Location: Geneva

Re: AI and cyborg mechanic

Post by p0l1z1 »

The function is here :

Code: Select all

buildDroid(struct, strategy[currentStrat][2][i][unit][0], strategy[currentStrat][2][i][unit][1], strategy[currentStrat][2][i][unit][2], "", strategy[currentStrat][2][i][unit][3], strategy[currentStrat][2][i][unit][4]);
And here is the array in question :

Code: Select all

["Cyborg Mechanic", "Cyb-Bod-Mechanic", "CyborgLegs", DROID_REPAIR, "CyborgRepair"]
Of course I tripple checked that the correct values goes in the correct places. If I change one field, I get an other error of the type :

Code: Select all

error   |05:55:21: [get_first_available_component:816] No such component: CybosrgRepair
I also have an other borg (heavy gunner) built without problem with the same template (so the struct object is correct for example). I also checked that I have the tech to build the borg (witch I can build manually in the game).

With DROID_CYBORG, I get :

Code: Select all

error   |06:03:07: [get_first_available_component:816] No such component: CyborgRepair
I think it's because it's not the correct type ... I also have a confirmation here that it's DROID_REPAIR :
DROID_REPAIR
Units with repair turret, including repair cyborgs.
Of course, it's not 100% sure as a lot of doc online are outdated ;) For example, I have here :
DROID_CYBORG_REPAIR
Cyborg mechanic
But this one is not recognized at all by the game ...
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: AI and cyborg mechanic

Post by aubergine »

That "scripting manual" link you posted is for Warzone 2.x and earlier. In WZ 3.x and later the whole scripting environment is being ported to Javascript (rather than WZscript that the 2.x and earlier versions used).

BTW, I have an alternate version of the JS docs here: https://warzone.atlassian.net/wiki/display/jsapi/API -- I'm slowly going through everything to make sure that much more comprehensive information for each function, constant, etc., exists along with examples.

Anyway, I think you found a bug. My guess is that nobody tried creating repair cyborgs yet. ...in other words, it's probably worth raising a bug ticket: http://developer.wz2100.net/newticket

I did some digging in to the C++ code behind the scenes and it seems that it uses a CYBORG_REPAIR or DROID_CYBORG_REPAIR constant internally. The JS API hides a lot of these weird complexities from the old C++ source code, I imagine the buildDroid() JS API function forgot to transpose the constant for the cyborg mechanic.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: AI and cyborg mechanic

Post by NoQ »

At least i'm not using cyborg mechanics in nullbot. But i know that in 3.1 you can't produce cyborg engineers. See #3133 for a relevant discussion.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: AI and cyborg mechanic

Post by aubergine »

Updated wiki to note problems with mechanic/engineer borg bug: https://warzone.atlassian.net/wiki/page ... eId=360555
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
p0l1z1
Rookie
Rookie
Posts: 24
Joined: 25 Mar 2012, 07:40
Location: Geneva

Re: AI and cyborg mechanic

Post by p0l1z1 »

aubergine wrote:BTW, I have an alternate version of the JS docs here: https://warzone.atlassian.net/wiki/display/jsapi/API -- I'm slowly going through everything to make sure that much more comprehensive information for each function, constant, etc., exists along with examples.
Yeah, of course, it's my primary source of information, with nullbot code. Very usefull :wink: But for this specific case nothing was specified so I sent few hours looking elsewhere.

By the way, do you need some help to put some examples when they are missing ? I could do it for the functions I have been able to use.
aubergine wrote:Anyway, I think you found a bug. My guess is that nobody tried creating repair cyborgs yet. ...in other words, it's probably worth raising a bug ticket: http://developer.wz2100.net/newticket
As you said in #3133, it will probably fixed by the suppression of the droid type in the parameters. Waiting confirmation from Per ?
aubergine wrote:I did some digging in to the C++ code behind the scenes and it seems that it uses a CYBORG_REPAIR or DROID_CYBORG_REPAIR constant internally. The JS API hides a lot of these weird complexities from the old C++ source code, I imagine the buildDroid() JS API function forgot to transpose the constant for the cyborg mechanic.
Yep, in qtscriptfuncs.cpp I found :
case DROID_CYBORG_REPAIR:
type = DROID_REPAIR; break;
So I gess DROID_CYBORG_REPAIR is older anyway. Confirmed by the fact that the scripting manual is from 2.x. Anyway, we will soon don't need these droid type there anymore ^^


You seriously guys don't use the cyborgs mechanics ? I build them with a ratio of 1 for 1 firing cyborg when I use them in my games :roll: It's less dps, but it's kind of early autorepair and allow me to spend less on units at early stages and more on research by keeping them alive ...
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: AI and cyborg mechanic

Post by Per »

Looks like the same issue as with cyborg engineers. So should be fixed in 3.2.

As a workaround, you could check if ...

Code: Select all

buildDroid(cyborgFactoryObj, "Cyb-Mechanic", "Cyb-Bod-Mechanic", "CyborgLegs", "", 11, "CyborgRepair"); 
... works. (If so, a value of 10 should allow you to produce cyborg engineers...)
p0l1z1
Rookie
Rookie
Posts: 24
Joined: 25 Mar 2012, 07:40
Location: Geneva

Re: AI and cyborg mechanic

Post by p0l1z1 »

Great, it worked ! Thanks :)
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: AI and cyborg mechanic

Post by aubergine »

Ah, sweet, I'll add that workaround to the docs :)
Last edited by aubergine on 04 Dec 2012, 19:18, edited 1 time in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: AI and cyborg mechanic

Post by NoQ »

aubergine:
Per wrote:(If so, a value of 10 should allow you to produce cyborg engineers...)
Also, not sure you noticed, but we talk in the most active forum section (:
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: AI and cyborg mechanic

Post by aubergine »

heh, I'd just noticed that and was editing my message when the internet died.

by most active section do you mean irc?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: AI and cyborg mechanic

Post by NoQ »

I mean scripting forum (:
Post Reply