Provide resources for modders to allow them to listen and override events.
In using the Event Manager, mods that override same events are supported.
There is nothing to install for end player, it is just for modding purposes. Mods using the Event Manager are compatible with mods that don\'t use it. You don\'t loose anything and you gain in compatibility.
- []How to listen/override an event with the Event Manager ?
You don\'t need to change your habits concerning overriding events in engineevents. GDA
So fill the engineevents. GDA with all events you want to listen or override.
But redirect them to
eventmanager.
For example, we say that we want to override
EVENT_TYPE_DYING and listen
EVENT_TYPE_MEMBER_HIRED in a mod called my_mod
So my .gda file will looks like this :
ID Label Script
1023 EVENT_TYPE_DYING eventmanager
1028 EVENT_TYPE_PARTY_MEMBER_HIRED eventmanager
Then create a new xls file following the example in the archive. Its name is eventmanager_my_mod.xls.
It is a new M2DA table that need to be extend. Choose a random ID as big as you want for your mod.
Here you have to enter what the name of the scripts that will handler the events.
ID EventType Label Script Mode
X 1023 EVENT_TYPE_DYING my_mod_dying 0
Y 1028 EVENT_TYPE_PARTY_MEMBER_HIRED my_mod_pmh 1
Look at comments in the xls file to know how to fill it properly. Mode are :
0 : You override the event. Your script replace the default handler.
1 : You are listening for the event. The default handler is called before your script.
2 : You are listening for the event. The default handler is called after your script.
and ... finished ! You script will be called each time the event appear.
my_mod_dying script looks like this :
void main()
{
event ev = GetCurrentEvent();
// bla bla bla ...
}
If you override an event, it is because you don\'t want to call the default handler. Your code will replace the default handler and all other mods that are listening for this event will be processed before or after depending of their mode.
If you listen for an event, it is because you want to call the default handler for this event before or after your script. The default handler can be the original or a modified version by an other mod, you cannot be sure.
Listener are called in a \"random\" order.
If you listen an event, never, never, call HandleEvent(ev). It is already done.
- What do I need to include in the player package of my mod ?
You have to embed the Event Manager in case you are the only mod of the player :
Include eventmanager.ncs
Include 2da_eventmana