Hello all, I hope you can help me with the following.
I’m trying to create a game with an upgrade system/ability system. (RPG like)
But as I plan to create a bunch of abilities, I was wondering what the best way is to implement such system.
At the moment, I use scriptable objects to store the abilities.
These scriptable object, I collect under the Character (also a scriptable object)
But I seem to be at a loss of how to add methods on the scriptable object Ability.
Should I just create abilities under the script that creates the scriptable object and somehow create the possiblity to add those methods to the Ability? And how would I do that?
Skill.cs:
namespace GameName{
[CreateAssetMenu(menuName = "RPG Generator/Player/Create Skill")]
public class Skills : ScriptableObject
{
public string Description;
public Sprite Icon;
public int LevelNeeded;
public List<PlayerSkills> neededUpgrades = new List<PlayerSkills>();
public List<PlayerSkills> atleastOneOfTheseUpgrades = new List<PlayerSkills>();
}
}
Character.cs:
namespace GameName
{
[CreateAssetMenu(menuName = "RPG Generator/Player/Create Character")]
public class Character : ScriptableObject
{
public new string name;
public Sprite thumbnail;
public int currentEnergy;
public int currentXP;
public int level;
public int maxEnergy;
public int nextNeededXP;
public int startingEnergy;
public List<UpgradedSkills> hasTheseUpgrades = new List<UpgradedSkills>();
public void SetXPLevel()
{
int tempXPNextLevel = 272;
for (int x = 0; x < level; x++)
{
tempXPNextLevel = (int)(tempXPNextLevel * 1.1f);
}
nextNeededXP = tempXPNextLevel;
}
}
PublicMethods.cs
namespace GameName
{
[System.Serializable]
public class PlayerSkills
{
public Skills skill;
public PlayerSkills(Skills skill)
{
this.skill = skill;
}
}
[System.Serializable]
public class UpgradedSkills
{
public Skills skill;
public int skillLevel;
public UpgradedSkills(Skills skill, int skillLevel)
{
this.skill = skill;
this.skillLevel = skillLevel;
}
}
}
So for an example. If in game, I want to activate function:
public void FirstSkill()
{
Debug.Log("Yes, I feel stronger! Though this ability doesn't do anything");
}
Where do I place this code and how do I connect 1 of multiple skills to this Method.
Any ideas?
I tried several online tutorials, but none really got me where I want to be.
Just for some more clarity about the project:
I’m trying to create a sort of mix of Yahtzee and RPG elements. What I’m trying now for instance, is making a dice worth more if you upgraded the ability for it. So for instance, the number 1 on the dice is now worth another point if you score it, which can happen when you try to score the Ones, but also at Three-of-a-kind, at Four-of-a-kind and at Chance. But shouldn’t trigger on any of the others, even when used to achieve it (like Yahtzee for instance)