SEED - Templates via Spawnargs: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
add
 
Tels (talk | contribs)
m add
Line 6: Line 6:


To overcome this, the mechanism of defining targets via spawnargs on the SEED entity was added.
To overcome this, the mechanism of defining targets via spawnargs on the SEED entity was added.
== Examples ==
A few pre-made entities exist that use this technique to spawn a variable amount of entities, f.i. '''atdm:random_food'''. You will find them under "darkmod/Randoms" in [[DarkRadiant]] when right-clicking and choosing "Create Entity".


== Overview ==
== Overview ==

Revision as of 08:16, 1 February 2011

Introduction

The SEED can create random entities with random placements. The normal way to do so is to create "target entities" as blueprints/templates. While this method works, it has the drawback that all blueprints/templates need to be spawned as entities at map start, just so the SEED can read out their properties. If then only some of these targets end up used, you just wasted time and memory to spawn/load/process entities and their models/textures, even tho they are never used in the actual map.

If you f.i. wanted to have the SEED spawn randomly either one apple or one pear, the traditional "target" method requires you to place one SEED, one apple and one pear entity, for a total of 3 entities, even tho during runtime only one entity would actually survive. With this method you only need on entity (the SEED itself) and it will only spawn the necessary entities later.

To overcome this, the mechanism of defining targets via spawnargs on the SEED entity was added.

Examples

A few pre-made entities exist that use this technique to spawn a variable amount of entities, f.i. atdm:random_food. You will find them under "darkmod/Randoms" in DarkRadiant when right-clicking and choosing "Create Entity".

Overview

The spawnargs to define a new template always start with spawn_ and some suffix like "class", "skin" and so on.

You can use multiple of these, and combine it with a overall max_entities count, too:

"remove"           "1"           // remove the SEED after spawning the entities
"wait_for_trigger" "1"           // Optional, wait for a trigger before spawning anything
"max_entities"     "4"           // Will only spawn at most 4 entities
"spawn_class"      "atdm:moveable_food_apple"
"spawn_count"      "3"
"spawn_skin"       "tdm_fruit_brownish"
"spawn_class_1"    "atdm:moveable_food_pear"
"spawn_count_1"    "2"

This would spawn at most 3 apples and at most 2 pears, but overall not more than 4 entities. Remember to make the SEED space big enough so that all to-be spawned entities will fit!

Do not confuse spawn_class with spawnclass, this will make the SEED stop working!

Spawnargs

spawn_class

Do not confuse spawn_class with spawnclass, this will make the SEED stop working!

See also [[[#spawn_model|spawn_model].

TODO

spawn_model

TODO

spawn_count

TODO

spawn_combine

TODO

spawn_falloff

TODO

spawn_floor

TODO

spawn_map

TODO

spawn_skin

TODO