Aller au contenu

Photo

module_core and addins


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

#1
JJM152

JJM152
  • Members
  • 301 messages
Maybe someone can answer this for me -

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
Proleric

Proleric
  • Members
  • 2 362 messages
Strictly speaking, one for the scripting forum, but...

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
JJM152

JJM152
  • Members
  • 301 messages
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.


#4
Phaenan

Phaenan
  • Members
  • 315 messages
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". :blush:

Modifié par Phaenan, 13 décembre 2009 - 12:21 .


#5
Proleric

Proleric
  • Members
  • 2 362 messages
We probably need help from Bioware on this. My understanding, which might be wrong, is that only one module is active at run time, and that this is created by merging resources from the base module with those from any add-ins (following the folder hierarchy rules given in the wiki).

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
JJM152

JJM152
  • Members
  • 301 messages

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". :blush:


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
ladydesire

ladydesire
  • Members
  • 1 928 messages

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.