Index: scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua =================================================================== --- scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua (revision 1606) +++ scripts/zones/Northern_San_dOria/npcs/Vamorcote.lua (working copy) @@ -1,45 +1,87 @@ ------------------------------------ --- Area: Northern San d'Oria --- NPC: Vamorcote --- Type: Quest Giver --- @zone: 231 --- @pos: -137.070 10.999 161.855 --- --- Auto-Script: Requires Verification (Verified by Brawndo) ------------------------------------ -package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; ------------------------------------ - ------------------------------------ --- onTrade Action ------------------------------------ - -function onTrade(player,npc,trade) -end; - ------------------------------------ --- onTrigger Action ------------------------------------ - -function onTrigger(player,npc) - player:startEvent(0x028b); -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; - +----------------------------------- +-- Area: Northern San d'Oria +-- NPC: Vamorcote +-- Starts and Finishes Quest: The Setting Sun +-- @zone: 231 +-- @pos: -137.070 10.999 161.855 +-- +-- Auto-Script: Requires Verification (Verified by Brawndo) +----------------------------------- +package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; + +----------------------------------- +require("scripts/globals/quests"); +require("scripts/globals/settings"); +require("scripts/zones/Northern_San_dOria/TextIDs"); + +----------------------------------- +-- onTrade Action +----------------------------------- + +function onTrade(player,npc,trade) +-- "The Setting Sun" conditional script +theSettingSun = player:getQuestStatus(SANDORIA,THE_SETTING_SUN); + + if (theSettingSun == 1) then + count = trade:getItemCount(); + engravedKey = trade:hasItemQty(535,1); + if (engravedKey == true and count == 1) then + player:startEvent (0x0292) + end; + end; +end; + +----------------------------------- +-- onTrigger Action +----------------------------------- + +function onTrigger(player,npc) + -- Look at the "The Setting Sun" quest status and San d'Oria player's fame + theSettingSun = player:getQuestStatus(SANDORIA,THE_SETTING_SUN); + sanFame = player:getFameLevel(SANDORIA); + + + if (theSettingSun == QUEST_AVAILABLE) then + if (sanFame < 5) then + player:startEvent(0x028b); --The quest is not offered to the player. + else + player:startEvent(0x028e,0,535,535); --The quest is offered to the player. + end; + elseif (theSettingSun == QUEST_ACCEPTED) then + player:startEvent(0x028f); --The NPC asks if the player got the key. + else + player:startEvent(0x0293); --The quest is already done by the player and the NPC does small talks. + end; +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); + TheSettingSun = player:getQuestStatus(SANDORIA,THE_SETTING_SUN); + if(csid == 0x028e and option == 1) then --Player accepts the quest + player:addQuest(SANDORIA,THE_SETTING_SUN); + end; + + + if (csid == 0x0292)then --The player trades the Engraved Key to the NPC. Here come the rewards! + player:tradeComplete(); + player:addGil(GIL_RATE*10000); + player:messageSpecial(GIL_OBTAINED,GIL_RATE*10000); + player:completeQuest(SANDORIA,THE_SETTING_SUN); + player:addFame(SANDORIA,SAN_FAME*30); + end; +end; +