FYI for "Loading" Characters in 0.17.3 CSC and Beyond

General discussion of the House Party CSC, or get help making your own story.
Forum rules
Please follow all Eek! Forum rules.
Locked
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

FYI for "Loading" Characters in 0.17.3 CSC and Beyond

Enabling/Disabling NPCs

I will eventually add this to the tutorial series when time allows.
For additional detail, refer to the second post below.
For an example of this new system in action, refer to the third post below.
For known issues regarding Enabling/Disabling NPCs, refer to the fourth post below.

As of 0.17.3, you will need to Enable NPCs before you can make use of them, as NPCs start the game Disabled and do not actually "exist" in the game world until your story scripting tells them to. In other words, you will need to Instantiate them.

If you do not Enable them at the beginning of a game (or before they are needed), you will not be able to control or affect them with many of the Game Events available in the CSC (for more on this see the 2nd post below). They will not be visible to the Player or other Characters, and will not be able to interact with the Player, other Characters, or game world.


Why is this system in place now? To improve performance. Having fewer Enabled NPCs improves load times, frame rates, etc.

The Player never needs to be Enabled. This only applies to NPCs.

So how do we Enable an NPC? With one of two Game Events: EnableNPC, or EnableNPCAsync.

EnableNPC: Immediately Instantiates an NPC. This will cause a noticeable hiccup in game play. It's recommended that you only use this event at the start of the game (as a Game Start Event; see 1st picture below). The LOADING... screen and built-in Fade In transition into the game world will hide any hiccups caused by using this Game Event. Tip: a Fade In Game Event followed by a Fade Out Game Event 3-4 seconds later can also be used to mask hiccups.

EnableNPCAsync: Asynchronously loads the data for an NPC and finalizes Instantiation once this is completed. Results in a noticeably smaller hiccup, if any at all, but can result in strange visual behavior if performed while the Player can see the NPC loading. Should be used while an NPC is offscreen or during a Fade In/Fade Out sequence of Game Events.

How do I Disable an NPC?
Do I really need to Disable them, or, why would I want to?
Can I still warp NPCs to the loading dock to hide them?


You can Disable NPCs with the DisableNPC Game Events. This will immediately Disable the NPC.
You do not NEED to Disable them at any time, but disabling NPCs improves application performance and to a large degree ensures that that NPC can never interfere with your story again, with a few exceptions.
Yes, you can still warp NPCs to the loading dock to temporarily hide them. Note that you cannot do this if they are already Disabled.

So I can just use one of the two Enable Game Events above and start doing story stuff with NPCs?

For some stories (or at least those in the midst of being developed), yes! Once an NPC is enabled, you can go nuts and that NPC will do anything any Game Event tells them to. For simpler stories where all Characters are meant to be present at all times, all you should need to worry about is using EnableNPC as a Game Start Event (found in the Story Script object dropdown), like so:

https://imgur.com/lptyU7L
Image

Is there anything else I should be aware of?
Yes. For those of you constructing larger stories or who will have Characters that show up "late" to the party and/or who anticipate enough game play or scene diversity to make saving and loading a likelihood, there's more. More more more...continued below.
Image
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: FYI for "Loading" Characters in 0.17.3 CSC and Beyond

Enabling/Disabling NPCs, Cont. (2)

Enabling an NPC Will Attempt to Fire Any and All Game Start Event Triggers for that NPC Automatically Upon Completing Instantiation.

An NPC Will Not Fire Game Start Event Triggers if they are Disabled

The "New Game" Criteria Only Applies the First Time a Story is Started by the Player. It has nothing to do with an NPC being Enabled.

Enabling/Instantiating an NPC Does not Count as "New Game" for that NPC. When Enabled an NPC has their "RanStartEvents" property set to True. Once flagged as True, this Property will Never be False Again Unless Manually Adjusted.

There is a new State that can be used to check if an NPC is Enabled. It's...well...State : Enabled.

Because of these facts you may need criteria controls on both your Game Starts Events Game Events as well as your Event Triggers in the Character Story object/file, because you might not want:
  • an EnableNPC event firing every time a Story is played (whether it be a new game or loaded save)
  • a Game Start Event Trigger firing every time you Enable an NPC, if you plan on Enabling them more than once
  • an NPC to perform a certain set of events any other time except for the FIRST time they were Enabled
