- Published on
Devlog #11 - XP & Quests
And we're going to start with xp! The xp tables are already available on the server but there's still much to do. When an actor is killed we need to calculate the amount of xp based on the player's level and the actors level. Then we need to update the player's xp and check for levelling up. Then we send out all the messages to the clients about xp, level up, killing, etc. That then leads to making a functional progress bar that I put over the skill hot bar.
Looking good but according to Discord chat I forgot the dividers. And with that let's move on to the start of quests.
For quests were going to need yet another lovely MySQL table named QuestionDefinitions and QuestionDefinitionTranslations. QuestDefinitions has an id, level required, json of variables to define the quest, xp reward, coin reward, item rewards. QuestDefinitionTranslations has the normal translation table stuff along with title, summary, description, during chat, finish chat, after chat.
Title:
The Nudening
Summary:
The secret behind your natural state will be revealed upon the slaughter of the fifth crab. A mysterious predicament, indeed.
Description:
Let's see about getting your clothes back, shall we? I'd imagine that killing 5 crabs should set you on your path to readornment. We don't take kindly to nudists here!
DuringChat:
It appears that you are still garmentless. Not a good look. You might want to get on that, nudie.
Oh, you don't know what you're doing? Sheesh. Click on a crab to select it. Click it again to activate battle mode. Click the corpse to collect loot. Rinse. Repeat. I'm not doing it for you.
FinishChat:
The only things I couldn't sell in town were your bit covers. You didn't think those crabs had anything to do with your exposure, did you? Oh, don't look at me like that; at least you got some XP. Here, take these clothes - hide your shame!
Oh... would you mind giving this to my niece if you see her? It looks important.
AfterChat:
Now, young adventurer, I have but one final piece of advice: go forth and kick butt!
Oh, and don't fall asleep. Those shops will buy almost anything, you know...
And there's the first quest text. The quest definition has a type of 0 for kill quest, a target id of 1 for the Crabby, and a target count of 5 for the completion requirement. We've got the tables and a bit of data, let's load this into the server and get things functioning.
In FO, quest data was sent to the client in pieces by the server over time as you worked on the quest, in AO the data was baked into the exe's data, and in FO2 I'm going to attach quest data to whatever gives out the quest, be it an npc or an item, etc. So now that I have all the QuestDefinitions and QuestDefinitionTranslations loaded onto the server, I can attach them to the NPCDefintions so that they are sent to the client with the ZoneDefinition. At that point I can parse out the quest data and show the quest start window when clicking a quest npc.
And all the data flowed. Now I need to make the quest window which will be for accepting/completing/dialog.
That's a start. Still need portraits and buttons. Let's get those working.
There we go. That looks nice. I'll add the player portrait later. Now I'm sending the quest accept message to the server and woo we're off and questing.
There's the during chat, now lets kill a few mobs and test the update quest on kill code. And 5 crabs later we get the finish quest text.
All that's left now is to complete the quest. This requires handing out rewards, updating the quest log, and updating the icons over quest npc heads (which aren't in yet).
And that's it for this week. In the coming week I will be finishing up quest code, equipping armor and weapons, adding quests/items/etc, and more.
See you next Friday!
Have Fun & Keep Gaming!
P.S. - Lighterthief has joined to make FO2 art the best it can be!