<action uniqueid="1001" script="anni_chest.lua" />
<action uniqueid="1002" script="anni_chest.lua" />
<action uniqueid="1003" script="anni_chest.lua" />
<action uniqueid="1004" script="anni_chest.lua" />
<action uniqueid="1001-1004" script="anni_chest.lua" />
--- Created by JDB, converted to 0.2 by Znote ---
local chests = {
[1001] = {prize = xxxx},
[1002] = {prize = xxxx},
[1003] = {prize = xxxx},
[1004] = {prize = xxxx}
}
local status = 20000 -- Storage for quest
local questLevel = 30 -- Level to open chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
local questStatus = getPlayerStorageValue(cid, status)
local playerPos = getCreaturePosition(cid)
if questStatus == 1 then
doPlayerSendTextMessage(cid, "You have already chosen your reward.")
return TRUE
end
if getPlayerLevel(cid) >= questLevel then
doPlayerAddItem(cid, chests[item.uid].prize, 1)
setPlayerStorageValue(cid, status, 1)
doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here is your reward!")
end
return TRUE
end
Not many understands how TFS's quest system works though. Perhaps somebody should make a tutorial about it![]()
--- Created by JDB, converted to 0.2 by Znote ---
local chests = {
[1001] = {prize = xxxx},
[1002] = {prize = xxxx},
[1003] = {prize = xxxx},
[1004] = {prize = xxxx}
}
local status = 21000 -- Storage for quest
local questLevel = 50 -- Level to open chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
local questStatus = getPlayerStorageValue(cid, status)
local playerPos = getCreaturePosition(cid)
if questStatus == 1 then
doPlayerSendTextMessage(cid, "You have already chosen your reward.")
return TRUE
end
if getPlayerLevel(cid) >= questLevel then
doPlayerAddItem(cid, chests[item.uid].prize, 1)
setPlayerStorageValue(cid, status, 1)
doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here is your reward!")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level "..questLevel.." to get the rewards!")
end
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level "..questLevel.." to get the rewards!")
[10/08/2009 00:46:40] Lua Script Error: [Action Interface]
[10/08/2009 00:46:40] data/actions/scripts/quests/optionable.lua:onUse
[10/08/2009 00:46:40] luaDoPlayerSendTextMessage(). Player not found
use item ids instead of namesDont work pls fix!
[11/12/2009 20:03:51] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/anni_chests.lua)
[11/12/2009 20:03:51] data/actions/scripts/anni_chests.lua:3: '}' expected near 'Armor'
0.3.5
local chests =
{
[1001] = {2494},
[1002] = {2400},
[1003] = {2431},
[1004] = {2421}
}
local status = 12345 -- Storage for quest
local questLevel = 100 -- Level to open chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getItemNameById(chests[item.uid].prize)
local questStatus = getPlayerStorageValue(cid, status)
local playerPos = getCreaturePosition(cid)
if questStatus == 1 then
doPlayerSendTextMessage(cid, "You have already chosen your reward.")
return TRUE
end
if getPlayerLevel(cid) >= questLevel then
doPlayerAddItem(cid, chests[item.uid].prize, 1)
setPlayerStorageValue(cid, status, 1)
doSendMagicEffect(playerPos, CONST_ME_GIFT_WRAPS)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have chosen a ".. name .." as your reward.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be atleast level ".. questLevel .." to open this chest.")
end
return TRUE
end
local chests =
{
[1001] = {2494},
[1002] = {2400},
[1003] = {2431},
[1004] = {2421}
}
local status = 12345 -- Storage for quest
local questLevel = 100 -- Level to open chest
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getItemNameById(chests[item.uid].prize)
local questStatus = getPlayerStorageValue(cid, status)
local playerPos = getCreaturePosition(cid)
if questStatus == 1 then
doPlayerSendTextMessage(cid, "You have already chosen your reward.")
return true
end
doPlayerAddItem(cid, chests[item.uid].prize, 1)
setPlayerStorageValue(cid, status, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have chosen a ".. name .." as your reward.")
return true
end