Contolling Attack Stikes with lua?
Moderator: Forum Moderators
Contolling Attack Stikes with lua?
I thought I'd ask if it's even possible before attempting to figure it out as learning exercise.
What's I was thinking about was a way to control the attack of a stronger unit when pairing strong and weak units to help the weak unit advance. If the strong unit stopped striking when that target still had X hit points left, where that X was less than or equal to the damage the unit inflicts that leaves a easy target for the weak unit to finish off. I'm wondering if that level of control is possible with lau during the game. Then I started wondering if the general attack event was part of some engine which probably is all in the C/C++ code.
Anyone one know?
Thanks!
What's I was thinking about was a way to control the attack of a stronger unit when pairing strong and weak units to help the weak unit advance. If the strong unit stopped striking when that target still had X hit points left, where that X was less than or equal to the damage the unit inflicts that leaves a easy target for the weak unit to finish off. I'm wondering if that level of control is possible with lau during the game. Then I started wondering if the general attack event was part of some engine which probably is all in the C/C++ code.
Anyone one know?
Thanks!
- Elvish_Hunter
- Posts: 1575
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Contolling Attack Stikes with lua?
Not directly. However, if I remember correctly (a long time passed since I had to do something like that), if you store a unit, kill it and then unstore it again where it was, the attack ceases.jmh wrote:If the strong unit stopped striking when that target still had X hit points left, where that X was less than or equal to the damage the unit inflicts that leaves a easy target for the weak unit to finish off. I'm wondering if that level of control is possible with lau during the game.
This can be combined with [filter] lua_function= to check if the unit has less than the wanted amount of HP. You can do the same with the formula= key and FormulaAI language.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: Contolling Attack Stikes with lua?
Slow getting back to the forum but Thanks! That's a good starting place to work from.