How To Creat your own Quest

Program you will need to Work with script program 
Download: Visual C++ 2008 Redistributable Package (x64) - Microsoft Download Center - Download Details
Download: Visual C++ 2008 Redistributable Package (x86) - Microsoft Download Center - Download Details
Download: Microsoft .NET Framework 4 (Standalone Installer) - Microsoft Download Center - Download Details
Notepad++ v6.1.8 - Current Version

If you already have This Program Good don't Download this

Download:
Silkroad lua scripts:
Silkroad_Scripts.rar


1st step - lua scripts
Ok, first of all you'll have to create the lua script file for your new quest. To do that you create a new lua file in the "Quest" directory. I call it "@SN_QNO_TEST_QUEST.lua", but you can call it however you want I think. (I don't know if the "@" is really necessary but I'll be using it anyway)
Now open the file with any text editor (I'm using notepad++) and enter the following
PHP Code:
function QNO_TEST_QUEST() -- you should match this with your filename!
  
QUESTID LuaGetQuestID("QNO_TEST_QUEST") -- IMPORTANTmust match with the name in your database
  LuaSetStartCodition
(2QSC_QUESTQSC_LEVEL11)
  
QM_CONVERSATION 1
  LuaSetStartMethod
(QM_CONVERSATION1"NPC_CH_SMITH")
  
LuaInsertMissionOrCompleteNpc("NPC_CH_SMITH")
  
LuaQuestInsertNpc(1"NPC_CH_SMITH")
  
LuaSetAchievementLimit(1)
  
LuaSetMissionDataSize(QUESTID1)
  
LuaSetMissionData_EX(QUESTID0MISSION_TYPE_KILL_MONSTER"SN_CON_QNO_TEST_QUEST"1"MOB_CH_MANGNYANG"02001)
  
InsertQuestMenuStringList("NPC_CH_SMITH"8"BASIC_MENUSTRING_GREETING""SN_NPC_CH_POTION_QS""BASIC_MENUSTRING_REQUEST_ACCEPT_QUEST""SN_TALK_QNO_TEST_QUEST_01""BASIC_MENUSTRING_AT_ACCEPT""SN_TALK_QNO_TEST_QUEST_02""BASIC_MENUSTRING_AT_DENY""SN_TALK_QNO_TEST_QUEST_03""BASIC_MENUSTRING_NOT_ACHIEVED""SN_TALK_QNO_TEST_QUEST_04""BASIC_MENUSTRING_INVENTORY_FULL""SN_TALK_QNO_TEST_QUEST_05""BASIC_MENUSTRING_ACHIEVED""SN_TALK_QNO_TEST_QUEST_06""BASIC_MENUSTRING_ACHIEVED_NOW""SN_TALK_QNO_TEST_QUEST_07")
  
LuaSetMissionCompleteNum(0)
  
PAY_ITEM_METHOD_EXACT 1
  LuaSetAchievedItem
(17200001"ITEM_MALL_GLOBAL_CHATTING"10)
  
LuaSetAchievedSkillPont(0)end  
I'm not going to explain the whole lua code, just a few tips:
- LuaGetQuestID("QNO_TEST_QUEST") must match with the quest name in your database!
- LuaSetStartCodition(2, QSC_QUEST, QSC_LEVEL, 1, 1) describes that the quest with the questId "1" & char level "1" is required to start the
quest
- LuaSetAchievedItem(1, 7200, 0, 0, 1, "ITEM_MALL_GLOBAL_CHATTING", 10) selfexplaining, if you finish the quest you'll get 7200 exp & 10 global chattings

Just look around in other quest files and it'll become clear.

Now save the file and open "QuestList.lua"
Add a new line to the end of the file with the following
PHP Code:
LuaInsertQuest(TYPE_ID"SN_QNO_TEST_QUEST.lua""QNO_TEST_QUEST")  

The second & third parameter should of course match the filename & the function name of your quest!

Now, if you are done with that, execute make_questlist.bat and make_quest.bat. This should create two new files, QuestList.sct and Quest.sct. Copy them to YOURSERVER\Script\VIETNAM or YOURSERVER\Script\THAILAND if you are using black rogue files. (make sure you made a backup of the old files)

2nd step - database
Insert the following lines to the shard database:
_RefQuest
Code:
1 816 QNO_TEST_QUEST 0 <??>???? ?? SN_QNO_TEST_QUEST SN_PAY_QNO_TEST_QUEST xxx SN_PAYCON_QNO_TEST_QUEST SN_NN_QNO_TEST_QUEST SN_NC_QNO_TEST_QUEST
QNO_TEST_QUEST should match your quest name!

_RefQuestReward
Code:
1 [ID] QNO_TEST_QUEST 1 1 1 0 0 0 0 0 7200 0 0 0 xxx 0 0 0 0 0 xxx 0 xxx 0 xxx
[ID] of _RefQuest table

_RefQuestRewardItems (only if item reward, in my case the reward will be 10 global chattings)
Code:
1 [ID] QNO_TEST_QUEST 0 ITEM_MALL_GLOBAL_CHATTING xxx 0 10 xxx 0 xxx 0 xxx
[ID] of _RefQuest table
NOTE: If you want to reward multiple items then you'll also have to add multiple lines to the table. (of course, you'll have to modify the lua script too)

