Needs stations & Game Events - naelstrof/ChurnVectorSDK GitHub Wiki
This page is a dive into the needs stations and how they function in CV plus how those tie into Game Events. A lot of this information is going to be totally unimportant if you aren't doing stuff like cutscenes or spawning NPC's but its worth a read if you are.
The needs station script
Firstly lets take a look at a needs station script. All interaction points that NPC's use are considered a needs station even if its something as simple as standing still at a set point or a button that opens a door.
In the above, we have a couple of fields we can set that allow the needs stations to work. Lets ignore the On Used Responses value for now.
Firstly we have the Ik Targets. This is a list of points that will IK the using characters hands, feet or hips to a transform and is useful for keeping characters extremeties or position in place when an animation might otherwise break them. We primarily use this for the seats and sex stations ingame.
Next we have a bunch of checkboxes
- Hides user - This causes the player to not be detected when they are using this station (this is how the lockers work)
- Escape - This causes the player to finish the map if they use this station
- Requires Primary - This causes the station to not be available until the objectives marked "primary" are completed by the player
Valid groups is a list of which character groups can use a needs station. This allows us to separate characters into areas of the map or limit which kinds of NPC's (such as cops, workers etc) can use a particular needs station. (There are two exceptions to this rule however, doors and elevators, both of which use navmesh links which are where this ignoring the valid groups logic comes from)
Note that this list is OR based, in that if an NPC has ANY of the groups in the list they will be able to use it.
Finally we have the Interactable Controller and the animation transform.
This is the animation controller that is used when the NPC uses the station. The logic in CV is that when an NPC or the player interacts with a needs station, their animation controller is replaced with the one defined here for the duration of the stations usage and reset when they stop interacting with it.
The transform is just, where the animations should move the character to.
Game Events
This is the cool stuff that lets us do things like play cutscenes or spawn NPC's in response to the player (or an NPC) using a needs station. The "Tower" map is a good example of this in action, when the player uses the boss room door it triggers 3 events to happen.
As an example, this is the need station events used for opening a door.
As you can see we have two events, one which causes the doors animator to use an event trigger and one which plays an audio pack at the needs stations location. Very simple yet effective.
This means that if you want to have things like a button that causes something to happen, like a bridge to raise or a window to close, all of this can be done with animator triggers.
Similarly there is a huge list of other events that can be added into the OnUsedResponses list. You can spawn objects, show cutscenes, even pause the game if you want to! This is the real meat of making stuff happen in CV.
If you want to learn how these things work, all of our assets in the SDK have their needs station script attached and accessible to you. This system is exactly how we made the game initially and even how the workshop map "The Farm" has custom animations for the Kobold breeding stations.