If your MicroAI does not move the unit nor clear its moves, other candidate actions will be given a chance to control it.if a unit does blunder into an enemy, if I simply ensure the unit can attack will control automatically pass to the RCA ai when the micro_ai has finished or do I need to explicitly "deregister" it with the micro ai before the RCA ai can subsequently assume control of this unit?
It doesn't really make sense to have events in a MicroAI at all. Your events 1 and 2 probably don't need to be events – you can just check the current state of the map when the MicroAI runs. As for event 3, it doesn't make sense to me to put that logic in the MicroAI. I'd just define that logic in WML, separate from the MicroAI, and make the event actually disable the MicroAI. And, when it comes to detecting an attack on a parent, all you really need to do is store the parent's hitpoints in a unit variable on every turn. Then when the MicroAI runs, check if the variable is different from its current hitpoints and there is an adjacent enemy. If there is, skip that parent unit entirely.Is is preferable to implement the events above in lua or WML?
I would prefer lua as I hope to write the entire micro_ai as a single lua file.
However given the need to trap events on other side turns (attacker hits) I'm not certain this is possible?
It's perfectly fine to make up tags. You can define the format of theIs it OK to invent/create arbitrary tags such as[filter_parent]
or are only recognised WML tags allowed/recognised?
[micro_ai]
tag contents however you want.I'm not sure if that would be useful… I think I'd skip it for now.Not sure whether to check that parents and children are distinct (and issue error if not) or trust the campaign designer.
(I.e. would such a sanity check be useful?)
Setting moves=0 seems wrong, pretty sure you said you want other candidate actions to take control in this case? The "defer attack" thing makes it even more clear that this probably shouldn't be an event, as you only care about the final state once it is the MicroAI's turn.Need to split moveto/enter_hex logic:
- Set moves=0 immediately (all units)
- Parent only: defer attack enemy until all moves completed then only attack adjacent enemy if no enemies adjacent to children within range (and parent_attack chance → attack).
Is this awkward to implement in lua?
Statistics: Posted by Celtic_Minstrel — Today, 3:07 pm