I'm playtesting a scenario and am, for the first time, using the goto micro_ai on a subset of the units in an side.
I've used this before with no problems but now I'm getting an onscreen error that I can't even work out what I need to do to try and fix it.
First off, the error:
The setup is that certain units are given an ability, then whichever units have this ability are added to the micro_ai.
Various units are randomly scattered around parts of the map in prestart and others are added every turn for awhile.
I've used this code (or something very similar) in a previous scenario and it all worked fine.
In prestart here is the code that defines which unit(s) are controlled by the micro ai.
This is the only place where the micro_ai is added.During playtesting what I think is happening is that the micro_ai tries to move a unit and the error is issued (bit hard to follow, there's a lot going on, visually, in this scenario). As far as I can tell, only *1* side 2 unit moves in this phase of the turn sequence.
Only side 2 issues this error, sides 3 & 4 seems to work fine.
I could separate out the side 2 units that are controlled by the goto into a new side but I'd prefer to keep the current setup if possible.
So, assuming it's my code, any idea what I should be looking for?
Any suggestions gratefully received.
(Haven't posted the entire scenario because it is 1781 lines long and has several chunky macros in there are well.)
Cheers!
-- Spannerbag
I've used this before with no problems but now I'm getting an onscreen error that I can't even work out what I need to do to try and fix it.
First off, the error:
error scripting/lua: ai/micro_ais/cas/ca_goto.lua:211: attempt to index a nil value (local 'closest_hex')
stack traceback:
ai/micro_ais/cas/ca_goto.lua:211: in field 'execution'
[string "local self, params, data, filter_own = ......"]:2: in main chunk
The setup is that certain units are given an ability, then whichever units have this ability are added to the micro_ai.
Various units are randomly scattered around parts of the map in prestart and others are added every turn for awhile.
I've used this code (or something very similar) in a previous scenario and it all worked fine.
In prestart here is the code that defines which unit(s) are controlled by the micro ai.
This is the only place where the micro_ai is added.
Code:
[micro_ai] side=2,3,4 [filter] ability=dapanic# Done this way so that any unit can be "un-goto"'d by removing panic object if needed [/filter] ai_type=goto action=add [filter_location] {GH_XY} [/filter_location] remove_movement=no use_straight_line=yes# Quicker than ignore_units# ignore_units=yes [/micro_ai]
Only side 2 issues this error, sides 3 & 4 seems to work fine.
I could separate out the side 2 units that are controlled by the goto into a new side but I'd prefer to keep the current setup if possible.
So, assuming it's my code, any idea what I should be looking for?
Any suggestions gratefully received.
(Haven't posted the entire scenario because it is 1781 lines long and has several chunky macros in there are well.)
Cheers!
-- Spannerbag
Statistics: Posted by Spannerbag — Yesterday, 10:02 pm