LUA error in THoT-Invaders

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
benne278
Posts: 2
Joined: April 25th, 2021, 3:13 am

LUA error in THoT-Invaders

Post by benne278 »

See the attached replay. On turn 7 for side 3, the orcs re-occupy the village at 25,2. Immediately when the village is occupied there is only one hex free next to the village. The game tried to spawn more outlaw humans. It creates one, then prints the following error:

Code: Select all

20210801 01:08:36 error scripting/lua: campaigns/The_Hammer_of_Thursagan/lua/spawns.lua:27: bad argument #2 to 'put_unit' (invalid location)
stack traceback:
	[C]: in field 'put_unit'
	campaigns/The_Hammer_of_Thursagan/lua/spawns.lua:27: in local 'cmd'
	lua/wml-utils.lua:145: in field 'handle_event_commands'
	lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5>
It looks like the lua code tries to handle the case where all the hexes next to the village are occupied, and tries to go out to radius 2 in that case. But this village is near the edge of the map, so radius 2 could theoretically include hexes that are off the map.

Observed with 1.14.15 (standalone MacOS version on MacOS 10.14.6). Other build details:

The Battle for Wesnoth version 1.14.15
Running on Apple macOS 10.14.6 (18G9323)
Distribution channel: SourceForge

Game paths
==========

Data dir: /Applications/Wesnoth.app/Contents/Resources
User config dir: /Volumes/m_app/apps/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.14
User data dir: /Volumes/m_app/apps/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.14
Saves dir: /Volumes/m_app/apps/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.14/saves
Add-ons dir: /Volumes/m_app/apps/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.14/data/add-ons
Cache dir: /Volumes/m_app/apps/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.14/cache

Libraries
=========

Boost: 1.74
Cairo: 1.16.0 (runtime 1.16.0)
Pango: 1.46.1 (runtime 1.46.1)
SDL: 2.0.12 (runtime 2.0.12)
SDL_image: 2.0.5 (runtime 2.0.5)
SDL_mixer: 2.0.4 (runtime 2.0.4)
SDL_ttf: 2.0.15 (runtime 2.0.15)

Features
========

JPEG screenshots: yes
Lua console completion: yes
Legacy bidirectional rendering: no
Cocoa notifications back end: yes

Current video settings
======================

Current pixel resolution: 1440x855
Refresh rate: 60
SDL reports: 256x255 dots per inch.

Installed add-ons
=================

No add-ons installed.
Attachments
THoT-Invaders replay.gz
(48.38 KiB) Downloaded 46 times
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: LUA error in THoT-Invaders

Post by vghetto »

Ravana wrote: November 2nd, 2019, 7:51 pm You should use wesnoth.get_locations({T["not"] { T.filter {} } , T["and"] { x = x, y = y, radius = 1, include_borders = false } })
The function needs to exclude the borders.
The fix would apply for:
The_Hammer_of_Thursagan/lua/spawns.lua
Eastern_Invasion/lua/bandits.lua
Post Reply