Posted: Mon Mar 06, 2017 12:07 am |
|
I have been trying to develop a quest system to replace the old one in the v2 server, however I'm kind of lacking in knowledge and have only come up with a rudimentary system that might not be very efficient.
Right now I've made a separate data structure containing all variables a quest might need:
http://pastebin.com/drqVANik
As you can see each quest may have up to 10 objectives. Right now there are 3 objective IDs: 1 for delivering item, 2 for killing monster class and 3 for killing 1 monster from a defined template (for boss killing).
Every character has a "quest[100]" variable that holds their progress on each quest. (100 quests total - can be changed)
This is what I commented below the definition:
Players hold the state of each quest within the last digit of this variable. (quest[#]%10-1)
*Amount of monsters slain for objective type 2 is referenced as "quest[#]/10"
*Started quests have state of 1 or higher.
*Completed quests have state 10. (last digit 9, hence the -1)
|
This means I cannot have multiple type 2 objectives (monster class killing) since the number of monsters slain is stored in the quest variable's second digit and beyond.
This ended up being somewhat weird and un-intuitive. I wanted to avoid making a 2d array inside the character structure because of size reasons.
Any other way to do this? Sorry C veterans, I'm pretty new to this