Talk:RegisterForModEvent - Form

From the CreationKit Wiki
Revision as of 05:32, 17 April 2015 by imported>Darkitow
Jump to navigation Jump to search

On Game Load Requirement

  • "Registrations have to be refreshed after each game load."
  • "You must register for ModEvents after every game load!"

My experience suggests that these statements are no longer true. Additionally, if you change a script after registering, the game will actually prefer the version already in the save over the hard copy.

  • warning: Function dcc_ut_QuestController..OnEncounterEnd in stack frame 0 in stack 629647 differs from the in-game resource files - using version from save

--Darkconsole (talk) 2015-01-23T12:42:27 (EST)

Dinamically creating ModEvents?

Since you gotta specify both the handle and the event name when you register a form for a modEvent, but you only need to specify the event name when you write its code, is it possible to trigger modEvents with the same name using different handles?

For example, let's say that I got a modEvent called "OnSomething" in two different actors:

    event OnSomething()
        ;does things
    endEvent

then I use:

    actor_1.registerForModEvent("something_1", "OnSomething")
    actor_2.registerForModEvent("something_2", "OnSomething")

So, when I call this:

    int handle = ModEvent.Create("something_1")
    if (handle)
        ModEvent.Send(handle)
    endIf

I assume that only the first actor would get the modEvent, even though both have the same valid code. This means I can control whether they get the modEvent triggered, isn't it?