module_core and addins
#1
Posté 12 décembre 2009 - 07:49
If you make an addin (just an enhancement to the singleplayer game) and you define your own module_core, do you then need to go ahead and pass along the events that it captures to the actual module_core.ncs file, or will the game send the event to both?
Thanks
#2
Posté 13 décembre 2009 - 11:45
The game will run the module script identified in your module properties.
It's probably best to make a new script, rather than change the default script.
An example of a module script that transfers control to the default script when necessary:
http://social.biowar...cter_generation
Modifié par Proleric1, 13 décembre 2009 - 11:46 .
#3
Posté 13 décembre 2009 - 11:58
I'm asking if the events are sent to both the base module (in my case single player) as well as the module that extends it by default.
so like, is the event chain like this
Event -> module_core -> my_module_core
or is it:
Event -> my_module_core -> (I need to pass it along here to module_core)
There isn't much documentation unfortunately on how the event chain gets processed from the engine.
#4
Posté 13 décembre 2009 - 12:20
I'm not sure it's a chain, tho, I'd have thought it was more like one copy of the triggered event sent to each additional module on the top of the current campaign module.
Either way, one should not redirect event to the module_core after dealing with the events. Doing so would lead to all kind of funky stuff, such as the infamous "double attribute increase".
Modifié par Phaenan, 13 décembre 2009 - 12:21 .
#5
Posté 13 décembre 2009 - 03:04
However, whether I'm right about that or not, the fact that the base module and add-ins can have different module scripts specified begs the question about which one(s) have control.
#6
Posté 13 décembre 2009 - 03:28
Phaenan wrote...
The event are sent to every module currently activated, as far as I understood.
I'm not sure it's a chain, tho, I'd have thought it was more like one copy of the triggered event sent to each additional module on the top of the current campaign module.
Either way, one should not redirect event to the module_core after dealing with the events. Doing so would lead to all kind of funky stuff, such as the infamous "double attribute increase".
There has got to be some kind of chain going on, otherwise events would be broadcast all over the place to things that probably not only wouldn't be listening, but wouldn't even need to... right? Right? RIGHT?
Ugh.. maybe it's a flaw with the game engine (or I should say, design decision) due to the primitive nature of the event signalling.
Anyway, I do know for people who are curious, that you can overwrite the events.2da file to direct an event directly to a specific handler before it gets touched by anything else. I use this handy little short circuit to do some treasure customization without having to touch the built in treasure system.
Still... crazy!
#7
Posté 13 décembre 2009 - 06:47
JJM152 wrote...
No, this isn't what I'm asking.
I'm asking if the events are sent to both the base module (in my case single player) as well as the module that extends it by default.
so like, is the event chain like this
Event -> module_core -> my_module_core
or is it:
Event -> my_module_core -> (I need to pass it along here to module_core)
There isn't much documentation unfortunately on how the event chain gets processed from the engine.
If I'm reading things properly, it's supposed to be the second; addins are checked for a module script, and that script is read and used if it exists. If you don't handle specific events in your module_core, they get passed on the the default one.





Retour en haut






