Jump to content

CriusX

Members
  • Posts

    7
  • Joined

  • Last visited

Nexus Mods Profile

About CriusX

CriusX's Achievements

Rookie

Rookie (2/14)

0

Reputation

  1. As I already mentioned, RegisterForRemoteEvents() didn't work for me. I haven't tried to attach a script directly to an Actor, since it would be impractical for my mod.
  2. You can try and find an equivalent Papyrus command. E.g. in place of TCL you can try to use Debug.EnableCollisions(false) inside the ObjectReference.OnEquipped() event. The problem with using a debug function though as in this example is that it will be compiled out of the release archives. Unless of course you don't care about producing a release version.
  3. Thanks everyone for contributing to the discussion! So it seems that the package events are bugged. That's very unfortunate. I can see a couple of workaround solutions to this issue. Use a timer and poll for package changes via GetCurrentPackage(). Attach a proxy script to a package, which will forward the events to some kind of propagator script, which in turn will raise events for any interested subscribers.Since I have full control over my custom packages and I really don't like polling, I ended up implementing the second solution. It's a bit more complex than using a timer, but it doesn't use polling and I receive events only from the packages I want. Here is an example: Proxy Script Scriptname SomeNS:PackageEventProxyScript extends Package {This script is a part of the workaround solution to the package events bug when package events are not called in ReferenceAlias or ActiveMagicEffect. Attach this script to a package from which you want to receive events and set the EventPropagatorScript property. The EventPropagatorScript is the other script in the solution. See its documentation comment for more information.} SomeNS:EventPropagatorScript Property EventPropagatorScript Auto Const Event OnChange(Actor akActor) Debug.Trace("This package finished or was preempted on " + akActor) EventPropagatorScript.PropagatePackageChange(akActor, self) EndEvent Event OnStart(Actor akActor) Debug.Trace("This package started on " + akActor) EventPropagatorScript.PropagatePackageStart(akActor, self) EndEvent Event OnEnd(Actor akActor) Debug.Trace("This package finished on " + akActor) EventPropagatorScript.PropagatePackageEnd(akActor, self) EndEvent Propagator Script Scriptname SomeNS:EventPropagatorScript extends Quest {This script is a part of the workaround solution to the package events bug when package events are not called in ReferenceAlias or ActiveMagicEffect. Attach this script to a quest, which will serve as an event propagator. Packages that you are interested to receive the events from, should contain the PackageEventProxyScript script (see PackageEventProxyScript documentation comment for more information). Then, in any script you can register for custom events defined here and the relevant events will be propagated to that script.} CustomEvent OnPropagatePackageChange CustomEvent OnPropagatePackageStart CustomEvent OnPropagatePackageEnd Function PropagatePackageChange(Actor akActor, Package akPackage) Var[] args = new Var[2] args[0] = akActor args[1] = akPackage sendCustomEvent("OnPropagatePackageChange", args) EndFunction Function PropagatePackageStart(Actor akActor, Package akPackage) Var[] args = new Var[2] args[0] = akActor args[1] = akPackage sendCustomEvent("OnPropagatePackageStart", args) EndFunction Function PropagatePackageEnd(Actor akActor, Package akPackage) Var[] args = new Var[2] args[0] = akActor args[1] = akPackage sendCustomEvent("OnPropagatePackageEnd", args) EndFunction EventPropagatorScript Function GetEventPropagatorScript() global ; Set the quest's FormID and the mod file name to valid values. Return (Game.GetFormFromFile(0x000000, "<ModName>.esp") as Quest) as EventPropagatorScript EndFunction Sample Subscriber Script Scriptname SomeNS:SubscriberScript extends ObjectReference import SomeNS:EventPropagatorScript SomeNS:EventPropagatorScript kEventPropagatorScript Function OnInit() kEventPropagatorScript = GetEventPropagatorScript() RegisterForCustomEvent(kEventPropagatorScript, "OnPropagatePackageEnd") EndFunction Event SomeNS:EventPropagatorScript.OnPropagatePackageEnd(SomeNS:EventPropagatorScript akSender, Var[] args) Debug.Trace("OnPropagatePackageEnd fired. args = " + args) Actor packageActor = args[0] as Actor Package finishedPackage = args[1] as Package EndEvent
  4. 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.
  5. 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: 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.
  6. 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? 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.
  7. 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?
×
×
  • Create New...