CriusX Posted July 3, 2018 Share Posted July 3, 2018 (edited) Has anyone ever had issues with OnPackageStart(), OnPackageEnd() or OnPackageChange() events? For some reason none of these events are ever called in my script. To check that Actor events are properly fired I've added OnCommandModeGiveCommand(), which works without a problem. In addition, I added a timer to poll the information about the current actor's package, to see that packages do change. Here are the relevant parts of the code: Scriptname SomeNamespace:TestScript extends ActiveMagicEffect Actor MySelf int iTestTimerID = 100 Event OnEffectStart(Actor akTarget, Actor akCaster) MySelf = akTarget StartTimer(2, iTestTimerID) EndEvent Event OnPackageChange(Package akOldPackage) Debug.Trace("********* Package changed") EndEvent Event OnPackageStart(Package akNewPackage) Debug.Trace("********* Package started") EndEvent Event OnPackageEnd(Package akOldPackage) Debug.Trace("********* Package ended") EndEvent Event OnCommandModeGiveCommand(int aeCommandType, ObjectReference akTarget) Debug.Trace("******* OnCommandModeGiveCommand event fired. aeCommandType = " + aeCommandType + " akTarget = " + akTarget) EndEvent Event OnTimer(int aiTimerID) If aiTimerID == iTestTimerID Debug.Trace("******* Current package: " + MySelf.GetCurrentPackage()) StartTimer(2, iTestTimerID) EndIf EndEvent The log that was produced: [07/03/2018 - 03:59:42PM] ******* Current package: [Package < (0002A101)>] [07/03/2018 - 03:59:44PM] ******* Current package: [Package < (0002A101)>] [07/03/2018 - 03:59:44PM] ******* OnCommandModeGiveCommand event fired. aeCommandType = 3 akTarget = None [07/03/2018 - 03:59:46PM] ******* Current package: [Package < (0002A101)>] [07/03/2018 - 03:59:46PM] ******* OnCommandModeGiveCommand event fired. aeCommandType = 3 akTarget = [ObjectReference < (FF004CA5)>] [07/03/2018 - 03:59:48PM] ******* Current package: [Package < (000D153A)>] [07/03/2018 - 03:59:50PM] ******* Current package: [Package < (000D153A)>] [07/03/2018 - 03:59:52PM] ******* Current package: [Package < (000D153A)>] Does anyone know or have any thoughts what the problem could be? Edited July 3, 2018 by CriusX Link to comment Share on other sites More sharing options...
Hoamaii Posted July 3, 2018 Share Posted July 3, 2018 Does your OnTimer event trace return? I had trouble with onPackageChange too, but GetCurrentPackage() always returned properly. Are you listening to a specific package or just for packageChange? Link to comment Share on other sites More sharing options...
CriusX Posted July 3, 2018 Author Share Posted July 3, 2018 As you can see in the log, GetCurrentPackage() works fine, it shows that packages change. The events in my script are defined as in the code I posted - no additional logic, just trace. How can you listen to a specific package? [07/03/2018 - 03:59:46PM] ******* Current package: [Package < (0002A101)>] [07/03/2018 - 03:59:46PM] ******* OnCommandModeGiveCommand event fired. aeCommandType = 3 akTarget = [ObjectReference < (FF004CA5)>] [07/03/2018 - 03:59:48PM] ******* Current package: [Package < (000D153A)>] I could use polling using the timer to catch the changes as a last resort, but events are more efficient and clean. Also, it quite bothers me I can't use those events. I believe there are more events that I had issues with during my tests - OnCompanionDismiss() I think was one of them. I also tried to register for package events using RegisterForRemoteEvent() from a different script, but got the same result: OnCommandModeGiveCommand() was called but OnPackageXXX() were not. Link to comment Share on other sites More sharing options...
llamaRCA Posted July 3, 2018 Share Posted July 3, 2018 It sounds like a registration issue to me since Hoamii has confirmed that the events work. If it were me I'd experiment more with registration because1. failed/lack of registration will give you what you are seeing2. We know the package events can/should work because Hoamii has confirmed that It could be a timing issue with the registration. Registration has to take place before the event and some events need a registration each time you want to call the event. To cover both possibilities you might try adding registrations for the package events into the timer to see if it works the next time through the timer cycle. Link to comment Share on other sites More sharing options...
CriusX Posted July 3, 2018 Author Share Posted July 3, 2018 (edited) Thanks for checking this out! In any case, to exclude any possibilities that something went wrong with my mod I created a new clean one, added a fresh quest with one ReferenceAlias to a companion and attached the most basic Papyrus script to it: Scriptname TTMTestScript extends ReferenceAlias int iTestTimerID = 1 Event OnInit() Debug.Trace("*TPE* Alias initialized") StartTimer(2, iTestTimerID) EndEvent Event OnPackageChange(Package akOldPackage) Debug.Trace("*TPE* Package changed") EndEvent Event OnPackageStart(Package akNewPackage) Debug.Trace("*TPE* Package started") EndEvent Event OnPackageEnd(Package akOldPackage) Debug.Trace("*TPE* Package ended") EndEvent Event OnCommandModeGiveCommand(int aeCommandType, ObjectReference akTarget) Debug.Trace("*TPE* OnCommandModeGiveCommand event fired. aeCommandType = " + aeCommandType + " akTarget = " + akTarget) EndEvent Event OnTimer(int aiTimerID) If aiTimerID == iTestTimerID Debug.Trace("*TPE* Current package: " + self.GetActorRef().GetCurrentPackage()) StartTimer(2, iTestTimerID) EndIf EndEvent There is nothing else in this mod. The result is the same as before - packages change, but the defined package events are not called. However, a different Actor event OnCommandModeGiveCommand() is called as expected.Here's the output from the log file: [07/03/2018 - 11:13:14PM] *TPE* Alias initialized [07/03/2018 - 11:13:15PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:17PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:20PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:22PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:24PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:24PM] *TPE* OnCommandModeGiveCommand event fired. aeCommandType = -16777216 akTarget = None [07/03/2018 - 11:13:26PM] *TPE* Current package: [Package < (0002A101)>] [07/03/2018 - 11:13:26PM] *TPE* OnCommandModeGiveCommand event fired. aeCommandType = 3 akTarget = [ObjectReference < (FF0037DA)>] [07/03/2018 - 11:13:28PM] *TPE* Current package: [Package < (000D153A)>] [07/03/2018 - 11:13:30PM] *TPE* Current package: [Package < (000D153A)>] You are saying that the problem could be with the registration. As far as I understand, the registration for package events is not required. How could you register even if you wanted to? Am I missing something obvious? According to the CreationKit wiki: EventsReferenceAliases receive events from the ObjectReference they are pointing at.ReferenceAliases may also receive additional events if they are pointing at an Actor.https://www.creationkit.com/fallout4/index.php?title=ReferenceAlias_Script I've puzzled over this issue for a while and exhausted all my ideas for now. Any help would be appreciated. Edited July 3, 2018 by CriusX Link to comment Share on other sites More sharing options...
Hoamaii Posted July 3, 2018 Share Posted July 3, 2018 yeah, I can see your OnCommandModeGiveCommand event fires it the trace log, but not your "Debug.Trace("******* Current package: " + MySelf.GetCurrentPackage())" unless you removed it from the log you posted here. Not entirely sure here because I never debugged it further than what I needed, but if by any chance, the "OnpackageChange" fires everytime the game register a package change in any loaded actor, sure it'll poll constanty. As far as I can tell, your event is not tied to a specific actor, only to an ActiveMagicEffect. The fact that this magic effect is attached to an actor doesn't necessarily mean the functions you call are called only when that actor's package change, you see what I mean (sorry, no English native speaker here). That's why I was asking if you're trying to track a specific package, or even a list of packages, because that'd make things easier using the GetCurrentPackage() function. And I agree with llamaRCA, it looks like a registration issue. Link to comment Share on other sites More sharing options...
Hoamaii Posted July 3, 2018 Share Posted July 3, 2018 Sorry, I read your log too fast - yeah, your timer does fire. May I ask what you're trying to do here once you've managed to track package start, end or change? Link to comment Share on other sites More sharing options...
CriusX Posted July 3, 2018 Author Share Posted July 3, 2018 It seems we posted around the same time. See post #5. I tried to do the same with ReferenceAlias instead of ActiveMagicEffect. Same problem. It might be that some Actor events are not forwarded as they should (as stated in the wiki). As for your last question, I created a custom Package and I want to know when it finishes to notify other scripts about the event. Link to comment Share on other sites More sharing options...
z4x Posted July 4, 2018 Share Posted July 4, 2018 (edited) OnPackageChange() OnPackageStart() OnPackageEnd()These 3 events are bugged for me as well, definitely it's not something on your end. But I was testing them on RefAlias too so possibly they only work on Actor script(in Skyrim they worked fine on everything btw). Edited July 4, 2018 by z4x Link to comment Share on other sites More sharing options...
Hoamaii Posted July 4, 2018 Share Posted July 4, 2018 I dug into my scripts to double-check but yeah, the only one which actually returned is GetCurrentPackage(), it's almost as if we were missing some RegisterForPackage(Actor akActor, Package akPackage) function!.. Don't use that, ok, that function doesn't exist!.. Have you tried attaching a script directly on the package itself? Link to comment Share on other sites More sharing options...
Recommended Posts