SebbePwnyou
New Member
- Joined
- Jan 14, 2015
- Messages
- 19
- Reaction score
- 3
Hello, i recently started mapping for my Server again and it seems that Quest ActionID: 2000 doesn't work? is there something that was changed in TFS 1.4 or with RME 10.98 with doing ActionID 2000?
Actions.xml
questsystem.lua
EDIT///
Used a script to give me the key with the actionID so I can open the door with the same ActionID, shame you can't make it in the editor Also added Silba's solution for normal quests.
Actions.xml
XML:
<action actionid="2000" script="quests/questsystem.lua" />
questsystem.lua
Lua:
local specialQuests = {
[2215] = 2215, -- Annihilator
}
local questsExperience = {
[2215] = 100000, --anni
}
local questOutfits = {
[2215] = {female = 542, male = 541}, --anni demon outfit
}
local questAddons = {
}
local questMount = {
}
local tutorialIds = {
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = specialQuests[item.actionid]
if not storage then
storage = item.uid
if storage > 65535 then
return false
end
end
local player = Player(cid)
if player:getStorageValue(storage) > 0 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.')
return true
end
local targetItem = Item(item.uid)
local items = {}
local reward = nil
local size = targetItem:isContainer() and Container(item.uid):getSize() or 0
if size == 0 then
reward = targetItem:clone()
else
local container = Container(item.uid)
for i = 0, container:getSize() - 1 do
table.insert(items, container:getItem(i):clone())
end
end
size = #items
if size == 1 then
reward = items[1]:clone()
end
local result = ''
local weight = 0
if reward then
local ret = ItemType(reward:getId())
if ret:isRune() then
result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward:getSubType() .. ' charges)'
elseif ret:isStackable() and reward:getCount() > 1 then
result = reward:getCount() .. ' ' .. ret:getPluralName()
else
result = ret:getArticle() .. ' ' .. ret:getName()
end
weight = weight + ret:getWeight(reward:getCount())
else
if size > 20 then
reward = Game.createItem(item.itemid, 1)
elseif size > 8 then
reward = Game.createItem(1988, 1)
else
reward = Game.createItem(1987, 1)
end
for i = 1, size do
local tmp = items[i]
if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then
print('[Warning] QuestSystem:', 'Could not add quest reward to container')
else
local ret = ', '
if i == size then
ret = ' and '
elseif i == 1 then
ret = ''
end
result = result .. ret
local ret = ItemType(tmp:getId())
if ret:isRune() then
result = result .. ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. tmp:getSubType() .. ' charges)'
elseif ret:isStackable() and tmp:getCount() > 1 then
result = result .. tmp:getCount() .. ' ' .. ret:getPluralName()
else
result = result .. ret:getArticle() .. ' ' .. ret:getName()
end
weight = weight + ret:getWeight(tmp:getCount())
end
end
weight = weight + ItemType(reward:getId()):getWeight()
end
if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then
if player:getFreeCapacity() < weight then
player:sendCancelMessage('You have found ' .. result .. ' weighing ' .. string.format('%.2f', weight) .. ' oz. You have no capacity.')
else
player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.')
end
return true
end
if questsExperience[storage] then
player:addExperience(questsExperience[storage], true)
end
if questOutfits[storage] then
player:addOutfit(questOutfits[storage].female)
player:addOutfit(questOutfits[storage].male)
end
if questAddons[storage] then
player:addOutfitAddon(questAddons[storage].female, questAddons[storage].addon)
player:addOutfitAddon(questAddons[storage].male, questAddons[storage].addon)
end
if questMount[storage] then
player:addMount(questMount[storage].mountId)
end
if tutorialIds[storage] then
player:sendTutorial(tutorialIds[storage])
if item.uid == 50080 then
player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3)
end
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.')
player:setStorageValue(storage, 1)
return true
end
EDIT///
Used a script to give me the key with the actionID so I can open the door with the same ActionID, shame you can't make it in the editor Also added Silba's solution for normal quests.
Last edited: