Creating your first Cell

From RPG Creation Kit
Jump to navigation Jump to search

In this tutorial we're going to create a new Cell, in particular, a new Interior Cell. It will represent the Interior of a shack situated in the Cell "Virrihael(0,-2)", that will be owned by the NPC "Uriel" we've created in the NPCs Creation tutorial.

Primer on Cells

In this section we're going to quickly analyze how a Cell is composed.

Focus on the "Cell View" window and select as Worldpsace "Virrhael", then load the Cell with ID "Virrihael(0,2)".

The first thing that you should notice straight away, it's that it is the Cell present in the demo, and more in particular it's the house we go and search with Ryan in the Demo, during the quest "The Southern Harvest", playable by joining The King's faction. You can notice it is an Exterior Cell, because it's a Cell that is a tile of a bigger world.


Let's take a look in the Hierarchy. Every cell is composed of at least those GameObject:

  • CellInfo: Contains the script responsaible for storing the Information of a Cell, such as the Cell file, the Cell Entry, all the doors, paths, Action Points etc. present in the Cell.
  • Entry: Represents the Entry Point of the cell, it is usually always in the middle of it.
  • Structures: Is just a GameObject that contains every structure of the Cell, such as houses, Items in World, props and so on and so forth.
  • Paths: Contains all the NPC Paths present in this Cell.
  • AI_Container: Contains all the AI placed in this cell.
  • CreatedItemsT: Is just a GameObject that will contain every item the Player will create inside this cell by dropping them into the Inventory or dragging them to this cell from others.
  • Navmesh: Is the GameObject who has the Component responsabile to generating the Navmesh of the cell.


Now I want to say something that you should take as a rule, you should always have few GameObject in the root of your scene. Just as it happens here, the scene is composed of 11 "father" GameObject, and every other GameObject is a child of one of those 11. You should always keep your "father" GameObjects count low and put everything else inside them, for both having the Scenes tidy and ordered but most importantly because some Editor code will reference to that, and the loading times for some action will take longer if the Scene is disorganized.

Doors and Cells

The Door inside the "Virrihael(0,2)" cell that will bring the Player into another Interior Cell.

Great, now if you take a closer look at the Cell, you will notice that on the House's door, there is a white box with an arrow. You're in the presence of a Door, a connection between Cells and Worldspaces. Every Door has a white box that represents where the Player or NPC will spawn when the opposite door is used. That is the "Door Teleport Marker". Make sure to read the Door article before going forward.

Now click on the door and take a look at the "Door" component.

We're interested in the "Door Teleport" section, you can see that this door is used to Teleport who uses it to another Cell, and this cell is "[CELL] Virrihael02_VerasFarmhouse".

Now look at the bottom the "Door Link" section, here you'll see (and set) what is the opposite door, what is its ID and if you click on "View Linked Door", the Editor will open the connected Cell and bring you immediatly there.

The connected Interior Cell to the door we've analyzed, loaded in the Editor with the "View Linked Door" button.


Perfect, we're able to switch back and forth Cells & Worldspaces. Notice that in the Interior Cell the structure is the same, there are few father GameObjects and everything is else is a child of them.

Play a little bit with it, maybe load the cell "Virrihael(0,0)" go in the City and try to enter a few Interiors.

⠀⠀

⠀⠀

⠀⠀

⠀⠀

Creating a New Cell

In this section we will actually create a new cell, there are two ways you can do that, creating a new cell from scratch or duplicating an existing one.

I'm gonna show here how to do it by duplication, since it will allow us to already have the house interior 3d models and collisions.The Cell we are going to duplicate is the Inteiror we just saw, the "Veras Farmhouse".

The Project Window with the duplicated assets.

Find the "[CELL] Virrihael02_VerasFarmhouse" file in your project and duplicate it with CTRL+D. Duplicate the scene as well and rename both files with meaningufl name, mine will be "UrielsShack".

Now click on "[CELL] UrielsShack" and focus in the Inspector.

Set the ID, I'll have it to be "UrielsShack", then the Name, I'll have it "Shack", then assign the Scene Ref to the scene you've duplicated.

You'll have the message: Crfy 001.png click on "Add (buildindex)" and then select "Add as Enabled". The dot should display a green light.

The Worldspace file with the new UrielsShack cell added to it.

Perfect, now we need to select the Worldspace of this Cell, in this case it will be the Interiors Worldspace that is already selected, so no further action is required, but we need to let know to the Worldspace that this Cell has been added to it, so find in the Project the file "[WORLDSPACE] Interiors Worldspace" and under "Cells" add a new element and select the "[CELL] UrielsShack" we just created.


If everything went alright, in the Cell View if you select as worldspace "Interiors" you should see the UrielsShack cell, and if you double click on it it should open the Scene we've duplicated.

Cebnsfjjb 01.png


Cleaning and setting up the new Scene

Open the UrielsShack we've just created and now we have to clean it up a bit, because it contains some stuff that shouldn't be present there.

First of all, delete the "QUEST_RELATED" GameObject, as it contains elements for the quest that happens inside the original Cell we've duplicated this from. Then delete the GameObject "QI_HalfWrittenNoteInWorld", as it is a Quest Item that will make a quest progress. Last thing you want to delete are the AI present in this Cell, open the "AI_Container" GameObject and delete both "[AI] DeadGuard001_01" and "[AI] DeadGuard002_01".


Now, select the "CellInformation" GameObject and in the Inspector assign the Cell to be "[CELL] UrielsShack". Still in the CellInformation, click on Update Cell and then on Regenerate All Items GUID. The first one will update the cell, the second button will make the Items In World that are present in this scene unique and they will become not related anymore to the one existed in the original Cell we've duplicated this from. If you miss this step, taking an Item from one interior will make it disappear also in the other interior.


Once you did that, the Cell is setup and now you just need to link it with a Door.

Creating a Door and Linking the Cells