Hello,
i am currently working on a quest system for my game. and i want to make Quest Types Like Gather items type , Kill monsters Type , Go talk to someone mission etc. so my appraoch was like this :
a Class of Quests
public class Quest { public int ID; public string Title; public string Description; public string CongratulationText; public string Summary; public Status Status; public Goal Goal; public Reward Rewards; public int QuestGiverNPCID; public Quest(int iD, string title, string description, string congratulationText, string summary, Status status, Goal goal, Reward rewards) { this.ID = iD; this.Title = title; this.Description = description; this.CongratulationText = congratulationText; this.Summary = summary; this.Status = status; this.Goal = goal; this.Rewards = rewards; } public Quest() { this.ID = -1; } }
and the Goal class is :
public class Goal { public GoalType type; public Gather gather; public Kill kill; public GoTo goTo; public Goal(GoalType type, int ID, int AmountRequired) { this.type = type; if (type == QuestEnums.GoalType.Gather) { gather.itemId = ID; gather.AmountRequired = AmountRequired; gather.CurrentAmount = 0; kill.EnemyID = -1; } else if (type == QuestEnums.GoalType.Kill) { kill.EnemyID = ID; kill.AmountRequired = AmountRequired; kill.CurrentAmount = 0; gather.itemId = -1; } } public Goal(GoalType type, int ID) { if (type == QuestEnums.GoalType.GoTo) { goTo.NpcGiverID = ID; } else { throw new ArgumentException("Wrong type. or number of params does not match the required amount"); } } } public struct Kill { public int EnemyID; public int AmountRequired; public int CurrentAmount; } public struct Gather { public int itemId; public int AmountRequired; public int CurrentAmount; } public struct GoTo { public int NpcGiverID; }
The Goal class defines what kind of quests its going to be . for example it s a gather mission : i cant construct a new goal with type gather , item that is going to be picked and required amount. so this approach works. but i m not satisfied and im not convinced that this is a good approach it feels noobish and hacked not a solid design. so if it s possible to hear some good approaches and technics to achieve Goal quests :c and thank you for your time