2 Questions, One about variables one about limitations in figuring out who the triggering player is in blocks.
In blocks, I’ve been creating variables and then telling them what they are equal to.
Then I will go to a different block for a different device and none of the variables I created in other blocks are there.
1A) Does this mean that Variables are unique to each device’s block?
1B) Can I use a variable that I created in one device’s block, keep the spelling the same, and use it in another block without having to reassign it value?
1C) I guess what I’m asking is, can the variables talk to each other between different devices blocks?
I’m still working out kinks in trying to steal from other players. I can now steal the amount of an item a player has purchased, but I cannot steal the amount a player has stolen from others. When I’m in blocks I have no way of knowing which player was the triggering player, so I can’t update the property with their correct amount of the resource they stole. (The resource being stolen is not what the game score is based on.)
Here is the item granter block I have. The top portion is correctly functional and allows stealing of bananas that a player has purchased.
The bottom part is me trying to figure out how to take the value that was just stolen and assign it as the property value of stolen bananas to the triggering player.
No, variables are only for one block. Properties are for every block. What you can do is set a variable to a property, make it act as a property, and set the property equal to a variable.
Also, you can save the value of the property when a button is pressed, like I showed you, and give a player exactly that many item by using a item granters special blocks. If you need a better explanation, let me know.
Yeah, I get what you’re both saying what I don’t get is how it would actually work.
For instance, I have a property created for each team, called Tm 1 stolen, Tm 2 Stolen, etc; however it does not have a value in game because I cannot figure out a way to give it the correct value.
I can give it a value for every time a player steals, but the teams are not getting credited for the quantity they have stolen.
So, if I go in blocks and tell it to set a variable I created called Team 1 stolen, equal to the property Team 1 stolen, both of those have no value. They look at each other and see nothing.
If I use my existing code above and say, okay, take the amount of resource that was just granted and set it equal to Team 2 Stolen, that does not work, because what if it was Team 3 or Team 16 that did the stealing?
I cannot think of a way to use the triggering player options correctly to set the value to where the player who triggered it gets an updated property that holds the amount they just stole.
TeamXStolen should be equal to the amount that TeamYDeposited in the button, which I already showed you how to do. Then, when a second button is pressed, an item granter runs its block, which says to give the triggering player X item, where X is the amount stored.
I’m sorry I’m slow on the uptake, I just like to understand how things work. Two of the components in the code are triggering players team number, and the other is triggering player’s score.
In my game the score is not based on the item being stolen, so the score seems obsolete with that in mind. And the team number also seems like it could screw up the code. Wouldn’t that mean that team 18 will always end up stealing more than team 3 because the value of their team number is larger?
No, because this example was coded wrong. Get score of team should be directly connected to triggering players team number, and THAT should be added to amount of bait.
(That is just overlap from my scrren not being big enough for one screenshot)