Problem with class hot swap


Reported by: Eldar Bertsel

September 21, 2023

THE PROBLEM

When I started creating classes, having one class was no problem. All the stats, models and abilities where correct, but when I added multiple classes, each having different model, stats and abilities and started swapping them,  current class would be overridden with the information of the next class to which the player would swap resulting in one class left regardless of which class you chose to swap. Basically, you started playing as a knight, then swapped to a magician, then swapped to rogue. Knight would now have all the parameters of the Magician class, Magician class would now have all the parameters that Rogue class has. If you click long enough you can make it so every class is the same thing. Unfortunately, it also saved those changed when I closed the game mode so I had to fill out the information for each class again. 

THE SOLUTION

To solve that issue I had to create a temp variables each parameter of the class, then, when swapping the parameters I would first assign them to those temp variables and in another function I would take a value from the tamp and assign it to the actual parameters of the current class that should take place. Figuring out that I need a temp value to hold the data took me a lot of time because I was trying to find a way where I could directly swap parameters, but it is either I was doing something wrong or you must have to have a temp value. 

Get Psyche

Leave a comment

Log in with itch.io to leave a comment.