Game logic - Game logic storage – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|19}}}}" to "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}}")
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Description=
=Description=
Template for spawning '''new game logic'''. All atributes (e.g. script) set in the template will be carried over to newly spawned game logic. New game logic is spawned using [[Ylands Tile - Spawn game logic|'''Spawn Game Logic''']] instruction.
Special game logic to store data specific to another game logic. When assigned trough instruction [[Ylands:Tile - Add-Remove logic storage|'''Add logic storage''']], it will create a '''copy''' witch will be '''attached''' to selected game logic '''instance'''.


*All atributes picked to the logic template will be transfered to the spawned logic.
*Storage has to be attached to entity via '''Add Storage''' instruction, target becomes [[Ylands:Tile - Storage owner literal|'''storage owner''']]
*Attributes of picked game logic can be modified directly in the Template
*Any storage can have unlimited number of owners, each owner will have its unique copy of attached storage
*Template remembers the game logic in state when it was picked. Thus the game logic can be removed after being picked.
*Game logic can have unlimited number of storages
*Each owner will have '''unique values''' in each storage
*Storage data (variables) can be found in '''Variables''' category
*Storage instructions can be found in '''Instructions''' category


=Properties=
'''Custom instructions'''
[[File:{{PAGENAME}}.png|right|400px|Properties]]
*Instructions in a storage are executed only within currently called storage instance and it will affect only variables of this instance.


===Game logic===
'''Storages in compositions'''
*Game logic to be spawned
*When composition using any storage will get exported, it will save with a copy of that storage (even if not selected)
*Click to edit game logic properties
*When such composition is placed in other scenario, it will make new independent copy of included storage under new name (e.g Entity storage (2))
*In case of multiple instances of same composition, references in all compositions will be set to one storage


=Logic template events=
= Notes =
*[[Ylands Tile - Logic Template On Logic Spawn|On Logic Spawn]]
*In case a script will try to access non-existent storage this will stop the script. So it is crucial to do a storage check using [[Ylands:Tile - Has logic storage|'''Has storage''']] instruction before accessing storage on unknown entity  (e.g Trigger object).
 
=Related instructions=
*[[Ylands Tile - Spawn game logic|Spawn Game Logic]]


= Related Instructions =
*[[Ylands:Tile - Add-Remove logic storage|Add / Remove Logic Storage]]
*[[Ylands:Tile - Has logic storage|Has Logic Storage]]




----
----
{{Ylands scripting navbox}}
{{Navbox/Ylands}}
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|19}}}}
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}}


[[Category: Ylands 0.12]]
[[Category: Ylands 0.12]]
[[Category: Game Logic]]
[[Category: Game Logic]]

Latest revision as of 14:21, 24 November 2023

Description

Special game logic to store data specific to another game logic. When assigned trough instruction Add logic storage, it will create a copy witch will be attached to selected game logic instance.

  • Storage has to be attached to entity via Add Storage instruction, target becomes storage owner
  • Any storage can have unlimited number of owners, each owner will have its unique copy of attached storage
  • Game logic can have unlimited number of storages
  • Each owner will have unique values in each storage
  • Storage data (variables) can be found in Variables category
  • Storage instructions can be found in Instructions category

Custom instructions

  • Instructions in a storage are executed only within currently called storage instance and it will affect only variables of this instance.

Storages in compositions

  • When composition using any storage will get exported, it will save with a copy of that storage (even if not selected)
  • When such composition is placed in other scenario, it will make new independent copy of included storage under new name (e.g Entity storage (2))
  • In case of multiple instances of same composition, references in all compositions will be set to one storage

Notes

  • In case a script will try to access non-existent storage this will stop the script. So it is crucial to do a storage check using Has storage instruction before accessing storage on unknown entity (e.g Trigger object).

Related Instructions