Game logic - Entity storage – Ylands
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Special game logic to store data specific to one entity (e.g player). When assigned trough instruction [[Ylands Tile - Add-Remove entity storage|'''Add Storage''']], it will create a '''copy''' witch will be '''attached''' to selected entity '''instance'''. | Special game logic to store data specific to one entity (e.g player). When assigned trough instruction [[Ylands Tile - Add-Remove entity storage|'''Add Storage''']], it will create a '''copy''' witch will be '''attached''' to selected entity '''instance'''. | ||
*Storage has to be attached to entity via '''Add Storage''' instruction, target entity becomes ''' | *Storage has to be attached to entity via '''Add Storage''' instruction, target entity becomes [[Ylands Tile - Storage owner literal|'''storage owner''']] | ||
*Any storage can have unlimited number of owners, each owner will have its unique copy of attached storage | *Any storage can have unlimited number of owners, each owner will have its unique copy of attached storage | ||
*Entities can have unlimited number of storages | *Entities can have unlimited number of storages | ||
Line 24: | Line 24: | ||
=Notes= | =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). | *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 entity storage|'''Has storage''']] instruction before accessing storage on unknown entity (e.g Trigger object). | ||
=Related Instructions= | =Related Instructions= | ||
*[[Ylands Tile - Add-Remove entity storage|Add / Remove Entity Storage]] | *[[Ylands Tile - Add-Remove entity storage|Add / Remove Entity Storage]] | ||
*[[Ylands Tile - Has entity storage|Has Entity Storage]] | *[[Ylands Tile - Has entity storage|Has Entity Storage]] | ||
---- | ---- | ||
{{Ylands scripting navbox}} | {{Ylands scripting navbox}} | ||
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|19}}}} | |||
[[Category: Game Logic]] | |||
[[Category: Ylands 0.10]] |
Revision as of 15:48, 12 June 2019
Description
Special game logic to store data specific to one entity (e.g player). When assigned trough instruction Add Storage, it will create a copy witch will be attached to selected entity instance.
- Storage has to be attached to entity via Add Storage instruction, target entity becomes storage owner
- Any storage can have unlimited number of owners, each owner will have its unique copy of attached storage
- Entities 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