Aller au contenu

Photo

Overriding single player module_core events?


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
SuperD-710

SuperD-710
  • Members
  • 130 messages
I'm currently trying to override event id 95, EVENT_TYPE_CHAR_RECORD_OPENED, in the single player module_core, with the engineevents M2DA.

I have verified that the event was not getting overridden, and did not get handled by my script at all. It was still passed on to the single player module_core.

I believe it can be one of the two reaons:

1. You cannot override module_core events? Unless you change the single player module property to pass the event to your script first?

2. The events.xls file did not have event id 95. I had to create the entry. Could this be the problem?

Any help regarding this would be greartly appreciated. I should add that, in the same addin module, other event overrides (of player_core and rules_core) are working, just not this one.

#2
anakin5

anakin5
  • Members
  • 258 messages
Yep, you cannot override this event.
You cannot override events handle by scripts in folder named "Core Scripts". (not "_Core Scripts").

Solution 1) You can export a local copy of module_core, make your modification and save it

Solution 2) If your mod is a standalone module, you can creature your own module_core file and associate it to your module.

Solution 3) If your mod is not a standalone module, you have to replace the module_core associated to the current module with the one you want (a copy of module_core with you modifications).
I don't have any idea if you can change the event script of a module "like this", but the function SetEventScript may help you :

SetEventScript(GetModule(), R"my_module_core");

Modifié par anakin5, 02 janvier 2010 - 01:14 .


#3
SuperD-710

SuperD-710
  • Members
  • 130 messages
Thanks for the help Anakin. Still eagerly waiting for AT2.7 btw :P



*Sigh* Guess I will have to override module_core directly. I only want to handle that event, and changing the single player module event handle looks like it would cause more problems and have even worse compatibilities than overriding the ncs directly :(

#4
anakin5

anakin5
  • Members
  • 258 messages
oh, I missed the solution 4) which is the right one.
Create a file my_module_core which handle only EVENT_TYPE_CHAR_RECORD_OPENED and associate it to your module.
Do not call HandleEvent at the end of this script.

It should work (I read this somewhere on this forum)

Modifié par anakin5, 02 janvier 2010 - 01:35 .


#5
SuperD-710

SuperD-710
  • Members
  • 130 messages
Thanks a lot! Works like a charm :D