mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 08:07:17 +00:00

All CAs can be store in external .lua files. If the scenario config lacks an [engine] tag for the Lua AI engine, but still tries to use CA with engine=lua, a dummy engine will be automatically generated, providing the needed functionality
16 lines
306 B
Lua
16 lines
306 B
Lua
--! #textdomain wesnoth
|
|
|
|
example_ca = {}
|
|
|
|
function example_ca:eval(ai)
|
|
wesnoth.message("External eval says hi!")
|
|
|
|
return 10000
|
|
end
|
|
|
|
function example_ca:exec(ai)
|
|
wesnoth.message("External CA exec attacks!")
|
|
ai.attack(2, 12, 3, 12, 1, 1) -- showcasing the presence of the AI table
|
|
end
|
|
|
|
return example_ca |