The addNamedEntityListener native AI script function associates a listener with a named entity property. Whenever that field changes, the specified user event is triggered or a script function is called. Valid property names are:
Name of the entity cannot be listened, because it cannot change. Several listeners (even with the same parameters) can be associated to each property.
()addNamedEntityListener(name: s, prop: s, event: f) // addNamedEntityListener_ssf_
()addNamedEntityListener(name: s, prop: s, cbFunc: s) // addNamedEntityListener_sss_
()addNamedEntityListener("Invasion", "state", 6);
This example code associates a listener with the named entity "Invasion" and the property "state". Whenever the "state" property of the "Invasion" named entity changes, user event 6 will be triggered.
()addNamedEntityListener("Invasion", "state", "onStateChange");
This example code associates a listener with the named entity "Invasion" and the property "state". Whenever the "state" property of the "Invasion" named entity changes, the script function "onStateChange" will be called.