SEED - Templates via Spawnargs: Difference between revisions
rename "spawn_" to "template_" |
m formatting |
||
Line 33: | Line 33: | ||
This is either an entityDef name like '''atdm:moveable_food_apple''', or a model name like '''models/darkmod/decorative/games/cards_stack02.lwo'''. In the latter case, "func_static" will be used as class for the template. | This is either an entityDef name like '''atdm:moveable_food_apple''', or a model name like '''models/darkmod/decorative/games/cards_stack02.lwo'''. In the latter case, "func_static" will be used as class for the template. | ||
=== template_count === | === template_count === | ||
Sets the maximum amount of entities to generate from this template. | |||
=== template_combine === | === template_combine === | ||
Default: 1. | |||
If set to 1, entities generated from this template will be combined (if possible) into multi-static entities with one rendermodel and many clipmodels. If set to 0, each will stay as a separate entity. | |||
=== template_falloff === | === template_falloff === | ||
Line 60: | Line 60: | ||
Sets the skin on the template. Can also be a [[random skin]] like: | Sets the skin on the template. Can also be a [[random skin]] like: | ||
<pre><nowiki> | |||
"template_skin" "'', red, green" | "template_skin" "'', red, green" | ||
</nowiki></pre> | |||
{{seed}} | {{seed}} |
Revision as of 11:15, 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 template and some optional suffix like "_skin" and so on.
You can use multiple of these by inserting any suffix after "template", 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 "template" "atdm:moveable_food_apple" "template_count" "3" "template_skin" "tdm_fruit_brownish" "template1" "atdm:moveable_food_pear" "template1_count" "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!
Spawnargs
template
This is either an entityDef name like atdm:moveable_food_apple, or a model name like models/darkmod/decorative/games/cards_stack02.lwo. In the latter case, "func_static" will be used as class for the template.
template_count
Sets the maximum amount of entities to generate from this template.
template_combine
Default: 1.
If set to 1, entities generated from this template will be combined (if possible) into multi-static entities with one rendermodel and many clipmodels. If set to 0, each will stay as a separate entity.
template_falloff
TODO
template_floor
TODO
template_map
TODO
template_skin
Sets the skin on the template. Can also be a random skin like:
"template_skin" "'', red, green"