Wednesday, March 26, 2014

2 Week Coding Project - Day 11 : Finalizing Professions

Tonight I finalized the gathering professions. I ended up going with a script that adds the character to a pool of gatherers for each specific type of item (Basic and Advanced Herbs, Basic and Advanced Ore). In doing so I also roughed out the system for character quests, which will take me another day to focus on. The script I went with can be found at the bottom of yesterday's post; but that's just the basic script for how the material is gathered.

In order to allow each character to have a different gathering type, and prevent the player from doubling up gathering professions on each character, I went with an integer system like the character class and role systems to set a "currentGathering" and a "newGathering" integer; which when a specific button is pressed, adds the new value into the PlayerPrefs, and then the current value is updated by that information.

Then it was all about duplicating the code to check what each characters PlayerPrefs variable for gathering was set to, and add them to the pool. Because it works off the PlayerPrefs system, it persists through a restart. This means that turning the game off and back on will not change your characters current gathering tasks, eliminating any type of micromanaging you would need to do each time you wish to play. If you find a system that continues to work for you, it wont be changed until you tell it to.

That's about it for my work from today, it doesn't seem like a lot; but it was a task that I spent a few hours with trial and error simply trying to make it work. Then the code had to be reconstructed for each character. It's all working now though, and from that the quest system should go a lot smoother.

No comments:

Post a Comment