Super new to blueprints, some coding knowledge but no practice for AGES. I’m trying to develop a simple game for learning purposes.
It’s a single-player game, takes places purely on UI (kinda similar to mobile tycoon-idle games)
I have a main game mode where I want to store my main functions.
I created structs for resource and building (keeps costs, names, gain rates etc).
I created a function to build buildings, which takes a resource, a building and a count as a parameter, by reference… Obvious but to be on the same page, resource is a resource struct type that you’ll use to build that building; building is the building struct that you are going to build and count is how many you want to build (I may put x5 x10 build buttons).
It does the following: (Bolds are variables/struct members)
Check if resource amount >= **count *** building cost
if no, print an error and return
if yes, calculate resource amount - count * building cost, and set the **resource amount **to that.
then calculate **building amount **+ count, and set the **building amount **to that.
I used “Get param”, pinned to a “set member in struct” to set the new amounts.
It’s working. The variables are updated and I see them on UI (text box bind to those vars) but I’m getting a Warning saying “Param X” is a read only property and can not be modified directly, marked on the Get Param pin.
If it’s read-only, how is this working? If it’s writeable, why do i get this error?
I don’t have Const or Pure checked for the function, although I do see the Read only flag (not changeable from what I see)
What’s good way to do this?
Get values not by reference, assign-promote to local vars, then return them as output and assign them outside? The whole point of this function was to have a simple on-click event, if I have to manually assign points for each resource, it’s going to be annoying