Lua error
Moderator: Forum Moderators
- Spannerbag
- Posts: 702
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Lua error
Hi,
During playtesting got this error, I use the goto micro_ai a lot in this scenario and it's never given me any problems.
The relevant lua is
I am continually tweaking code but haven't changed the micro_ai stuff recently.
If I can reproduce it I'll post details here.
Apologies but when error came on screen I was looking elsewhere and don't have any more details.
If it is likely to be due to something I've done I'd appreciate any pointers?
The last change I made (and was testing) was a tweak to terrain changes (there are extensive terrain changes throughout in this scenario) but this never makes terrain impassable. Even movement costs are hardly changed and terrain changes events are:
Any suggestions greatfully received!
Cheers,
-- Spannerbag
During playtesting got this error, I use the goto micro_ai a lot in this scenario and it's never given me any problems.
Code: Select all
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
Code: Select all
-- If any of the non-standard path finding options were used,
-- we need to pick the farthest reachable hex along that path
-- For simplicity, we do it for all types of pathfinding here,
-- rather than using ai_helper.next_hop for standard pathfinding
-- Also, straight-line does not produce a path, so we do that first
if not best_path then
best_path = AH.find_path_with_avoid(best_unit, closest_hex[1], closest_hex[2], GO_avoid_map) -- *** LINE 211 ***
end
If I can reproduce it I'll post details here.
Apologies but when error came on screen I was looking elsewhere and don't have any more details.
If it is likely to be due to something I've done I'd appreciate any pointers?
The last change I made (and was testing) was a tweak to terrain changes (there are extensive terrain changes throughout in this scenario) but this never makes terrain impassable. Even movement costs are hardly changed and terrain changes events are:
name=new turn,side 1 turn end,side 4 turn end
.Any suggestions greatfully received!
Cheers,
-- Spannerbag
Re: Lua error
Since closest_hex is undefined you would have to find how it is assigned. From first review easiest way to explain it would be having units empty, since closest_hex is assigned only during loop over units.
- Spannerbag
- Posts: 702
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Lua error
Thanks for the suggestion, much appreciated.
Cheers!
-- Spannerbag
Cheers!
-- Spannerbag