I want to learn more about the trigger editor but it seems that some of the intermediate to advanced stuff requires variables. I don't really understand the point of variables. Could someone explain them. I also want to add saved data and from what I'm hearing banks are the way to go. But I've also hear people trying to encrypt their banks. Is this necessary to do and if not what's the worst that can happen?
variables are kinda things to store something in. you have many types of variables. the 2 basics are intiger and bolean. in intiger you can store numbers. this is used for things like kills or score. its the most common variable. an bolean is to check if something is true or false.
. i dont no anything like banks.
There's a lot that could be said about variables, but here's a BRIEF introduction.
Variables are temporary data containers and will be destroyed after they become 'out of scope'. In the trigger editor, there are two scopes - global and local. Local variables in an action or function exist for that particular scope. Global variables exist until the game ends and will not leave scope after a function or action ends.
Banks store persistent data on the hard drive. I haven't used them personally yet so I can't offer much advice there. I can tell you that since it's local storage, you can't protect it from tampering by the user.
Variables are used for everything. Say, if you wanted to make an ammo system, you would need to make a variable for how much ammo there was. Then you modify that variable by -1 each time a shot is fired, and once that variable was 0 then you would prevent the player from firing. If you wanted to make a menu then you would need to assign each button to a variable so that the system could tell which button did what. If you wanted to make a custom health bar then you would need to store the unit's health as a variable and call on it for the dialog. Could be just about anything.
Here is a basic sprint trigger. 'Sprint Active' is a boolean to check if the unit is already running, and 'Sprint Amount' is an integer to check if the unit has the 'energy' to sprint.
I want to learn more about the trigger editor but it seems that some of the intermediate to advanced stuff requires variables. I don't really understand the point of variables. Could someone explain them. I also want to add saved data and from what I'm hearing banks are the way to go. But I've also hear people trying to encrypt their banks. Is this necessary to do and if not what's the worst that can happen?
hi, i hope i this is correct
variables are kinda things to store something in. you have many types of variables. the 2 basics are intiger and bolean. in intiger you can store numbers. this is used for things like kills or score. its the most common variable. an bolean is to check if something is true or false. . i dont no anything like banks.
@Keyeszx: Go
There's a lot that could be said about variables, but here's a BRIEF introduction.
Variables are temporary data containers and will be destroyed after they become 'out of scope'. In the trigger editor, there are two scopes - global and local. Local variables in an action or function exist for that particular scope. Global variables exist until the game ends and will not leave scope after a function or action ends.
Banks store persistent data on the hard drive. I haven't used them personally yet so I can't offer much advice there. I can tell you that since it's local storage, you can't protect it from tampering by the user.
Can someone give me an example of what you would use a variable for? Besides what thommiej said. Is there other uses for variables?
@Keyeszx: Go
Variables are used for everything. Say, if you wanted to make an ammo system, you would need to make a variable for how much ammo there was. Then you modify that variable by -1 each time a shot is fired, and once that variable was 0 then you would prevent the player from firing. If you wanted to make a menu then you would need to assign each button to a variable so that the system could tell which button did what. If you wanted to make a custom health bar then you would need to store the unit's health as a variable and call on it for the dialog. Could be just about anything.
@voodude2008: Go
Here is a basic sprint trigger. 'Sprint Active' is a boolean to check if the unit is already running, and 'Sprint Amount' is an integer to check if the unit has the 'energy' to sprint.
They are also required for loops:
Or more fancy stuff, like graph algorithms: