Animals Documentation

From Nexus Mods Wiki
Revision as of 13:28, 25 October 2019 by WarhorseStudios (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are two basic options:

  1. Boids
    • stupid but fast
    • can walk and run away from player
    • explodes when killed (just a little)
    • they do walk through walls occasionally
  2. Characters
    • spawned from a spawner
    • can have more advanced intelligence (herding)
    • collides properly
    • leave corpses

We use boids for chickens and characters for everything else.

Boids

You can place it by going to Entity/Boids and select the one you want. It is important to place these boids into the open area and set their radius accordingly to avoid animals being spawned into houses and such. Unfotunatelly there's no way to show the radius visually, so try your best guess. You can see the animals in the editor as well, so raising the count a lot can give you a pretty good idea of spawn radius.
  RTENOTITLE

RTENOTITLE

However player will still be able to chase the animals into the buildings. 

Characters

Characters are more advanced and also more costly, so please don't turn the level into a petting zoo. However it adds a lot, so we should definitelly use them when possible. They're being handled by spawning system, so fortunatelly only those in the players vicinity should be simulated.

To place these animals first pick the right layer in Design/_Ecosystem according to the sector you are working on.
  RTENOTITLE

Now pick an animal prefab from Prefab/SmartObjects/Animal and insert it into level in the place you want to.

RTENOTITLE

In the ecosystem sector layer, locate object type Tag Point and select it. If there isn't one yet, create a new Tag Point (AI -> TagPoint). Go to Entity Links rollout and press Pick Target. Then click on the inserted animal prefab.

And now it's time for magic. What drives the spawning is not the tag point nor the prefab but the entity link between them. And all the important parameters are in that link's name. It looks like this: 

animalSpawn[amount(12),class(Sheep),radius(8.2),respawn(28h)] 

  • amount – amount of animals spawned initially
  • class – corresponds to the type of the animal (Sheep, Cow, Pig)
  • radius – maximum distance where can the animal be spawn around the prefab - it's in meters but not super precise
  • respawn – controls how long will it take to replenish one animal in case player (or some godless peasant) kills it

You have to use this exact syntax as the name of the link, but you can change the variables as you wish, but with some moderation – herds of more than 15 animals are definitely not needed. Ideally don't go higher than 10. To rename the link, just right click on the proper line and select Rename link.

Entity link is mandatory for domestic animals only. For wild living animals, just insert animal prefab and that's it (one prefab means one animal?).

RTENOTITLE

And now for some minor things:

  • these animals won't be visible in editor, you'll have to run the game mode to see them. 
  • they won't spawn unless there's a navmesh generated around the point
  • they actually spawn only on the connected piece of navmesh that is closest to the prefab and the connectivness disregards all navigation objects like doors or ledges. This means that to spawn animals in houses, you'd have to put the prefab itself inside or that you can keep them from spawning outside fenced area if it's only connection is a ledge for example.