Ok, now you are done with the database! If you now start your gameserver you'll hopefully see a new quest initialization!


If you cannot see that, or it shows quest initialize[0][questname], then you have obviously did something wrong

3rd step - client
You have completely added a new quest now! Wait... but only server sided, you'll have to add the quest in the client too. I'm going to show you how to do that. (because I'm great, haha)
Anyways, just follow me, I'm not going to explain everything.

You have to insert a couple of lines. So let's start with the file:
(by the way all files are located at media\server_dep\silkroad\textdata)

questdata.txt
Code:
1 [ID] QNO_TEST_QUEST 0 <??>???? ?? SN_QNO_TEST_QUEST SN_PAY_QNO_TEST_QUEST xxx SN_PAYCON_QNO_TEST_QUEST SN_NN_QNO_TEST_QUEST SN_NC_TEST_QUEST
[ID] of _RefQuest table
Here too, match QNO_TEST_QUEST with your quest name!

questcontentsdata.txt
Code:
QNO_TEST_QUEST 0 0 xxx 1 SN_CON_QNO_TEST_QUEST xxx xxx xxx xxx xxx xxx xxx 0 xxx xxx 0
refqusetreward.txt
Code:
[ID] QNO_TEST_QUEST 1 1 1 0 0 0 0 0 0 7200 0 0 0 xxx 0 0 0 0 xxx 0 xxx 0 xxx
[ID] column of _RefQuest table
Well, basically it's the same as _RefQuestReward table in your database. 

refquestrewarditems.txt
Code:
[ID] QNO_TEST_QUEST 0 ITEM_MALL_GLOBAL_CHATTING xxx xxx 0 10 0 xxx 0 xxx
[ID] column of _RefQuest table
It's the same as _RefQuestRewardItems in your database.
Remember, multiple item rewards = multiple lines!
See the number "10"? This is the amount of global chattings 

textquest_queststring.txt
Code:
1 SN_TALK_QNO_TEST_QUEST_01 0 0 0 0 0 0 Kill 15 mangyangs lols. 0 0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_02 0 0 0 0 0 0 Good. I knew that you would agree to do this. I'll reward you more than enough, of course. 0  0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_03 0 0 0 0 0 0 Hmm. I've misjudged you. 0 0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_04 0 0 0 0 0 0 Please kill a few more mangyangs please. 0 0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_05 0 0 0 0 0 0 I want to reward you but your inventory is full. Please dispose of some unneccessary items first.  0 0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_06 0 0 0 0 0 0 Thank you. Now I can sleep well. This is your reward. Take this. 0  0 0 0 0 0 0 
1 SN_TALK_QNO_TEST_QUEST_07 0 0 0 0 0 0 The hunting of Mangyangs is completed. Go and report to Chulsan. 0 0 0 0 0 0 0
These are the different tabs in the NPC, write whatever you want.

textquest_speech&name.txt
Code:
1 SN_QNO_TEST_QUEST 0 0 0 0 0 0 Test quest 0 0 0 0 0 0 0 
1 SN_PAY_QNO_TEST_QUEST 0 0 0 0 0 0 Test quest 0 0 0 0 0 0 0 
1 SN_CON_QNO_TEST_QUEST 0 0 0 0 0 0 Hunt 20 Mangyang (%d) 0 0 0 0 0 0 0
Your quest name and the task.


Done!

Nenhum comentário:

Postar um comentário