One additional fact:

NPCs that are Disabled can Only Make use of Certain Game Events such as Event Trigger, Modify/Match/Combine Values, State, Property, Roaming, and Select Others. No Game Events that affect motion, location, animation, intimacy, etc. will affect a Disabled NPC.

This means it is especially important to have your NPCs Enabled BEFORE they are truly needed. This is especially true if using EnableNPCAsync. You should either tie in certain events to their Game Start Event Trigger to ensure that those events only occur after Instantiation is complete, or ensure that you give several seconds of delay before pointing certain Game Events at that NPC.

So what does this all look like in practice? Let's take a look at Vickie in the Original Story in the next post...
Image
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: FYI for "Loading" Characters in 0.17.3 CSC and Beyond

Enabling/Disabling NPCs, Cont. (3)

Let's start with a complex example by looking at Vickie's handling in the Original Story. She starts the game Disabled. Looking at the Game Starts Events that relate to Vickie, we see:

https://imgur.com/FMq2uK8
Image

Vickie is not enabled via a Game Starts Event, but she does have a Game Event that performs an Event Trigger whenever a New Game starts. This Game Event and the Event Trigger (note that its type is "Never") it calls are entirely separated from her being Enabled/Disabled, and sets up some behaviors that we always want to take effect at the start of a New Game and that will be modified later on:

https://imgur.com/gwtWqqM
Image

At this point Vickie is still Disabled. Saving and Loading this game will not result in the above Game Starts Event or Event Trigger firing ever again. Her other Game Starts Event Triggers will not fire either, because she is Disabled. Everything is as it should be until we Enable her. That occurs after a Katherine dialogue, like so:

https://imgur.com/uXCgyX2
Image

https://imgur.com/uaECkH3
Image

So once VickieEnterPartyTrigger fires, she is Enabled via EnableNPCAsync and is successfully Instantiated a few moments later. Once she is Instantiated by the EnableNPCAsync Game Event, the game will attempt to fire any and all of her Game Starts Event Triggers (remember the VickieNewGameStart Event Trigger was really a "Never"-type; it does not count):

https://imgur.com/ZRSBPUv
Image

https://imgur.com/JmIwmB7
Image

https://imgur.com/6YNWzbr
Image

Each of these has a different function:

The first, VickieOnEnable, will only fire if her Property "RanStartEvents" is False. The only time this can be False is if she has never been Enabled before. So this event is used to handle her Spawn Point Location (moving her to the Loading Dock) at the moment of her FIRST Enabling/Instantiation, to ensure she is in the Loading Dock before the delayed Game Events in VickieEnterPartyTrigger move her to the party.

The second, VickieAnyGameStart, applies some generic Roaming restrictions to Vickie that we know we can apply every time the story/game starts. This Event Trigger has no "parent" criteria, so it will fire every time the story/game starts and Vickie is Enabled.

The third, VickieAnyGameStartsIfEnabled, handles some Game Events that are only to be considered if Vickie has ALREADY had her "RanStartEvents" property set to True and is already Enabled. So, these are events that should be fired at the start of a loaded save/load game.

Hopefully this gives you an idea of how to structure story scripting for Characters that are not immediately Enabled at the start of a New Game, and that might not Enabled before a user has the chance to Save and Load the game.

Things are much simpler for Characters that are meant to start the game Enabled. Let's look at Patrick. He is Enabled via a Game Start Events Game Event:

https://imgur.com/MuH80XZ
Image

This will fire if the Player is starting a New Game, and then once he is Instantiated, one of two Game Event Triggers (PatNewGameStarts or PatAnyGameStart) will fire:

https://imgur.com/yategta
Image

PatNewGameStarts will only fire in the case of a New Game, and sets up his periodic Event Trigger states, values, and fires his SpawnPointDecider. PatAnyGameStart contains events that are tailored to help in Save/Load game situations, and will fire, much like VickieAnyGameStart from above, any time a game starts and Patrick is already Enabled.
Image
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: FYI for "Loading" Characters in 0.17.3 CSC and Beyond

Enabling/Disabling NPCs, Known Issues (4)
  • In 0.17.3, using EnableNPCAsync with male NPCs can cause issues with their penis rotation and alignment. For male NPCs it is recommended that you always use EnableNPC instead, until this issue is fixed.
Image
Locked