Changing the New Game Starting Location
In this article we are going to see how to change the Starting Location the player spawns in when you create a New Character in the RPG Creation Kit.
Instead of spawning outside the City gates, we'll make our player spawn in the Tavern.
Locating the Settings
What we need to do is pretty simple and requires a small edit to a file.
Open the file RCKSettings.cs located in your project folder and locate the line:
// NEW GAME START
The field are pretty much self explanatory:
- RCK_NEW_STARTING_LOCATION: Is the name of the location the player will spawn in. This is not as important as the next fields, and will be used only to display the location of the player in the Load/Save interface.
- RCK_NEW_STARTING_WORLDSPACEID: This field is fundamental, it will be the ID of the Worldspace you want your players to spawn in. For the demo, the player spawns in the exterior worldspace, hence the ID is "VirrihaelWorldspace".
- RCK_NEW_STARTING_CELLID: This field is also fundamental, it will be the ID of the Cell that belongs to the worldspace we've referenced before. For the demo the Cell the player spawns in have as ID "Virrihael(0,1)".
- RCK_NEW_STARTING_LEVEL: Is the Level the player starts at. It's not useful for our purpose here.
- RCK_NEW_STARTING_POS: Is the position the player will be at the start of the game.
- RCK_NEW_STARTING_ROT: Is the rotation the player will have at the start of the game.
Locating the New IDs
To know the IDs we need to insert, you just need to look at the tavern cell in your project. The file is named " - [CELL] VirrihaelsTavern" and it looks like that:
We can quickly see that the ID of this cell is VirrihaelsTavern, and it's Worldspace is "Interiors Worldspace" which its ID is "Interiors" (you can double-click on the "[WORLDSPACE] Interiors Worldspace" reference to focus on that and see the Interiors ID).
All that is left to know is the position and rotation you want your character to start in. To know that you can simply load the Tavern cell from the Cell View and place an empty GameObject on the location you want your player to start in, just take note of its Position and Rotation, mine will be:
Editing the RckSettings.cs
Now we can edit the file! Just replace the values with the new information we've obtained:
And that's it! The player will now spawn in the Tavern instead of the exterior world.
Extra: Starting Quest not starting?
I want to take the occasion to explain how the main quest starts, and in general what is one of the many ways you can start your game.
It's pretty simple, on the original spawning location there is a Goto object (called FirstMainQuest_Goto), which is just an object with a Trigger Collider that triggers Events and Consequences when the player enters that collider. In this case, the Goto has a Quest Dealer, that allows the player to receive a quest when he enters that collider. The Goto object has been placed such that as soon as the Player spawns he will be inside the collider, hence, the main quest will start.
You may have noticed that FirstMainQuest_Goto is contained inside a Mutable, this is done to ensure that once the Goto has been activated once, it will never be present again, not even when we reload the savegame. To know more, read the Mutable page.
So to complete our edit you can move the Goto (and its mutable) inside the Tavern. Remember that when changing things like Mutables, AI, Doors etc. you always have to update the cells in the CellInfo Object in your scenes.