Game logic - Entity template – Ylands

From Bohemia Interactive Community
Revision as of 16:38, 7 October 2018 by Rudy.cz (talk | contribs)
Jump to navigation Jump to search

Description

Template for spawning new entities - either items, NPCs or vehicles. All atributes (HP, color etc) set in entity template will be carried over to newly spawned entity.

  • All atributes picked to the entity template will be transfered to the spawned entity.
  • Template remembers the entity in state when it was picked. Thus the entity can be removed after being picked. When editing once picked entity, it must be repicked to the template for applying changes.
  • The template itself can be used to modify the picked entity while spawning it.
  • Other logics/scripts are used to execute the entity spawning with two script tiles called "Spawn Entity Template"

Events

  • On Entity Spawn - Called when entity from the template is spawned.

Literals

  • Entity - The concrete entity that is being spawned.

Entity Template In Use

  1. Select Entity Template from the game logic.
  2. Open its Object Properties and select the entity you want to save to the template.
  3. Use the "On Entity Spawn" event and add some logic you want to happen when an entity spawns from the template. In this case, we are using "Play Particle" to add some sparks on position, where the entity spawns.
  4. Set up trigger to spawn the entity. There are multiple types of logic and entity scripts by which can be the template called. In this case, we are using time trigger.

Calling the template can be done with two script tiles "Spawn Entity Template". One spawns the entity inside a container, the second one on a particular position. Use the first slot to choose the template you want to use for the trigger.



Template:Ylands scripting navbox