Customizing Your Server
Once you know how to build and configure your server correctly, the next thing you may want to know is how to tweak it to your liking
Contents
What can I change?
Since the project is open-source, the answer to that is: Absolutely anything, as long as you do not violate the terms of the GPLv2 or newer.
Where do I change things?
Common Options
A lot of the options can be found in scripts/globals/settings.lua including Initial level cap, maximum level allowed on the server, starting gil, starting inventory, unlocking subjobs by default, unlocking advanced jobs by default, and a plethora of other settings to tweak your server. See the file itself for details.
Adjusting Experience
Experience rate can be found in conf/map_darkstar.conf. Change exp_rate: to whatever multiplier you want. If you set it to 2.0 it will give you double experience for all monsters as per the experience tables.
If you prefer to modify the experience granted directly, you can find those values in the exp_table mysql table. To change the amount of experience required to progress to the next level, modify the exp_base mysql table.
Default Character Speed
To adjust the default character run speed, edit src/map/baseentity.cpp and look for a line that says
speed = 40;
and modify it accordingly. Maximum effective value is 255, and the official test server uses 60.
Starting Jobs and Levels
If you want to change the default starting level for any/all jobs, in the char_jobs table, you need to set the default value for each 3-letter job code to what you want to be the starting level for that job.
You can also change the jobs you have unlocked by default here, but it is easier to use settings.lua if you want to unlock all jobs at the start. Nevertheless, if you wish to tweak exactly what jobs are unlocked, you can adjust the 'unlocked' field by adding together the values of all the jobs you desire below.
Job Name | Value |
---|---|
Subjob | 1 |
Warrior | 2 |
Monk | 4 |
White Mage | 8 |
Black Mage | 16 |
Red Mage | 32 |
Thief | 64 |
Paladin | 128 |
Dark Night | 256 |
Beastmaster | 512 |
Bard | 1024 |
Ranger | 2048 |
Samurai | 4096 |
Ninja | 8192 |
Dragoon | 16384 |
Summoner | 32768 |
Blue Mage | 65536 |
Corsair | 131072 |
Puppetmaster | 262144 |
Dancer | 524288 |
Scholar | 1048576 |
Adjust Healing while Resting
In scripts/globals/effects/healing.lua find the lines:
target:addHP(10+(3*math.floor(target:getMainLvl()/10))+(healtime-2+(1+math.floor(target:getMaxHP()/300)))+(target:getMod(MOD_HPHEAL)));
target:addHP(10+(healtime-2)+(target:getMod(MOD_HPHEAL)));
target:addMP(12+(healtime-2)+(target:getMod(MOD_MPHEAL))+(target:getMod(MOD_CLEAR_MIND)*(healtime-2)));
and adjust the 10, 10, and 12 appropriately to change the base healing amounts.
Miscellaneous Changes
To change the name your server provides when people log in, replace all instances (currently 2) of DarkStar in src/login/lobby.cpp with whatever you want.
Player Bonuses NPC
To make an NPC that adds things like maps, jobs, and spells will require a basic understanding of LUA scripting and logic. Refer to How to Make a Quest for a good primer. If all else fails, find an NPC that does what you want and read their code.
First, select the NPC you'd like to modify. The method used on Whasf's server is the "Adventurer's Coupon" turn in, but it's really up to you. Their logic can be located in /dsp/scripts/zones/zone_name/npcs/npc_name.lua. If the file doesn't exist, you can create it from a text document; just make sure it follows the npc_name.lua convention, and not .txt.
Second, decide what has to be done to trigger the bonuses. Just talk to the NPC? Trade an item? Meet specific conditions, such as being Rank 2, or under level 20? Code your conditions accordingly.
Third, program your unlocks. Refer to ID References for full details on key items, maps, spells, and items. The following code samples cover a few basic rewards:
-- Adds all maps player:addKeyItem(385); player:addKeyItem(386); player:addKeyItem(387); player:addKeyItem(388); -- ITEMS 389 to 447 z = 389; while z <= 447 do player:addKeyItem(z); z = z + 1; end -- KEY ITEMS 1856 to 1893 z = 1856; while z <= 1893 do player:addKeyItem(z); z = z + 1; end -- Adds all 3 starting nation rings player:addItem(13495); player:addItem(13496); player:addItem(13497); -- Unlocks subjob player:unlockJob(0); -- Grants gil and gives the appropriate message player:addGil(500000); player:messageSpecial(GIL_OBTAINED,500000); -- Grants a small amount of fame player:addFame(BASTOK, BAS_FAME*10); player:addFame(SANDORIA,SAN_FAME*10); player:addFame(WINDURST,WIN_FAME*10); player:addFame(NORG, NORG_FAME*10); -- Unlocks Dark Knight player:unlockJob(8);
Finally, test your NPC for bugs. If anything is wrong, you'll see error messages in the DSGame-server window of your server. Make sure you haven't missed a semi-colon, left a parenthesis open, or missed an "end" after an "if."