Increasing Integers In Tables?
Basically, I have a item that displays part of a table, the table is used for counting the number of each different block the character currently has, so, I have the block displaying "Column 1, Row 8" - This is the section for the block Im referring to. Now, by default its set to 0, so, when the block is first achieved or gotten, I told it to change table value, Row 8 column 1, to value: (Self.Grass_Count)+ 1 Now, when testing this part, it worked, It displayed that I had 1 of that block, now, I can't figure out how to get it to simply just add to that number? I already have a rule so that if the block is already in slot 1 that the rule will be used to add to the count instead of spawning a new actor in slot 1, so basically, what do I need to do in order to now increase that integer of the table? I've already tried telling it "If there is a block of this type already in slot 1 change table value, Column 1 row 8, to value: +1 (AND I've also tried: (Self.Grass_Count)+ 1) Neither of these worked, please help!
Comments
You need to do a function so when adding to a table. When you add to the table are you using the write to table behavior?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Hi @iamjarrod see if I've got this right: if your table value is the same as an attribute (self.Grass_Count) then to update that table value with the attribute, you need to update the attribute itself first. So:
Change Attribute self.Grass_Count to self.Grass_Count+1
Then change table value (Row 8, column 1) to Grass_Count
On a side note, to mention that Tables are an excellent tool to use but aren't always needed... without more info about your block game, I'm wondering if you can do without a table in this case, and have all of your values - Grass_Count, etc just as attributes on their own. Just use Save & LoadAttribute behaviours to save them for continuing the game.. just a thought.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
You can do the math in the write to table behavior if you need to save the table value. Good practice for multiplayer.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS