Good morning. I’m replicating the Ogame game in UE4, but I’m not able to continue the way I want to. I don’t have much experience with blueprints and I know there is a way to solve my problem.
My goal is to introduce the same object multiple times in the scene, and perform the same function as the others, but calling different variables that I select from the ‘Details’ screen.
I have created a ‘Manager’ with two variables ‘Materia’ and ‘Materia2’ (Im deciding the names), which are the resources of the game, plus two more (MateriaPH - MateriaPH2) which would be the resources that are being added every second.
The other script is an event that adds to MateriaPH another float, something very basic. In this way, every second the amount of MateriaPH is added to ‘Materia’, which is the amount that should be added every hour, divided by 3600.
If I could have the ability to select between ‘Materiaph’ and ‘Materiaph2’, and so on with more variables I want to create, is there any option? Thank you very much.
I want to turn you towards a little node that a lot of people don’t realize is there: The Select node.
With the select node, you can do something like this. I did a mock-up to show you exactly what to do, now you’ll just have those values set up and when you want to pull a specific variable, you just change the selector’s index and BOOM done.
Wow, i knew that there was an easy solution , i think that this is the correct way, but i found a problem in the second Blueprint. In the ‘Mejoras’ screen, everything arrives at the set node, with ‘MateriaPH’, variable. I need to choose the set variable between ‘MateriaPH’ and ‘Materia2PH’, you know how to do it? Thank you very much for your time
Yes, there is a reason. ‘Mejora Niveles’ (Improve Levels) In Ogame, you can upgrade your building a lot of times, and when you upgrade it, the game improve the variable that i called ‘MejoraPH’. Depend of the level, i can manage how much resources per hour i give to the player. The vector is just because i can reference X as the upgrade, Y as the cost and Z… i dont know right now. Its like an array of 3 floats in one line.
Hey @Esehantoniko! Sounds good. Not many realize you can use vectors that way
So what I PERSONALLY would do to fix your Materia PH issue is simply change the MPH at the source, so when it changes, it will change here as well.
Otherwise, I would make a branch or select that would be determined by a bool (MPH1orMPH2, True or False) or an Integer with the selector like I showed you earlier (Which MPH do I use? I will determine with this number!)
Welcome to the Unreal Engine forums @Esehantoniko and happy holidays!
This topic has been moved from International to Programming & Scripting: Blueprint.
When posting, please review the categories to ensure your topic is posted in the most relevant space. This post has been moved to help other devs with a similar question.