Jump to content

Fallout 4 Papyrus Events - To Register or Not to Register


Recommended Posts

I am posting so that this comes up in search results since I was searching for information about this and there was next to nothing and some information was wrong. I apologize it this seems redundant. Just doing my good deed.

 

 

Fallout 4 Script Events - Registering

 

The official wiki explains some information about events:

https://www.creationkit.com/fallout4/index.php?title=Category:Events

What it doesn't say is that some events need to be registered inside an OnInit() event (or some function/event that runs) first and other events don't.

 

OnHit() for example requires RegisterForHitEvent() - Critical information missing from the wiki page.

https://www.creationkit.com/fallout4/index.php?title=RegisterForHitEvent_-_ScriptObject

 

OnPlayerSleepStart() and OnPlayerSleepStop() require RegisterForPlayerSleep() - Actually mentioned in the wiki page.

https://www.creationkit.com/fallout4/index.php?title=OnPlayerSleepStart_-_ScriptObject

 

These registrations are one time only. Registering again is required if you want the event to happen again. So for example in the OnHit() event you can add in RegisterForHitEvent() to make it possible for future OnHit() events to happen.

 

 

Fallout 4 Script Events - Registering Not Needed

 

I had to dig for these details but eventually figured things out (experienced with creating Skyrim mods). What prompted me to post this was OnPlayerSwimming(). How do I register this event? There's no register function/command. The wiki says nothing. There's very little info online.

https://www.creationkit.com/fallout4/index.php?title=OnPlayerSwimming_-_Actor

 

OnPlayerSwimming() is not registered. Instead you can only use it in a script attached to the player. For example a Quest Alias pointing to the player, with the script added to the Quest Alias. It then just fires when you get in the water (twice in fact, how odd).

 

OnEnterSneaking() is the same way. There's probably a ton of events not even player or actor related that do and do not need to be registered.

 

 

Bad Information

 

Game.GetPlayer().isSwimming() does not exist in Fallout 4. Some sites say you can do this. They're wrong that's Skyrim.

 

 

 

Feel free to add or correct any details. Hopefully people will see this in their search results when looking up these commands. They are not well documented.

Link to comment
Share on other sites

 

 

Fallout 4 Script Events - Registering Not Needed

 

OnPlayerSwimming() is not registered. Instead you can only use it in a script attached to the player. For example a Quest Alias pointing to the player, with the script added to the Quest Alias. It then just fires when you get in the water (twice in fact, how odd).

 

 

 

Both the FollowersScript and the HC_ManagerScript register for OnPlayerSwimming() using:

 

RegisterForRemoteEvent(PlayerRef, "OnPlayerSwimming")

Link to comment
Share on other sites

 

 

 

Fallout 4 Script Events - Registering Not Needed

 

OnPlayerSwimming() is not registered. Instead you can only use it in a script attached to the player. For example a Quest Alias pointing to the player, with the script added to the Quest Alias. It then just fires when you get in the water (twice in fact, how odd).

 

 

 

Both the FollowersScript and the HC_ManagerScript register for OnPlayerSwimming() using:

 

RegisterForRemoteEvent(PlayerRef, "OnPlayerSwimming")

 

 

It should be noted for clarification that this is because those scripts are not directly attached to the actor. If the script is attached to the actor and extends actor, then they don't have to register because they will automatically get it being an actor script. If however you wanted to get the OnPlayerSwimming event from a script that does not extend actor and is not directly attached to the actor then the registration for remote event is required.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...