Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Time to add some of Geralt’s best friends to our world. Monsters!
If you are completing our tutorials in order, by now you should have your own world and in it a very basic quest structure set up with Roach spawning in the middle of the level. Now we will add some more creatures to our world. These will however not be as friendly as our loyal steed.
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Encounters vs CommunitiesBoth Encounters and Communities are valid ways to spawn NPCs, but they each have their own strengths and weaknesses.
|
1. Create a new group and layers
Open your test World level from the previous tutorial or load an other existing world. In the Scene Explorer make sure to load in all the files: right click on World icon and Load all in group. You can also use just the living_world folder.
The folders which you selected should change their colour to signify that files have been loaded.
Before you can set up an encounter, first you need to create a new layer in the world.
In the Scene Explorer, right click on the folder you want the layer to belong to (in our example living_world group > monsters) and choose Add layer. Enter a name for the layer and select a Quest orCommunities Build Tag and a Non-static (dynamic entitities) Type.
Info |
---|
To create anew “group” (folder) in the Scene Explorer, right click on the parent folder and choose Add group to create it. |
2. Add Encounter Area
You need to let the game know where the encounter should take place. This can be done by adding an Encounter Area.
First select your encounter layer in the Scene Explorer. Now right click on the main editor screen and from the context menu choose Gameplay > Area > Add Encounter Area.
A blue rectangle should appear on the level.
As previously seen with the Spawn Area, you can now Move, Rotate or Scale the Encounter Area. Use the Scale tool to make the area larger.
Note |
---|
The NPCs spawned by the encounter will spawn when the player enters the area, so make sure the area is big enough. |
Note |
---|
Move the Encounter area a few meters underground so that you do not see the bottom borders above the ground anymore. The Encounter Area checks the height of all actors within it: if SpawnPoints or Guard Areas happen to be slightly below it the bottom of the blue Encounter Area, it might disregard them. |
3. Encounter properties
The encounter needs a tag by which you can easily reference it later.
Select the Encounter layer in the Scene Explorer, go to its Properties column and open the CNode. In the tags add a name for your encounter. Since we’re planning a wolf encounter, we went with enc_wolves.
4. Open the Encounter Editor
There’s two ways in which you can open the Encounter Editor.
Either Right clicking the Encounter and choose Edit Spawn Treeor find the spawnTree inProperties, select it and then press the little tree icon (🎄) on the right side. This will open the Encounter Graph.
Info |
---|
Spawn Trees specify what is supposed to spawned and at which location. |
This will open the Encounter Editor.
As you can see, the enc_wolves tag is there, but the Encounter Graph (green area) is empty.
5. Edit the Encounter Graph
Right click on the green graph area and choose Add SelectPhase. Now press the three dots which will generate the basic start for the encounter: a Default Phase. By right clicking on the Default Phase None node you will see there are many available options.
For the purpose of this tutorial we are going with the Include File option.
(If you want to have more than one phase for the encounter, it’s recommended to rename the Phase. You can drag additional phases from the SelectPhase nodes output.)
Include File - this node will use a previously made Spawn Tree inside the Encounter. This is a simple way to quickly create encounters based on templates that have been set up by the game’s developers. You can find some commonly used ones in living_world\event_templates\encounters\aproved_templates.
Please note that you cannot edit the setting of that Spawn Tree inside this encounter, so you will have to use the same tags in your Spawn Points, Guard Areas, etc. (the Encounter only checks Spawn Points and Guard Areas within its area so there shouldn’t be issues with duplicated tags - as long as you don’t overlap many encounters with the same exact included spawn trees).
You can find definitions of some of the other options below:
Expand | ||
---|---|---|
| ||
|
6. Include an existing Spawn Tree
Let’s include an Existing Spawn Tree by using Add Include File and choosing this file:
living_world\event_templates\encounters\aproved_templates\wolves\wolves_level_5_alpha_level_5.spawntree
You need to find it in the Asset Browser and then press the ⬅️ icon in the Encounter Editor.
Once the Spawn Tree is loaded you can see all its elements.
Notice that is has a TopInitializerList - this allows us to add different properties to this particular branch of the encounter, the blue nodes. The SpawnEntries (green nodes) on the other hand spawns the specified NPCs.
7. Adding NPCs
As you can see at the bottom of the graph, there are two different green NPC Entry nodes (Entry alfa wolf_level1 and Entry wolf_level1).
Both need to be added to the Encounter. Click the icon at the bottom of the Encounter Editor to add a new entry and fill out their names according to what the names in the existing nodes.
Note |
---|
Please note that the “alfa wolf_entry1” has a space after the first word. The names need to exactly match the names on the nodes in the graph. |
Once we have the NPCs name copied correctly, it’s time to add an Entity templates in the next column. We can use the two different types of wolves found in the characters\npc_entities\monsters\ folder.
characters\npc_entities\monsters\wolf_lvl1__alpha.w2ent
characters\npc_entities\monsters\wolf_lvl1.w2ent
Once you find these two files in the Asset Browser, select them and then click the green arrow back in the Encounter Editor / Entity Template box.
8. Adding Guard Area and Spawner
The graph and Initializers suggest you need to add aGuard Area and at least one Spawner to your level.
First, create a Guard Area on the level.
Select your Encounter layer in the Scene Explorer. Now right click on the main editor screen and from the context menu choose Gameplay > Area > Add Guard Area. Once it’s on the level, scale it and add a Tag - it should be the same exact tag that is set in the “Guard Area by Tag” node in the encounter graph.
Note |
---|
Make sure to add the tag to BOTH of the CNodes - tags properties, not just the top one. This is something to keep in mind universally while working with REDkit: always add tags to both of the tags fields. |
Now, in the same way as with Guard Areas, let’s add some Spawn Points (Gameplay > SpawnPoint > Add Spawn Point).
Note |
---|
Remember to add the same exact Tags to |
SpawnPoints as |
you did in the Encounter Graph. |
Info |
---|
In order to see SpawnPoints you need to have enable the Waypoints debug filter. Find out how, here: HOW-TO: Change display settings. |
9. Done!
You should be all set. Go back to the Editor and start the level. Once in the game, the wolves will spawn and guard the areas you created!
Remember that an Encounter begins once you enter the area.
Good luck!
Info |
---|
If fighting monsters or wolves is slowing down your work on a new quest and you want to get rid of your opponents quickly, you can eliminated them quicker by using the Marauder’s Map tool! |
Controlling Encounters
You can also control the encounter via the Quest graph and the Gameplay > Encounter Manager node. This is only needed if you want to dynamically enable/disable the encounter or change its phases.
Further editing Encounter properties
If you want more control over the settings in your encounter, then you need to create the nodes by yourself. The Include File method, as we mentioned before, has limited edit options for existing templates.
However you can still use Include File option, load an existing graph and create your own Encounter Graph in parallel with any settings you like. When you are done, simply delete the Include File. As always, the best way to learn is to search for some existing examples from the game.
By now you should have already finished these tutorials:
Table of contents:
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|