After a quick break from the editor, I'm back for some more XD. I have a couple of question about these two terms : Boolean and Array
My mother language is french and even after some research, I'm unable to fully understand the meaning of these variables in the galaxie editor. Mathematically speaking, they could mean many things if I'm not mistaken. Could somebody give me explanation of their precise meaning in the galaxie editor and also some quick idea that can be made out of these variables.
I got stuck at some point where I need to figure this out to go further. I hope this will help other people as well...
Boolean are true-false values. You can make a boolean variable and ONLY set it to either true or false. Useful in many triggers and maps.
--
Arrays are simply variables that make your life easier. Player[10] (an array variable) just means you created 11 variables (counting Player[0]) at once. By creating Player[10], you literally created the variable "Player" 10 times in a row. You can change the value of Player[0] without affecting Player[1] or any other variables in the array.
Arrays can also be very complicated, like Team[2][10]. That's 33 total different variables created. Team[0][1] is a whole differently variable then Team[1][1].
--
Let me show you an example that combines those 2 together:
I have an boolean array variable called Finish Voting = false <Boolean[10]>. It is a boolean and an array.
Event
Dialog - Fast Mode is used by Player Any Player with event type Clicked
Condition
(Triggering Player) == Player 1
Action
Variable - Set Finish Voting[1] = True
Player 1 clicks on an dialog item called Fast Mode in a voting system. Boolean helps check that Player 1 finishes voting, and array helps makes things less tedious and organized. WIthout arrays, you would have to make 10 variables: Player 1 Finishes Voting, Player 2 Finishes Voting, Player 3 Finishes Voting . . . .etc.
The example I gave would most likely be proceeded by another trigger that does an action when all players finish voting, or when a specific time has elapsed.
--
Hope I clarified it good enough for you
Feel free to ask any questions ^.^
So the boolean variable is more like a security, either 0 or 1, either a switch which is ''on'' or ''off''. You can set a boolean variable to be 0 or 1 via action trigger. With this method, you can set a player boolean variable to be true once he voted so he can't vote anymore since the boolean is not fasle anymore.
Do I understand it right?
In your example, you say you dont need to repeat this trigger for each player because of the array. I don't understand how since the trigger you made up is only good when player one vote. I would have to do it for every player, wouldn't I?
I also have more question, but I don't have the editor to test it so I will give it a shot before asking for more.
So the boolean variable is more like a security, either 0 or 1, either a switch which is ''on'' or ''off''. You can set a boolean variable to be 0 or 1 via action trigger. With this method, you can set a player boolean variable to be true once he voted so he can't vote anymore since the boolean is not fasle anymore.
Do I understand it right?
In your example, you say you dont need to repeat this trigger for each player because of the array. I don't understand how since the trigger you made up is only good when player one vote. I would have to do it for every player, wouldn't I?
I also have more question, but I don't have the editor to test it so I will give it a shot before asking for more.
Ty for your help
In alot of boolean cases, like in editable CFG's, 0 is off and 1 is on. But in this case, the only values they can be are "true" and "false". So you can set the boolean to be "true" (there will be a checkbox with the word True? next to it" or "false" (not true, so leave the checkbox unchecked). Well, in the example trigger, the boolean didn't make it so the same player can't vote anymore. It just makes it so that when every player is done voting, another action does something else. Normally I would probably just hide the dialog after any dialog item is used.
Yes, you still have to do it to every single player. In my opinion, it's mainly for organization purposes.
I have an boolean array variable called Finish Voting = false <Boolean[10]>. It is a boolean and an array.
Event Dialog - Fast Mode is used by Player Any Player with event type Clicked
Condition (Triggering Player) == Player 1
Action Variable - Set Finish Voting[1] = True
Let's see if I understand this well : The Boolean Array variable Finish Voting = false <Boolean[10]> make 11 variable (Player 0 to 10). In this trigger, it set the varriable number 1 (of 11) of the array as true.
When all player are finish voting, all variable within the array will also be true, which make the Boolean Variable ''Finish Voting'' also true. From that, I can make a trigger with an event that occur when ''Finish Voting'' == true, like hide vote leaderboard.
More logical questions remain : Does all boolean variables within the array need to be true to make the Boolean-Array ''Finish Voting'' variable also true? What happen with the neutral player 0? If player 0 never vote, it will never make ''Finish Voting'' true.
Stop. There are no similarity between an array, and a variable. An array is a "table" or in math terms a "matrix". It means that instead of containing a single value it contains a list of values. Here is an example.
Without Array:
"V: Value"
With an [4] Array:
"V[1]: Value"
"V[2]: Value"
"V[3]: Value"
"V[4]: Value"
All the different numbers are stored in same variable, under different numbers. So you can later call on the individual values just like you call a normal value, eg. "If Variable[3] > 100" The array is usefull for reducing the amount of variables of the same type. An example would be in an eight player map, you want to store a value for each player. Instead of having eight different variables, you create an array of eight. Then each player have their own index of the variable. A thing to remember here is "Picked Player" and "Triggering Player" also returns a number equal to their player number. So you could say "Any player kill an unit" then "Set V[Triggering Player] +1" What this means, it sets the variable of that player to add one. The table would then look like this, if it was player two (per example)
"V[1]: 0"
"V[2]: 1"
"V[3]: 0"
"V[4]: 0"
You can then later call back on those individually values by saying "If Variable[2] > 1" etc.
--
As far as variable types goes:
Integer: Hole numbers (eg. 1,2,3,4..) most common variable.
Real: Real numbers (eg. 1.2, 1.3, 1.4, 1.5 ..) used for angles and precise numbers.
Boolean: True or False statement, used when you only need a binormial result of either true or false.
.. plus all the others, but you just asked about boolean.
The Boolean returns a true or a false. In other words "If player eats a pinapple" .. "Set variable: PlayerLikePinapples: True" Now! For your question regarding voting. There is a really bad thing about using booleans for this. As you might see, you can't use math with booleans. So, while it makes sense to make a boolean variable "if players have voted" it would probally backfire, if you want to run something ones all player have voted. Since you wouldn't have a good way of determin when all values are true. A better way would (in my experience) would be to set a variable to the amount of active players. Then ones a player votes, subtract one, and check if the value is now 0. If it isn't - obviously more players havn't voted, but if it is, everyone have and then run whatever you want.
An example of where you could use boolean values with voting would be if players have 1 chance to vote on something, that doesn't require all players to vote for it to happen. Let me see .. Well, I'll change the example a bit, let's say players can use a cheat code to get a boost or something, then you can make a boolean "HavePlayerUsedHisCheat?" True or false. This is just an example of a player yes/no that doesn't need to include math.
A last comment. Until you really understand the use of variable arrays, avoid using severel arrays in same variable (eg.) Variable[10][10][10] - at least until you understand what that actually does. Happy hunting :)
Hello everybody,
After a quick break from the editor, I'm back for some more XD. I have a couple of question about these two terms : Boolean and Array
My mother language is french and even after some research, I'm unable to fully understand the meaning of these variables in the galaxie editor. Mathematically speaking, they could mean many things if I'm not mistaken. Could somebody give me explanation of their precise meaning in the galaxie editor and also some quick idea that can be made out of these variables.
I got stuck at some point where I need to figure this out to go further. I hope this will help other people as well...
@Claymuffin: Go
Boolean are true-false values. You can make a boolean variable and ONLY set it to either true or false. Useful in many triggers and maps.
--Arrays are simply variables that make your life easier. Player[10] (an array variable) just means you created 11 variables (counting Player[0]) at once. By creating Player[10], you literally created the variable "Player" 10 times in a row. You can change the value of Player[0] without affecting Player[1] or any other variables in the array.
Arrays can also be very complicated, like Team[2][10]. That's 33 total different variables created. Team[0][1] is a whole differently variable then Team[1][1].
--Let me show you an example that combines those 2 together:
I have an boolean array variable called Finish Voting = false <Boolean[10]>. It is a boolean and an array.
Event Dialog - Fast Mode is used by Player Any Player with event type Clicked
Condition (Triggering Player) == Player 1
Action Variable - Set Finish Voting[1] = True
Player 1 clicks on an dialog item called Fast Mode in a voting system. Boolean helps check that Player 1 finishes voting, and array helps makes things less tedious and organized. WIthout arrays, you would have to make 10 variables: Player 1 Finishes Voting, Player 2 Finishes Voting, Player 3 Finishes Voting . . . .etc.
The example I gave would most likely be proceeded by another trigger that does an action when all players finish voting, or when a specific time has elapsed.
--Hope I clarified it good enough for you Feel free to ask any questions ^.^
@kenxftw: Go
So the boolean variable is more like a security, either 0 or 1, either a switch which is ''on'' or ''off''. You can set a boolean variable to be 0 or 1 via action trigger. With this method, you can set a player boolean variable to be true once he voted so he can't vote anymore since the boolean is not fasle anymore.
Do I understand it right?
In your example, you say you dont need to repeat this trigger for each player because of the array. I don't understand how since the trigger you made up is only good when player one vote. I would have to do it for every player, wouldn't I?
I also have more question, but I don't have the editor to test it so I will give it a shot before asking for more.
Ty for your help
In alot of boolean cases, like in editable CFG's, 0 is off and 1 is on. But in this case, the only values they can be are "true" and "false". So you can set the boolean to be "true" (there will be a checkbox with the word True? next to it" or "false" (not true, so leave the checkbox unchecked). Well, in the example trigger, the boolean didn't make it so the same player can't vote anymore. It just makes it so that when every player is done voting, another action does something else. Normally I would probably just hide the dialog after any dialog item is used.
Yes, you still have to do it to every single player. In my opinion, it's mainly for organization purposes.
Let's see if I understand this well : The Boolean Array variable Finish Voting = false <Boolean[10]> make 11 variable (Player 0 to 10). In this trigger, it set the varriable number 1 (of 11) of the array as true.
When all player are finish voting, all variable within the array will also be true, which make the Boolean Variable ''Finish Voting'' also true. From that, I can make a trigger with an event that occur when ''Finish Voting'' == true, like hide vote leaderboard.
More logical questions remain : Does all boolean variables within the array need to be true to make the Boolean-Array ''Finish Voting'' variable also true? What happen with the neutral player 0? If player 0 never vote, it will never make ''Finish Voting'' true.
@Claymuffin: Go
Stop. There are no similarity between an array, and a variable. An array is a "table" or in math terms a "matrix". It means that instead of containing a single value it contains a list of values. Here is an example.
Without Array: "V: Value"
With an [4] Array: "V[1]: Value" "V[2]: Value" "V[3]: Value" "V[4]: Value"
All the different numbers are stored in same variable, under different numbers. So you can later call on the individual values just like you call a normal value, eg. "If Variable[3] > 100" The array is usefull for reducing the amount of variables of the same type. An example would be in an eight player map, you want to store a value for each player. Instead of having eight different variables, you create an array of eight. Then each player have their own index of the variable. A thing to remember here is "Picked Player" and "Triggering Player" also returns a number equal to their player number. So you could say "Any player kill an unit" then "Set V[Triggering Player] +1" What this means, it sets the variable of that player to add one. The table would then look like this, if it was player two (per example)
"V[1]: 0" "V[2]: 1" "V[3]: 0" "V[4]: 0"
You can then later call back on those individually values by saying "If Variable[2] > 1" etc.
As far as variable types goes:
Integer: Hole numbers (eg. 1,2,3,4..) most common variable. Real: Real numbers (eg. 1.2, 1.3, 1.4, 1.5 ..) used for angles and precise numbers. Boolean: True or False statement, used when you only need a binormial result of either true or false. .. plus all the others, but you just asked about boolean.
The Boolean returns a true or a false. In other words "If player eats a pinapple" .. "Set variable: PlayerLikePinapples: True" Now! For your question regarding voting. There is a really bad thing about using booleans for this. As you might see, you can't use math with booleans. So, while it makes sense to make a boolean variable "if players have voted" it would probally backfire, if you want to run something ones all player have voted. Since you wouldn't have a good way of determin when all values are true. A better way would (in my experience) would be to set a variable to the amount of active players. Then ones a player votes, subtract one, and check if the value is now 0. If it isn't - obviously more players havn't voted, but if it is, everyone have and then run whatever you want.
An example of where you could use boolean values with voting would be if players have 1 chance to vote on something, that doesn't require all players to vote for it to happen. Let me see .. Well, I'll change the example a bit, let's say players can use a cheat code to get a boost or something, then you can make a boolean "HavePlayerUsedHisCheat?" True or false. This is just an example of a player yes/no that doesn't need to include math.
A last comment. Until you really understand the use of variable arrays, avoid using severel arrays in same variable (eg.) Variable[10][10][10] - at least until you understand what that actually does. Happy hunting :)