Difference between revisions of "Customizing Your Server"

From DSP Wiki
Jump to: navigation, search
m (Player Bonuses NPC)
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
== What can I change? ==
 
== 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 [http://www.gnu.org/licenses/gpl-2.0.html GPLv2] or [http://www.gnu.org/licenses/gpl.html newer].
+
As far as the server goes, since the project is open-source, the answer to that is: Absolutely anything, as long as you do not violate the terms of the [http://www.gnu.org/licenses/gpl-2.0.html GPLv2] or [http://www.gnu.org/licenses/gpl.html newer].
 +
 
 +
There are some limitations, though.  In some cases such as spells, the client is programmed to know what is possible.  If, for example, you give a Paladin the spell "Fire," the client knows that this is impossible and will not allow the spell to be cast under any circumstances unless the Paladin would gain it from a correct method, such as having Black Mage as a subjob.  This also applies to level.
 +
 
 +
Note that this list may not match what you're used to seeing in retail, which is why Red Mage has spells like Hastega on their spell list if you use @addallspells.  Things like equipment levels and job requirements, as well as Dual wield are enforced in a similar manner.  However, job abilities can be swapped around with relative ease.
 +
 
 +
Another common question is changing NPC/monster names.  While the appearances are determined by the server, the client has a list of names that belong to specific entity IDs (monsters and NPCs) in any given zone.  You might see that they're named in the database, but that's for scripting and identification purposes.  Those names have no bearing on what you'll see in-game.  So the short answer is, you can't.  The long answer is you'd have to decipher the DATs and edit them to change the name, and then distribute a tool to automatically make those changes for your players.
  
 
== Where do I change things? ==
 
== Where do I change things? ==
  
 
=== Common Options ===
 
=== 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.
+
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.
 +
 
 +
Note that some of the options are not in use, but the ''ENABLE_'' series along with the ''Character Config'' section will cover many popular requests, and should be largely working.  Harvesting settings, ''Dynamis Settings'', AF settings, FIELD_MANUALS, and EXPLORER_MOOGLE and level cap will also be working, to easily control those features.
  
 
=== Adjusting Experience ===
 
=== Adjusting Experience ===
Line 46: Line 54:
 
|Paladin||128
 
|Paladin||128
 
|-
 
|-
|Dark Night||256
+
|Dark Knight||256
 
|-
 
|-
 
|Beastmaster||512
 
|Beastmaster||512
Line 81: Line 89:
 
<code>target:addHP(<span style="color:#ff0000">10</span>+(healtime-2)+(target:getMod(MOD_HPHEAL)));</code>
 
<code>target:addHP(<span style="color:#ff0000">10</span>+(healtime-2)+(target:getMod(MOD_HPHEAL)));</code>
  
<code>target:addMP(<span style="color:#ff0000">12</span>+(healtime-2)+(target:getMod(MOD_MPHEAL))+(target:getMod(MOD_CLEAR_MIND)*(healtime-2)));</code>
+
<code>target:addMP(<span style="color:#ff0000">12</span>+((healtime-2) * (1+target:getMod(MOD_CLEAR_MIND)))+(target:getMod(MOD_MPHEAL)));</code>
  
 
and adjust the 10, 10, and 12 appropriately to change the base healing amounts.
 
and adjust the 10, 10, and 12 appropriately to change the base healing amounts.
Line 88: Line 96:
 
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.
 
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 ===
+
=== Perks 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.
+
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 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.
+
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 /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.
 
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.
Line 98: Line 106:
  
 
<pre>
 
<pre>
-- Adds all maps
+
-- Adds all maps (Pre-SoA, no Dynamis)
 
player:addKeyItem(385);
 
player:addKeyItem(385);
 
player:addKeyItem(386);
 
player:addKeyItem(386);
Line 135: Line 143:
 
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."
 
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."
  
 
+
These can also be triggered in /scripts/globals/player.lua inside the CharCreate() function to grant them to new characters as they're created.
i (mvd1987) have made some changes on the script so you also have al jobs unlocked, al teleport crystals,airpas,airpas kazham and choco licence :)
+
i will edit more when im ready (working on all avatars and more)
+
 
+
this is the edit script now:
+
 
+
-- Adds all maps
+
player:addKeyItem(385);
+
player:addKeyItem(386);
+
player:addKeyItem(387);
+
player:addKeyItem(388);
+
                player:addKeyItem(138);
+
                player:addKeyItem(352);
+
player:addKeyItem(353);
+
player:addKeyItem(354);
+
player:addKeyItem(355);
+
player:addKeyItem(356);
+
player:addKeyItem(357);
+
player:addKeyItem(9);
+
player:addKeyItem(8);
+
player:addKeyItem(WHISPER_OF_FLAMES);
+
player:addKeyItem(WHISPER_OF_FROST);
+
player:addKeyItem(WHISPER_OF_GALES);
+
player:addKeyItem(WHISPER_OF_STORMS);
+
player:addKeyItem(WHISPER_OF_TIDES);
+
player:addKeyItem(WHISPER_OF_TREMORS);
+
player:addKeyItem(WHISPER_OF_THE_MOON);
+
-- 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 all jobs
+
player:unlockJob(8);
+
player:unlockJob(7);
+
player:unlockJob(9);
+
player:unlockJob(10);
+
player:unlockJob(11);
+
player:unlockJob(12);
+
player:unlockJob(13);
+
player:unlockJob(14);
+
player:unlockJob(15);
+
player:unlockJob(16);
+
player:unlockJob(17);
+
player:unlockJob(18);
+
player:unlockJob(19);
+
player:unlockJob(20);
+
 
+
 
+
 
+
 
+
 
+
 
+
and here is how i use it in the game:
+
 
+
at C:\dsp\scripts\zones\Bastok_Mines\npcs you search for npcs you want, i choose dry bones.
+
and edit it like this:
+
 
+
-- Area: Bastok Mines
+
-- NPC: Dry Bone
+
-- Standard Info NPC
+
-----------------------------------
+
 
+
 
+
package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil;
+
require("scripts/zones/Bastok_Mines/TextIDs");
+
 
+
-----------------------------------
+
-- onTrade Action
+
-----------------------------------
+
 
+
function onTrade(player,npc,trade)
+
end;
+
 
+
-----------------------------------
+
-- onTrigger Action
+
-----------------------------------
+
 
+
function onTrigger(player,npc)
+
-- Adds all maps
+
player:addKeyItem(385);
+
player:addKeyItem(386);
+
player:addKeyItem(387);
+
player:addKeyItem(388);
+
                player:addKeyItem(138);
+
                player:addKeyItem(352);
+
player:addKeyItem(353);
+
player:addKeyItem(354);
+
player:addKeyItem(355);
+
player:addKeyItem(356);
+
player:addKeyItem(357);
+
player:addKeyItem(9);
+
player:addKeyItem(8);
+
player:addKeyItem(WHISPER_OF_FLAMES);
+
player:addKeyItem(WHISPER_OF_FROST);
+
player:addKeyItem(WHISPER_OF_GALES);
+
player:addKeyItem(WHISPER_OF_STORMS);
+
player:addKeyItem(WHISPER_OF_TIDES);
+
player:addKeyItem(WHISPER_OF_TREMORS);
+
player:addKeyItem(WHISPER_OF_THE_MOON);
+
-- 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 all jobs
+
player:unlockJob(8);
+
player:unlockJob(7);
+
player:unlockJob(9);
+
player:unlockJob(10);
+
player:unlockJob(11);
+
player:unlockJob(12);
+
player:unlockJob(13);
+
player:unlockJob(14);
+
player:unlockJob(15);
+
player:unlockJob(16);
+
player:unlockJob(17);
+
player:unlockJob(18);
+
player:unlockJob(19);
+
player:unlockJob(20);
+
player:startEvent(0x1A);
+
end;
+
 
+
-----------------------------------
+
-- onEventUpdate
+
-----------------------------------
+
 
+
function onEventUpdate(player,csid,option)
+
--printf("CSID: %u",csid);
+
--printf("RESULT: %u",option);
+
end;
+
 
+
-----------------------------------
+
-- onEventFinish
+
-----------------------------------
+
 
+
function onEventFinish(player,csid,option)
+
--printf("CSID: %u",csid);
+
--printf("RESULT: %u",option);
+
end;
+
 
+
 
+
 
+
 
+
i hope you guys can use this or it makes things easyer for you :)
+

