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 and load all files in 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).
The folder you selected (living_world folder which we if you were previously using it for our Roach Roach’s spawn area in the previous tutorial) should change its colour to signify that files have been loaded - you can now also see the spawn area in the editor screen.
Image RemovedSelect the living_world group and right click the monsters folder .
Image AddedBefore 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.
Image RemovedImage AddedA 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.
Image Removed3. Add Spawn Point
In the Scene Explorer select the monsters folder. Right click and Add layer.
Let’s name it foglings and select the Non-static layer type.
Image RemovedNow select the new foglings layer. In the Editor main screen, inside the Spawn Area, right click to open the context menu. Choose Gameplay > SpawnPoint > Add Spawn Point.
A new Spawn Point, the spot where monsters will spawn and start roaming the Spawn Area, should now be visible. It’s automatically named spawnpoint0.
Image RemovedSelect spawnpoint0 in the foglings folder in the Scene Explorer and go to its Properties tab.
Find the CNode and in tags enter a name: fogling_sp_1. We will refer to it in just a moment so copy (CTRL+C) the tag name.
Image Removed4. Encounter Editor
Encounters also use graphs which consist of many Spawn Trees.
To open the Encounter Editor: right click on the encounter0 (CEnounter) file (in the encounter layer folder) and choose Edit Spawn Tree. Spawn Trees use a table in which we need enter information about the entities which will be spawned during the encounter.
Image RemovedNote |
---|
The NPCs spawned by the encounter will spawn when the player enters the area, so make sure the area is big enough. |
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.
Image Added4. 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 where. |
To add a Spawn Tree table press the icon and let’s start filling it with information. First: Definition name: fogling_lvl3.
Image RemovedNow we need to find an Entity Template in the Asset Browser. Search for fogling in the top-right corner and among the search results choose fogling_lvl3_willowisp Entity Template.
After selecting the file click on the green arrow (←) in the Encounter Editor to import the file.
Image Removed5. Insert a Spawn Tree
Now let’s move to the Spaw Tree’s graph which is built in a similar fashion to the Quest Editor’s graph: be connected different types of nodes.
Right-click on the graph and AddSelectPhase. Then click the three dots which will add a DefaultPhaseNone - this where the encounter will be enabled. Right click on the new Default Phase None node and choose Add Condition.
Info |
---|
Phases and encounters are initiated in the main quest graph. |
Now right click the Condition node and Add Include File.
It will turn up a new Include EMPTY node, but worry not. We will solve this problem by using an existing, defined spawn tree.
Image RemovedFind the foglings_level_25 Spawn Tree in the Asset Browser and select the file.
Back in the Encounter Editor, choose the Include EMPTY node and look to the top-left corner to see it’s properties. Go to spawnTree (CSpawnTreeIncludeTreeNode) to import an existing Spawn Tree file.
As usual, select a file in the Asset Browser (like: fogling_level_25 Spawn Tree) and press the green arrow icon (←) to import the ready Spawn Tree.
Image RemovedImage RemovedThe node previously name Include EMPTY will change its name.
Press the three dots to see the complete Spawn Tree which we will use (without going into too much detail).
Image Removed6. Edit the Spawn Tree
Guard areas and spawn points are referenced by tags.
To see how it works, select the node at the top of the Spawn Tree (TopInitizersList) and look to its properties. The guardAreaTag is lw_ga_foglings_group1. Now select the Entry fogling_lvl3 (1-2) node and notice how the tags are referenced in the baseSpawner property.
We will change this tag at its source.
Image RemovedGo back to the Asset Browser.
Find and open the Spawn Tree file (fogling_level_25) which we used earlier. This will open the Spawn Tree Editor.
Info |
---|
The foglings_level 25 Spawn Tree needs to be unlocked by either copying the Spawn Tree file to a different location or by right clicking the file in the Asset Browser and selecting the „Checkout” option. |
Now select the Entry fogling_lvl3 (1-2) node and find its baseSpawner property. Open it and change tags (from lw_ga_foglings_group1) to our previously created fogling_sp_1 Spawn Point. Save your changes.
Image Removed7. Add a phase setter to the quest graph
Okay. We have our encounter’s area and monster spawning set up. Now we need to add another node to our world’s main quest file.
Let’s find it in the Asset Browser (should in our world’s main folder) and open it.
Info |
---|
We will continue to edit the Quest Graph built in the previous tutorial. If you haven’t yet completed it, please take a look at HOW-TO: Make a new world come alive. |
In the Quest Editor this is how our Quest Graph should look up to this point.
Right click on the background to add a new node: Gameplay > Story phase setter which will reference a community file.
Image RemovedConnect the new node (Story phase setter) to the Pause node’s socket.
Select the Story phase setter node, go to its properties and in the CQuestStoryPhaseSetterBlock category find spawnsets and add a new one.
In your new spawnset (“0”), expand the list of classes (🔻) and select the CActivateStoryPhase class.
Image RemovedAfter selecting the class for our spawnset, we can import an existing community file.
Find the q402_folings02 community file in the Asset Browser, select it and click the green arrow to import it.
Image Removed8. Edit the Community file
As we choose to use an already defined Community file we need to make slight alterations so it fits our quest and references to correct tags. This will establish a connection between our quest graph and the encounter graph.
Open the q402_folings02 community file from the Asset Browser. This will launch the Community Editor. We need to define two main values in the Spawnset table.
Image RemovedFirst, the Story Phase Name of the phase in which we want our foglings to spawn.
We can use the name Default.
Image RemovedNow take a look back in the Quest Editor.
Select the Story phase setter node so you can check which phase is defined by this node. It should load the name which you entered just a moment ago in the Community Editor Story Name Phase field (“Default”).
Image RemovedNow we need to set the spawn point tags which define where the NPC will appear.
First go back to the main Editor and find the spawnpoint0 on the file/layer list in the Scene Explorer. Go to properties and check the name of the tag in CNode - which in this tutorial should be fogling_sp_1.
Copy the name and paste it in Community Editor, in the Spawn Point Tags column.
Image Removed9. Test the encounterat 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.
Image Added5. Edit the Encounter Graph
Right click on the green graph area and choose Add SelectPhase. This will generate the basic start for the encounter with a Default Phase.
If you only 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.
Image AddedBy right clicking on the Default Phase None node you will see there are many available options.
Image AddedInclude 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).
Include File is the option we are going with for the purpose of this tutorial.
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
Once it’s there, you can expand the Include node by clicking on the dots at the bottom.
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.
Image Added7. 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.
Image AddedNote |
---|
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. Image Added |
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.
Image Added8. Adding Guard Area and Spawner
The graph and Initializers suggest you need to add aGuard Area and at least one Spawner to your level.
Image AddedFirst, 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.
Image AddedNote |
---|
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).
Remember to add the same exact Tags to them as is in the Encounter Graph.
Image Added9. Done!
You should be all set. Go back to the main editor, make sure to choose the correct game definition file and then press the Play the game from game definition button (🕹️ ).
Image RemovedWhen Once you start your level in the game loads, you should see the Foglings in the distance.When you approach them the true “encounter” begins - good the wolves will spawn and guard the area you created!
Image AddedRemember that an Encounter begins once you enter the area. Good luck fighting your enemies!
Image RemovedYou can now try following the same steps from this tutorial but with slight alterations: adding different monsters, more Spawn Areas etc.
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.
Image AddedAdjusting 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 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|