bielzet
New Member
Guys, I'm new to this Revscript and I need some help. The quest doesn't show as started (which isn't that relevant to me), and when I click on the chest, I choose which item I want and take one of them (which is where I finish the quest), but it doesn't appear in the quest log that the quest was completed or finished, etc.
Sorry if I'm doing something wrong, this is my first post
If you can help me, I'd really appreciate it
This here is my Movements.
These are my storage
This is my lib/quest.lua file
This is my ACTIONS/QUEST/THE_FLAME_CHEST.LUA
Sorry if I'm doing something wrong, this is my first post
If you can help me, I'd really appreciate it
This here is my Movements.
local theFlameDoor = MoveEvent()
function theFlameDoor.onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end
if player:getStorageValue(Storage.Quest.TheFlame.QuestStart) ~= 1 then
player:setStorageValue(Storage.Quest.TheFlame.QuestStart, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have entered the quest area. Defeat the monsters and claim your reward!")
end
return true
end
theFlameDoor:type("stepin")
theFlameDoor:aid(50001) -- Action ID da porta no RME
theFlameDoor:register()
These are my storage
Storage = {
Quest = {
Key = {
ID1000 = 103,
},
ExampleQuest = {
Example = 9000,
Door = 9001,
},
TheFlame = {
QuestStart = 50001,
ChestReward = 50002,
QuestComplete = 50003,
},
},
DelayLargeSeaShell = 30002,
Imbuement = 30004,
}
GlobalStorage = {
ExampleQuest = {
Example = 60000,
},
}
This is my lib/quest.lua file
if not Quests then
Quests = {
[1] = {
name = "Example",
startStorageId = Storage.Quest.ExampleQuest.Example,
startStorageValue = 1,
missions = {
[1] = {
name = "The Hidden Seal",
storageId = Storage.Quest.ExampleQuest.Example,
missionId = 1,
startValue = 1,
endValue = 1,
description = "You broke the first seal.",
},
},
},
}
end
-- Adicionando nova quest (sem apagar a anterior)
Quests[#Quests + 1] = {
name = "The Flame",
startStorageId = Storage.Quest.TheFlame.QuestStart,
startStorageValue = 1,
missions = {
[1] = {
name = "The Flame",
storageId = Storage.Quest.TheFlame.QuestComplete,
missionId = 1001,
startValue = 0,
endValue = 1,
states = {
[0] = "Enter The Flame quest area, defeat the monsters and claim your legendary reward!",
[1] = "You have completed The Flame quest and claimed your legendary weapon!"
}
}
}
}
This is my ACTIONS/QUEST/THE_FLAME_CHEST.LUA
local theFlameChest = Action()
local choiceRewards = {
[8001] = {id = 3309, count = 1}, -- thunder hammer
[8002] = {id = 8097, count = 1}, -- solar axe
[8003] = {id = 8103, count = 1}, -- epiphany (sword)
}
function theFlameChest.onUse(player, item, fromPosition, target, toPosition, isHotkey)
-- Verifica se o player já pegou a recompensa
if player:getStorageValue(Storage.Quest.TheFlame.ChestReward) == 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.")
return true
end
-- Verifica se o player iniciou a quest
if player:getStorageValue(Storage.Quest.TheFlame.QuestStart) ~= 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You haven't completed the requirements for this quest.")
return true
end
-- Pega a recompensa do baú específico
local reward = choiceRewards[item.uid]
if not reward then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This chest has no reward.")
return true
end
local rewardItem = player:addItem(reward.id, reward.count)
if rewardItem then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(reward.id):getName():lower() .. ".")
player:setStorageValue(Storage.Quest.TheFlame.ChestReward, 1)
player:setStorageValue(Storage.Quest.TheFlame.QuestComplete, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Quest completed!")
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't have enough space in your inventory.")
end
return true
end
-- Registrando os 3 baús pelo UID
theFlameChest:uid(8001)
theFlameChest:uid(8002)
theFlameChest:uid(8003)
theFlameChest:register()