- Home /
Help with RPG
Here is a flowchart of what im trying to achieve
Link: http://i.imgur.com/9ssHH.png
A list of characters with the same attributes but different stats. What would be the most efficient or recommended way to go about storing this data bare in mind that the characters wont always be instantiated only the current team members and during battle. This is also single player just to clarify.
The first route i thought of taking was an array of a custom class to hold each characters data. The other way was to create an instance script with can be dragged onto each prefab and modified like that? I'm just unsure on which approach to take because I'm going to want to save data to the playerprefs as well as load it.
Any thoughts, ideas or examples are welcome, thanks, Carl.
Answer by Chris D · Jul 14, 2011 at 06:27 PM
My immediate impulse is to do something like the following:
GameManager (Persistent gameObject holding the script to handle overall logic)
PlayerHandler (Any logic that pertains to players)
PlayerArray (An array of type `PlayerStats`)
IndividualPlayerStats (A Struct containing the needed stats)
Attack (int)
Defense (int)
Magic (int)
I think a centralized approach is best (and possibly the only practical option) as you don't have to worry about grabbing components from each character every time you need to update something and when you want to dump it externally it's all right there for you.
Answer by barnabasborn.du · Jan 08, 2012 at 09:21 AM
I would make a Character_Basic class with the vitals/stats and functions that all characters will need then make Character_Player, Character_NPC_Allied, Character_NPC_Hostile, and Character_NPC_Neutral all inherit from Character_Basic. Is that what your trying to do?
Your answer
Follow this Question
Related Questions
Need help with PlayerPrefs 2 Answers
whats the best way to save a large list of variables? 1 Answer
PlayerPrefs save after quit? 2 Answers
Making a less complicated save system. 2 Answers
is it safe to save info in PlayerPrefs? 2 Answers