Dragon Age: Origins
0 of 0

File information

Last updated

Original upload

Created by

Anakin

Uploaded by

anakin55

Virus scan

Safe to use

About this mod

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.

Requirements
Permissions and credits
Mirrors
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_DYINGeventmanager
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
X1023 EVENT_TYPE_DYINGmy_mod_dying 0
Y1028 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 ...
}



  • Side Note

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_eventmanager.GDA

In addition, you have to include your event table : eventmanager_my_mod.GDA

I personally included these file in my_mod/core/override/toolsetexport. So I know it is working from here. I didn't make the test for my_mod/module/override/toolsetexport


  • About EventManager_ReleaseLock()


This function help to partially override an event. For example, if you have want to override an event ONLY for followers, you will do something like this in your script :

#include "eventmanager_h"

void main()
{
if (IsFollower(OBJECT_SELF) == FALSE)
{
EventManager_ReleaseLock();
return;
}

event ev = GetCurrentEvent();

// bla bla bla ...
}


It allows other mod to also override this event for an other type of object. In the example of EVENT_TYPE_DYING, it mean the Mod X can override it for followers and the mod Y can override it for other creatures.
You don't need to use ReleaseLock function is you are just listening for the event.


  • Override ability script without touching ABI_ table

You can override events :
EVENT_TYPE_SPELLSCRIPT_PENDING
EVENT_TYPE_SPELLSCRIPT_CAST
EVENT_TYPE_SPELLSCRIPT_IMPACT

then you can test to just keep abilities that are interesting for you and call EventManager_RealeaseLock() for others.

For example, if I want to override what append when casting a summon ability (i.e EVENT_TYPE_SPELLSCRIPT_IMPACT) :

#include "eventmanager_h"

void main()
{
event ev = GetCurrentEvent();
struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev);

switch(stEvent.nAbility)
{
case ABILITY_TALENT_NATURE_I_COURAGE_OF_THE_PACK:
case ABILITY_TALENT_NATURE_II_HARDINESS_OF_THE_BEAR:
case ABILITY_TALENT_SUMMON_SPIDER:
case ABILITY_SPELL_ANIMATE_DEAD:
{
// my code here

break;
}
default:
{
EventManager_ReleaseLock();
return;
}
}
}