How do Unit Abilities function?

Hello. Do unit abilities activate with the press of a button? Or do they accumulate a resource, then automatically function? How do abilities function?

Do units or special units, have abilities or special abilities?

Thank you for your help. ^^

There are four kind of abilities, by name almost self-explanatory. These maybe race or unit/building specific.

  1. “always_on_abilities”
    Permanent active, don’t need a certain trigger.

  2. “modal_abilities”
    Are activated by certain circumstances.

  3. “timed_abilities”
    Are player or conditional triggered and work for a certain time.

  4. “toggle_abilities”
    Are triggered/switched by player (UI button).

The complete list with all properties you can see in the editor (menu attributes > abilities).
Alternatively browse the folders “Age of Empires IV\cardinal\attrib\instances\abilities”. Each xml file describes an ability.

Thank you BilboB1887! ^^