Page 1 of 1

[Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)

Posted: Mon Jul 13, 2026 12:52 am
by leo.priori
It would be awesome if we had a way to block and allow specific unit actions.
Of course, still respecting the [actionenabler_*] requirements, but maybe something similar to "movement_disallow()" and "movement_allow()".

Example:

action_disallow(unit, 'User Action 1')
action_allow(unit, 'Bombard 2')

Re: [Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)

Posted: Wed Aug 19, 2026 6:18 pm
by Ignatus
Likely we could handle this by adding a set of user-defined states (flags/promotions) for individual units and adding requirements like "UnitState", "MovementAllowed", "Local", TRUE to "Move" action enabler, and scripting like u:set_state"MovementAllowed" / u:unset_state"MovementAllowed". This could even interrupt the action being unset in action_started_unit_self callback.

I had a request for control over diplomatic meetings somewhere in another post on the forum. Maybe that can be done in a very similar manner, just with manipulating user flags in the table of player's diplomatic relations.