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.
1. Create a new group and layers
Open your test World level and load all files in the Scene Explorer (right click on World icon and Load all in group).
The living_world folder which we were previously using for our Roach spawn area should change its colour to signify that files have been loaded - you can now also see the spawn area in the editor screen.
Select the living_world group and right click the monsters folder and choose Add layer.
Enter a name for the layer and select a Quest Build Tag and a Non-static (dynamic entitities) Type.
(If the monsters group doesn’t exist in your project, don’t worry, right click living world 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.
3. 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.
Now 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.
Select 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.
4. 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.
Info |
---|
Spawn Trees specify what is 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.
Now 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.
5. 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.
Find 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.
The 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).
6. 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.
Go 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.
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.
7. 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.
Connect 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.
After 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.
8. 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.
First, the Story Phase Name of the phase in which we want our foglings to spawn.
We can use the name Default.
Now 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”).
Now 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.
9. Test the encounter!
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 (🕹️ ).
When the game loads, you should see the Foglings in the distance.
When you approach them the true “encounter” begins - good luck fighting your enemies!
You 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 is slowing down your work on a new quest and you want to get rid of your opponents quickly, you can eliminated them using the Marauder’s Map tool! |
By now you should have already finished these tutorials:
Table of contents:
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|