Hey guys im stuck on this right now. I want to change a variable in a data table but not directly from the data table itself but from an outside bp acctually a widget. I want from this bp to change 1 value on a float variable so then the data table “knows” it has a new value set permament for it. How could i achieve that the easy way ?
If i set it like this and it acctually partially works but not as it should. It print strings the right value but somehow it doesn’t apply it directly in the data table. Another bp access this data table to build this trap and it still takes the default value set in the data table and not the new one.
To be more specific what happens is that the logic above works - i can slam an artefact on this trap then the value “Gold cost” reduces correctly. There is only this trap called spike trap with this value so i know it apply to it correctly and it draw the value from the data table so im sure this part works as the print string shows me the correct value as well. Then a second BP comes in play which is for building the trap and here is the part where it doesnt work anymore. When building the trap it access the same data table to check how much does it cost to build it and then it spawns the trap. The problem then is that it takes the default value set in the data table as if the above code didn’t apply. I hope this helps to break this down.
Is “read-only” means that once the data table is set there is no simple way to change any values in it in game? Like crafting materials where i craft something and it changes any value of this data table - would this not work somehow and is there not any simple way to do this ?
Correct, once set in the editor can’t be change while ingame.
For example, we used Item (with itemID, description, title) in the data table, but the quantity we save it via a variable so we store ItemID with Quantity in a game instance.
(thought some use data asset too but am not too familiar with this)
Oh ok. I will try to make the stats as extra variables then and not directly pull the info from the data table. ty
Just tested this out and everything works and it was really simple to just create an extra variable for this. Thx again
Edit: It looks this isn’t as simple as i initially tought it would be. Once i decouple the 1 variable which was the building cost of my trap, then all my logic breaks apart when selling or placing traps. Because it line trace and draws the info from the data table to check if it hits the right trap i would need to add them 1 by 1 in the code and make something like "if trap X is = to this trap then get the trap cost extra variable and calculate the current cost of it and if it can build or not and so on… Then i need to redo this for placing traps and selling traps like 20x times for each trap separate and it overcomplicate the whole thing by a lot. There must be some other solution maybe with the Data assets or something but else it makes no scence to even use data table if i have to redo all the code for each trap individualy and add them 1 by 1.