Latest revision as of 07:47, 13 June 2013

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

What can I change?

As far as the server goes, 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.

There are some limitations, though. In some cases such as spells, the client is programmed to know what is possible. If, for example, you give a Paladin the spell "Fire," the client knows that this is impossible and will not allow the spell to be cast under any circumstances unless the Paladin would gain it from a correct method, such as having Black Mage as a subjob. This also applies to level.

Note that this list may not match what you're used to seeing in retail, which is why Red Mage has spells like Hastega on their spell list if you use @addallspells. Things like equipment levels and job requirements, as well as Dual wield are enforced in a similar manner. However, job abilities can be swapped around with relative ease.

Another common question is changing NPC/monster names. While the appearances are determined by the server, the client has a list of names that belong to specific entity IDs (monsters and NPCs) in any given zone. You might see that they're named in the database, but that's for scripting and identification purposes. Those names have no bearing on what you'll see in-game. So the short answer is, you can't. The long answer is you'd have to decipher the DATs and edit them to change the name, and then distribute a tool to automatically make those changes for your players.

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.

Note that some of the options are not in use, but the ENABLE_ series along with the Character Config section will cover many popular requests, and should be largely working. Harvesting settings, Dynamis Settings, AF settings, FIELD_MANUALS, and EXPLORER_MOOGLE and level cap will also be working, to easily control those features.

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 Knight 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) * (1+target:getMod(MOD_CLEAR_MIND)))+(target:getMod(MOD_MPHEAL)));

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.

Perks 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 /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 (Pre-SoA, no Dynamis)
		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."

These can also be triggered in /scripts/globals/player.lua inside the CharCreate() function to grant them to new characters as they're created.