Difference between revisions of "Ylands Persistent Storage"

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "=Overview= It is possible to store custom data for any player across different instances of one custom game. This means, that when payers will disconnect from one game instanc...")
 
 
(6 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
*Storage data are always unique to a specific player (similar as entity storage)
 
*Storage data are always unique to a specific player (similar as entity storage)
 
*Storage data can be updated only if owning player is online
 
*Storage data can be updated only if owning player is online
 
  
 
=== Add new variable to storage ===
 
=== Add new variable to storage ===
Line 13: Line 12:
 
**Pay attention to variable type setting, this cannot be changed later!
 
**Pay attention to variable type setting, this cannot be changed later!
 
**New variable is committed to Game storage right after variable settings are confirmed
 
**New variable is committed to Game storage right after variable settings are confirmed
**Important: Once committed, storage variables cannot be deleted, only marked as "obsolete"
+
**Once committed, storage variables cannot be deleted, only marked as "obsolete" (to assure continuous game compatibility)
  
 
<gallery>
 
<gallery>
Line 22: Line 21:
  
 
=== Using storage variables ===
 
=== Using storage variables ===
*Once declared, storage variables will become available in Visual scripting under Variables -> Game Storage category
+
*Once declared, storage variables will become available in Visual scripting under Variables -> Game category
 
*Game storage variables can be used in same way as entity storage variables, but in this case the owner always have to be a player
 
*Game storage variables can be used in same way as entity storage variables, but in this case the owner always have to be a player
  
Line 28: Line 27:
 
Image:Ylands-Editor-game storage variables1.png|Storage variables
 
Image:Ylands-Editor-game storage variables1.png|Storage variables
 
</gallery>
 
</gallery>
 +
  
  
 
----
 
----
{{Ylands scripting navbox}}
+
{{Navbox/Ylands}}
 +
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|7}}}}
  
[[Category: How-to]]
+
[[Category: Script: How To]]

Latest revision as of 18:33, 17 November 2021

Overview

It is possible to store custom data for any player across different instances of one custom game. This means, that when payers will disconnect from one game instance (i.e server) and will reconnect to another one, it is possible to store and retrieve data between those game sessions. For example, creator can store record of achievements gained by the player while playing the game.

  • Storage data are always unique to a specific player (similar as entity storage)
  • Storage data can be updated only if owning player is online

Add new variable to storage

  • Navigate editor menu -> game settings and open Game storage
  • Use "Add new variable" button to add new variable to storage
  • Set variable name, type and default value
  • Important
    • Pay attention to variable type setting, this cannot be changed later!
    • New variable is committed to Game storage right after variable settings are confirmed
    • Once committed, storage variables cannot be deleted, only marked as "obsolete" (to assure continuous game compatibility)

Using storage variables

  • Once declared, storage variables will become available in Visual scripting under Variables -> Game category
  • Game storage variables can be used in same way as entity storage variables, but in this case the owner always have to be a player