Tipologie server: pvm
*Resursă folosită: braxy
*ServerFiles utilizat: -
*Syserr: -
Poză:
*Detalii suplimentare: am acest quest, ca model. ma interesa sa dea un bonus cand termini misiunea si sa fie permanent
Cod: Selectaţi tot
quest huntingQuest_1 begin
state start begin
function GetData()
return {
["reqInfo"] = {{101, 5}, {102, 3}}, -- you can leave just one if you dont want more
["minimumLevel"] = 2,
["missionName"] = "Hunting Quest I",
["questRewads"] = {{70038, 20}, {71015, 1}, {apply.ATT_SPEED}}
};
end
when login or enter or levelup begin
local mInfo = huntingQuest_1.GetData()
if (mInfo["minimumLevel"] > pc.get_level()) then
return
end
for index, rInfo in ipairs(mInfo["reqInfo"]) do
local strFlag = string.format("huntingContor_%d", index)
pc.setf("huntingQuests", strFlag, rInfo[2])
end
send_letter(mInfo["missionName"]);
end
when button or info begin
local mInfo = huntingQuest_1.GetData()
say_title(string.format("%s:[ENTER]", mInfo["missionName"]))
say("You have to kill the following monsters:")
local bIsMissionOver = true
for index, rInfo in ipairs(mInfo["reqInfo"]) do
local strFlag = string.format("huntingContor_%d", index)
local monsterLeft = pc.getf("huntingQuests", strFlag)
if (monsterLeft > 0) then
bIsMissionOver = false
end
local strStatus = (monsterLeft < 1) and "completed" or tostring(monsterLeft);
say(string.format("- %s: %s", mob_name(rInfo[1]), strStatus))
end
if (bIsMissionOver) then
for _, mReward in ipairs(mInfo["questRewads"]) do
pc.give_item2(mReward[1], mReward[2])
affect.add_collect( mReward[3],5,60*60*24*365*60)
end
say("Congrats, you completed the mission!")
say("You got rewarded for completing it!")
-- example: set_quest_state("huntingQuest_2", "run")
set_quest_state("huntingQuest_2", "run")
set_state("done")
end
end
when kill begin
local mInfo = huntingQuest_1.GetData()
for index, rInfo in ipairs(mInfo["reqInfo"]) do
if (npc.get_race() == rInfo[1]) then
local strFlag = string.format("huntingContor_%d", index)
local monsterLeft = pc.getf("huntingQuests", strFlag)
if (monsterLeft > 0) then
pc.setf("huntingQuests", strFlag, (monsterLeft - 1))
end
return
end
end
end
end
state done begin
when login or enter begin
clear_letter();
q.done();
end
end
end



