averatec
Advanced OT User
data/creaturescripts/scripts/rewards_onkill.lua
data/creaturescripts/creaturescripts.xml add
data/creaturescripts/scripts/login.lua
after
add
Can be more than one quest with this same monster
support 0.3.5+
#edit
fixed
Lua:
local quests =
{
{ 1111, "Rat", 30, 2160, 10, "Congratulations! You finished a first quest of Rats!" }, -- storage of starts quest, monster, count to kill, gift id, gift count, message on finish
{ 1112, "Demon", 100, 2400, 1, "Congratulations!" },
{ 1113, "Rat", 5, 2160, 2, "Congratulations! You finished a second quest of Rats!" }
}
function onKill(cid, target, lastHit)
if (not isMonster(target)) then
return false
end
for i=1, #quests do
if (getCreatureName(target) == quests[i][2] and not (getPlayerStorageValue(cid, quests[i][1]) > quests[i][3])) then
if (getPlayerStorageValue(cid, quests[i][1]) == -1) then
doPlayerSetStorageValue(cid, quests[i][1], 0)
end
doPlayerSetStorageValue(cid, quests[i][1], (getPlayerStorageValue(cid, quests[i][1])+1))
if (getPlayerStorageValue(cid, quests[i][1]) == quests[i][3]) then
doPlayerAddItem(cid, quests[i][4], quests[i][5])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, quests[i][6])
end
return true
end
end
return true
end
data/creaturescripts/creaturescripts.xml add
Code:
<event type="kill" name="Rewards OnKill" event="script" value="rewards_onkill.lua"/>
data/creaturescripts/scripts/login.lua
after
Code:
registerCreatureEvent(cid, "ReportBug")
Code:
registerCreatureEvent(cid, "Rewards OnKill")
Can be more than one quest with this same monster
support 0.3.5+
#edit
fixed
Last edited: