Sharks

From CryWiki

Jump to: navigation, search
About
Author Not specified.
Skill Level Not specified.
Compatibility Not specified.

Welcome to the CryWiki tutorial for adding sharks to your map. This article will show you how to assign your sharks to a certain area along with creating the simple flowgraph required for the sharks to spawn correctly.


Contents

Setting Up The Shark Area

To start off proceedings, we need to create an area for the sharks you add later on in the article to roam around and attack in when you enter. To do this, we need to create an AreaShape. This is found in the RollupBar → Area → Shape, as shown in the picture below.

You should see the X,Y and Z axes appear on your screen under the sea. Make sure that Snap To Terrain is selected (Ctrl + 1) so that you dont place your shape under the terrain and then click to create the first point. Keep clicking to add more points (which will appear as little blue cubes) and double click to finish off the shape. It should look something like the image below. Although it wont be visible unless you move the camera underwater, there will be lines between each of the points you made, which form the shape. We will make these points appear above the water later on.

Note
If you need to change the points of the shape in any way, click the "Edit Shape" button in its parameters. You can double click on a joining line to create new points, and double click on points to delete them.

Configuring The Shape

Before we start assigning the sharks to the area, we are going to change a few parameters of our shape to make it easier for the later steps of the tutorial. Firstly, select your AreaShape and take a look at its parameters in the RollupBar. In the parameters will be its name, which will probably called something along of the lines of Shape1. In order to make organisation easier in the future, rename this to something like SharkShape that will be easily distinguishable. As well as this, you'll also see there is a height parameter that should by default be set to 0; this defines the height of the shape and controls how high the lines joining the points go up. Set this slightly higher than the height of your sea; a value around 30 should do. Once you've done this, your shape should look like something similar to the screenshot below.

Note
To make your AreaShape even more visible, make sure you tick the box labelled DisplayFilled; this will shade in the boundaries nicely which should help you define your areas better.

Assigning Sharks To Your Shape

In this section we will cover assigning the WaterKillEvent entity to your shape; this effectively creates the sharks that attack you. We will also cover triggering the event when you enter the shape using an AreaTrigger.

Adding The WaterKill Event

To start off, we need to add a WaterKillEvent to our map; this will spawn sharks that will come and attack you. This can be found in the RollupBar → Entity → Others → WaterKillEvent .

Once you've dragged it across, place it anywhere on your map near the shape. It's important to stress that the little area that WaterKillEvent takes up itself is not the area that it will use, so it doesn't need to be scaled or resized to fit anything.

Assigning an AreaTrigger

Next, we need to add an AreaTrigger to detect when the player is and isn't inside the shape. To add an AreaTrigger to your map, browse to the RollupBar → Entity → Triggers → AreaTrigger.

Place the AreaTrigger somewhere near the shape. In its parameters, for the sake of organisation and continuity, rename the AreaTrigger to SharkTrigger or a similar name that you can refer to quickly. Next, select the AreaShape that you created earlier. In it's parameters, scroll down to the Target section and click on Pick.

Once you have pressed this button, a small crosshair icon should appear instead of the normal mouse icon. In the perspective view, scroll the camera so you can see the AreaTrigger, and then click on the AreaTrigger icon. A line should form between the AreaTrigger and the AreaShape, depicting that these two entities are now linked. This means that when you walk into the AreaShape, an action is triggered due to the linked AreaTrigger.

Setting Up The Flowgraph

In order for the WaterKillEvent to be triggered when we enter the AreaShape, we need to create a small and simple flowgraph that will do this job. To start off, we need to link the flowgraph to one of the entities to ensure that the flowgraph loads when the game starts. To do this scroll down in the parameters of your AreaTrigger (although it can be any entity) and click the Create button in the flowgraph section.

Name it something appropriate, and you should now find yourself with a blank flowgraph canvas. First we are going to add in the AreaTrigger. To do this, select the AreaTrigger in the perspective view, and in the flowgraph editor, Right Click → Add Selected Entity. An entity:AreaTrigger node should now have appeared in your flowgraph, and if the graph was assigned to it, then its entity name will probably be <GraphEntity>.

With the AreaTrigger added in, its now time to do the same to the WaterKillEvent. Select it in the perspective view, go back to the flowgraph editor, Right Click → Add Selected Entity. The entity:WaterKillEvent node should now have appeared in your flowgraph, with the entity probably being WaterKillEvent1 (unless you renamed it). Your flowgraph should now resemble the one below.

Now it's time to link the nodes together so that when you enter the AreaTrigger the WaterKillEvent is triggered. You'll see that the AreaTrigger has an Enter output, and that the WaterKillEvent has a SpawnShark output. If we link these two together, the sharks will be spawned when the player enters the area. To link the two ports, hold down the left mouse button on the Enter output, and drag the link across to the SpawnShark output. Release the left mouse button to set the link. Finally we need to link the Leave port of the AreaTrigger and the RemoveShark port of the WaterKillEvent. Follow the same steps as before to achieve this. Your finished flowgraph should now look like this.

Finishing Off

Finally, to make sure the sharks attack you and don't just completely ignore you, you need to generate their navigation. To do this, navigate to the top toolbar and click on AI → Generate All Navigation. The sharks should now attack you when you jump in. To jump into the game, position yourself next to the area and press Ctrl + G to spawn into the game. Swim into the area, and you'll soon be greeted by some sharks!



Personal tools