Darad
New Member
- Joined
- Jun 23, 2009
- Messages
- 119
- Reaction score
- 1
Simple easy to use quest mod. Add unique id of the chest to the config array, add rewards and storageValue, you're done
Players can now receive exp too. Don't want to give a reward, but just exp, leave out the reward
Players can now receive exp too. Don't want to give a reward, but just exp, leave out the reward
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Quest system" version="1.0" author="Darad @ Babylon" enabled="yes">
<config name="quest_config"><![CDATA[
config = {
-- wanna make an anni style quest? Make 4 chests different id's but same storage value! :)
[5001] = { -- uniqueid of chest is quest id
storageValue = 5001,
rewards = {2156}, -- can be array!
},
[4001] = {
storageValue = 4001,
rewards = {2276},
exp = 1000000
}
}
]]></config>
<action itemid="1740" allowfaruse="0" event="buffer"><![CDATA[
-- function onUse(cid, item, fromPosition, itemEx, toPosition)
domodlib('quest_config')
local q = config[item.uid]
if(q ~= nil) then
-- check if player completed this quest.
if(getPlayerStorageValue(cid, q.storageValue) == -1) then
-- hand out reward
if(q.rewards ~= nil) then
for _, reward in ipairs(q.rewards) do
doPlayerAddItem(cid, reward, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received a " .. getItemNameById(reward) .. ".")
end
end
if q.exp ~= nil then
doPlayerAddExperience(cid, q.exp)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received " .. q.exp .. " experience points.")
end
setPlayerStorageValue(cid, q.storageValue, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS)
else
doPlayerSendCancel(cid, 'You have completed this quest already')
end
return true
end
return false
]]></action>
</mod>
Last edited: