I am currently making a RPG map and I couldn't figure how to save unit's inventory ability's items inside. I am using bank to try it but i can't seem to figure it out. I need a person to help me on banking. I Just Don't Know How To Use BANK in Triggers. Will anyone help me?
I would like to point out that there are a lot of documentation on banks throughout the forums including tutorials.
Banks can save the following data:
Booleans
Integers
Points
Reals
Strings
Texts
Units
Now i don't know much about data items (i make items in triggers), but if the item isn't already a unit (or the above mentioned format) you will need to make a system to translate the item in to a combination of these forms to be saved to the bank, then a system to retrieve and reconstitute the item
(Literal means non-variable, this is because this is happening statically. I would recommend creating a constant string variable called BANK_NAME for your bank name, you will need it later also... Constants do count as literal values since the compiler inserts the literal value whenever it encounters a constant.Apparently although the editor lets you use a constant value in this field, I tested it out and it does NOT work! Use only a literal value here! You can still use your constant BANK_NAME everywhere else.
Use BANK_NAME for the string above if you created that constant. Bank[] should be an array of banks with size equal to number of players.
When you need to save a bank:
SetoptionSignatureforbank<bankvar>toEnable// optional step for securitySavebank<bankvar>
The editor gives you a "Bank is valid" function which checks for the signature, if you want to use the signature. Upon first loading the bank, you can check the validity and then clear the values if it is invalid.
Of course, the signature is just an algorithm, so people have figured out how to crack it. It will give you a small level of security, but will not deter those who are determined. For guaranteed security, you will need to implement your own encryption and decryption algorithms (recommended only once you are sure people are actually playing your map regularly)
I am currently making a RPG map and I couldn't figure how to save unit's inventory ability's items inside. I am using bank to try it but i can't seem to figure it out. I need a person to help me on banking. I Just Don't Know How To Use BANK in Triggers. Will anyone help me?
Welcome to the forums!
I would like to point out that there are a lot of documentation on banks throughout the forums including tutorials.
Banks can save the following data:
Booleans
Integers
Points
Reals
Strings
Texts
Units
Now i don't know much about data items (i make items in triggers), but if the item isn't already a unit (or the above mentioned format) you will need to make a system to translate the item in to a combination of these forms to be saved to the bank, then a system to retrieve and reconstitute the item
Quick rundown on steps to using a bank:
At map initialization:
(Literal means non-variable, this is because this is happening statically.
I would recommend creating a constant string variable called BANK_NAME for your bank name, you will need it later also... Constants do count as literal values since the compiler inserts the literal value whenever it encounters a constant.Apparently although the editor lets you use a constant value in this field, I tested it out and it does NOT work! Use only a literal value here! You can still use your constant BANK_NAME everywhere else.When you need to get a value from your bank:
Use BANK_NAME for the string above if you created that constant. Bank[] should be an array of banks with size equal to number of players.
When you need to save a bank:
The editor gives you a "Bank is valid" function which checks for the signature, if you want to use the signature. Upon first loading the bank, you can check the validity and then clear the values if it is invalid.
Of course, the signature is just an algorithm, so people have figured out how to crack it. It will give you a small level of security, but will not deter those who are determined. For guaranteed security, you will need to implement your own encryption and decryption algorithms (recommended only once you are sure people are actually playing your map regularly)