Events - How To properly Override them
#1
Posté 20 novembre 2009 - 08:20
Overriding Events
Please note though that the articel atm just captures the override of an event that doesn't have any actions attached to it.
And be careful to send any event that you aren't covering completly to the Default Eventhandler attached to it by calling HandleEvent() with the current event and without a ressource!
#4
Posté 21 novembre 2009 - 07:56
We might need to create some community module that will allow us to register event handlers on the code side or something. Unless I'm totally wrong here.
#5
Posté 22 novembre 2009 - 04:09
Edit: After actually following the link, I see that is exactly what you are talking about. And yes, you are right.
Modifié par Craig Graff, 22 novembre 2009 - 08:04 .
#6
Posté 22 novembre 2009 - 07:39
the example in the wiki is just a script that uses EVENT_TYPE_INVENTORY_ADDED.
i can use this event type without changing a 2da.
was it just a simple example?
is the purpose to create new events?
#7
Posté 22 novembre 2009 - 08:07
#8
Posté 22 novembre 2009 - 08:28
i thought, if you want to script something, you create a new script which looks like this
#include "......_h"
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
switch (nEvent)
{
case the event you want
your code
}
and at the end you call the core script if the event wasn´t handled above.
so i don´t change the core_script.
i just check my event and script what i want
i don´t see the difference to the script in the wiki-link
edit: or does this just tell the game to fire a specific script when the event is called?
Modifié par Cador, 22 novembre 2009 - 08:31 .
#9
Posté 22 novembre 2009 - 09:15
In that case, you would have to have that be the core script of an addin module. Overriding the event allows you to use ANY script on a certain event.Cador wrote...
ok thats to high for me.
i thought, if you want to script something, you create a new script which looks like this
#include "......_h"
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
switch (nEvent)
{
case the event you want
your code
}
and at the end you call the core script if the event wasn´t handled above.
so i don´t change the core_script.
i just check my event and script what i want
i don´t see the difference to the script in the wiki-link
edit: or does this just tell the game to fire a specific script when the event is called?
#10
Posté 22 novembre 2009 - 09:51
Gralamin wrote...
In that case, you would have to have that be the core script of an addin module. Overriding the event allows you to use ANY script on a certain event.
+ some events just don't fire into your script.
#11
Posté 22 novembre 2009 - 10:05
I'm guessing this include INVENTORY_ADDED? I know I've tried everything to get it to fire on my Display Item Set Bonuses mod.AND04 wrote...
Gralamin wrote...
In that case, you would have to have that be the core script of an addin module. Overriding the event allows you to use ANY script on a certain event.
+ some events just don't fire into your script.
Modifié par Gralamin, 22 novembre 2009 - 10:06 .
#12
Posté 22 novembre 2009 - 10:24
There is a CAMPAIGN_ITEM_ACQUIRED event, but it is designed to only fire for items that have the appropriate local variable set.
INVENTORY_ADDED can be directed to a specific script, but you would need to be careful how you handled it, since it would potentially be firing for every object in the game.
Modifié par Craig Graff, 22 novembre 2009 - 10:27 .
#13
Posté 22 novembre 2009 - 03:20
Craig Graff wrote...
INVENTORY_ADDED is not a module event. It is an event which fires for each container, be it a placeable or a creature. In the case of the player, the assigned script is player_core.
There is a CAMPAIGN_ITEM_ACQUIRED event, but it is designed to only fire for items that have the appropriate local variable set.
INVENTORY_ADDED can be directed to a specific script, but you would need to be careful how you handled it, since it would potentially be firing for every object in the game.
on another note is it possible to determine wich script is the default event-handler for an object?
In my Case i am overrideing the Event EVENT_TYPE_USE if it has the PlaceableAction PLACEABLE_ACTION_OPEN_INVENTORY - now if its just a Standard-Container/BodyBag i am Auto Looting it - if it has a Plot-Falg (IsPlot) i use HandleEvent(ev); to run the Default-Handler
Now the propblem is, that not all containers with a unique-event script have that plot-flag set.
The Warden Cache triggering the Appearance of Morrigan has it for example - The "Song-Chest" in the Dalish Camp however hasn't.
Now i somehow need to not loot it when a special event script is attached and no plot flag is set to the container - special meaning a none Core-Script.
Modifié par AND04, 22 novembre 2009 - 03:21 .
#14
Posté 22 novembre 2009 - 07:34
I think I'll put in a request for one.
#15
Posté 22 novembre 2009 - 08:53
Craig Graff wrote...
Sadly, I know of no way to determine that. A GetEventScript function would certainly be handy though.
I think I'll put in a request for one.
that would be great
#16
Posté 06 décembre 2009 - 07:09
I found the folder with ExcelProcessor.exe, but I am unsure what the path in bold should be.
D:\\Dragon Age\\tools\\main\\ResourceBuild\\Processors\\ExcelProcessor.exe "%l" -outdir=D:\\DA\\tag\\main\\build\\packages\\core\\override
#17
Posté 06 décembre 2009 - 08:48
#18
Posté 06 décembre 2009 - 03:56
#19
Posté 07 décembre 2009 - 12:44
- I set the engineevent_mymod m2da EVENT_TYPE_COMBAT_END override to my_events
- Created a new script my_events
- I also tried setting the script as the core module script
When using the engineevent_ m2da override, nothing happens at all, no log write after combat.
I have no clue what I'm doing wrong here, it seems like everything is correct yet the script never fires. Anyone any ideas, I'm at a loss here.
- The following is contained inside the event, the module load event fires correctly, the combat_end doesn't:
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
object oOwner = GetEventCreator(ev);
object oItem = GetEventObject(ev, 0);
switch ( nEventType )
{
case EVENT_TYPE_MODULE_LOAD:
{
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("***** MODULE LOAD EVENT TRIGGERED ********");
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("******************************************");
break;
}
case EVENT_TYPE_COMBAT_END:
{
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("***** EVENT COMBAT_END FIRED *************");
PrintToLog("******************************************");
PrintToLog("******************************************");
PrintToLog("******************************************");
DisplayFloatyMessage(OBJECT_SELF, "EVENT FIRED");
HandleEvent(ev);
break;
}
default:
break;
}
}
Modifié par Joshua Raven, 07 décembre 2009 - 12:47 .
#20
Posté 07 décembre 2009 - 03:14
The script that manage EVENT_TYPE_COMBAT_END is an other script, that you referred in the engineevent M2DA file.
The event EVENT_TYPE_COMBAT_END is fired in creature script. So it will fired each time a creature get out of combat.
But be aware that I figured that HandleEvent doesn't call custom creature scripts. Once you have succed to make it work, test it on Spider Queen in Thaig to be sure you are not doing something wrong.
#21
Posté 07 décembre 2009 - 03:51
#22
Posté 07 décembre 2009 - 11:33
And when entering triggers, they fire more than once.
Has anyone gotten EVENT_TYPE_ENTER to work FOR AN AREA with an override?
Modifié par georage, 08 décembre 2009 - 12:26 .
#23
Posté 08 décembre 2009 - 12:54
EVENT_TYPE_AREALOAD_POSTLOADEXIT
EVENT_TYPE_AREALOAD_PRELOADEXIT
EVENT_TYPE_AREALOAD_SPECIAL
or if you are trying to do something when a savegame is loaded in an area
EVENT_TYPE_AREALOADSAVE_POSTLOADEXIT
EVENT_TYPE_AREALOADSAVE_PRELOADEXIT
EVENT_TYPE_AREALOADSAVE_SPECIAL
Modifié par Craig Graff, 08 décembre 2009 - 12:55 .
#24
Posté 08 décembre 2009 - 08:47
#25
Posté 08 décembre 2009 - 11:05
PRELOADEXIT happens while the load screen is up.
POSTLOADEXIT happens as the load screen is going away.
SPECIAL is for running a cutscene or movie once the area has loaded.
I would suppose the order is pre > special > post. Though I'm not certain about those last two.





Retour en haut






