I’m creating Pokemon-esk RPG game and decided to make the creatures scriptable objects.
Each object has the values of Name, Max Health, Current Health, and Attack List.
I’ve made it so a Slider acts as a health bar and lowers the Scriptable Objects “Current Health Integer”. However after testing that out and stopping the program, the value in the Scriptable Object didn’t change back to its original value.
Is there a way to prevent this?
So, if I understand the code correctly…
You’re creating a public class in the Monster’s scriptable Object that contains the data for said Monster. and the rest of the code is instantiating an a MonsterObject with those stats?
And as for the MonsterObject, it lists codes for changing health and attacking.
I tried to Copy Paste the code just to see what it would do, but I ran into a couple errors.
mo.Init(Monsters[ID]); gave me an error that said it couldn’t convert Monster.MonsterDefinition to MonsterDefinition.
Also, MonsterDefinition in MonsterObject could not be recognized.
I think I see where the code is going, but I’m still having difficulty implementing it.
@MasonXY Unfortunately you can’t stop it from overwriting itself but you can work around it by having your creature script take values from the ScriptableObject instead of editing them directly.