sadguys
New Member
- Joined
- Jul 20, 2017
- Messages
- 3
- Reaction score
- 0
Hello guys, i need some help to give acess in some quests, For example in Wrath of the Emperor, i want to players only talk with NPC Zizzle to kill the bosses, but i can't do this with storages. I Tried with NPC Izsh but i cant get acess to the reward room. -- sorry for bad english.
My codes:
Login.Lua
npc/scripts/Izsh.lua:
If you need another script i'll post it.
Thanks.
My codes:
Login.Lua
Lua:
-- ordered as in creaturescripts.xml
local events = {
'TutorialCockroach',
'ElementalSpheresOverlords',
'BigfootBurdenVersperoth',
'BigfootBurdenWarzone',
'BigfootBurdenWeeper',
'BigfootBurdenWiggler',
'SvargrondArenaKill',
'NewFrontierShardOfCorruption',
'NewFrontierTirecz',
'ServiceOfYalaharDiseasedTrio',
'ServiceOfYalaharAzerus',
'ServiceOfYalaharQuaraLeaders',
'InquisitionBosses',
'InquisitionUngreez',
'KillingInTheNameOfKills',
'MastersVoiceServants',
'SecretServiceBlackKnight',
'ThievesGuildNomad',
'WotELizardMagistratus',
'WotELizardNoble',
'WotEKeeper',
'WotEBosses',
'WotEZalamon',
'PlayerDeath',
'AdvanceSave',
'AdvanceRookgaard',
'PythiusTheRotten',
'AncedentTarbaz',
'AncedentShulgrax',
'AncedentPlagirath',
'AncedentZamulosh',
'AncedentMazoran',
'AncedentRazzagorn',
'AncedentRagiaz',
'AncedentFerumbras',
'Gloombringer',
'AscedentFerumbrasQuest',
'DropLoot'
}
local function onMovementRemoveProtection(cid, oldPosition, time)
local player = Player(cid)
if not player then
return true
end
local playerPosition = player:getPosition()
if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
player:setStorageValue(Storage.combatProtectionStorage, 0)
return true
end
addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end
function onLogin(player)
local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. ' Please choose your outfit.'
player:sendTutorial(1)
else
if loginStr ~= '' then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
end
loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
end
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
local playerId = player:getId()
-- Stamina
nextUseStaminaTime[playerId] = 0
-- Completed Quests
local questStorages = {
{storage = Storage.TheNewFrontier.Questline, value == 33},
{storage = Storage.TheNewFrontier.Mission01, value = 3},
{storage = Storage.TheNewFrontier.Mission02, value = 6},
{storage = Storage.TheNewFrontier.Mission03, value = 3},
{storage = Storage.TheNewFrontier.Mission04, value = 2},
{storage = Storage.TheNewFrontier.Mission05, value = 7},
{storage = Storage.TheNewFrontier.Mission06, value = 3},
{storage = Storage.TheNewFrontier.Mission07, value = 3},
{storage = Storage.TheNewFrontier.Mission09, value = 1},
{storage = Storage.TheNewFrontier.TomeofKnowledge, value = 13},
{storage = Storage.TheNewFrontier.Beaver1, value = 1},
{storage = Storage.TheNewFrontier.Beaver2, value = 1},
{storage = Storage.TheNewFrontier.Beaver3, value = 1},
{storage = Storage.TheNewFrontier.BribeKing, value = 1},
{storage = Storage.TheNewFrontier.BribeLeeland, value = 1},
{storage = Storage.TheNewFrontier.BribeExplorerSociety, value = 1},
{storage = Storage.TheNewFrontier.BribeWyrdin, value = 1},
{storage = Storage.TheNewFrontier.BribeTelas, value = 1},
{storage = Storage.TheNewFrontier.BribeHumgolf, value = 1},
{storage = Storage.WrathoftheEmperor.Questline, value = 26},
{storage = Storage.WrathoftheEmperor.Mission01, value = 3},
{storage = Storage.WrathoftheEmperor.Mission02, value = 3},
{storage = Storage.WrathoftheEmperor.Mission03, value = 3},
{storage = Storage.WrathoftheEmperor.Mission04, value = 3},
{storage = Storage.WrathoftheEmperor.Mission05, value = 3},
{storage = Storage.WrathoftheEmperor.Mission06, value = 4},
{storage = Storage.WrathoftheEmperor.Mission07, value = 6},
{storage = Storage.WrathoftheEmperor.Mission08, value = 2},
{storage = Storage.WrathoftheEmperor.Mission09, value = 2},
{storage = Storage.WrathoftheEmperor.CrateStatus, value = 1},
{storage = Storage.WrathoftheEmperor.GuardcaughtYou, value = 1},
{storage = Storage.WrathoftheEmperor.ZumtahStatus, value = 1},
{storage = Storage.WrathoftheEmperor.PrisonReleaseStatus, value = 1},
{storage = Storage.WrathoftheEmperor.GhostOfAPriest01, value = 1},
{storage = Storage.WrathoftheEmperor.GhostOfAPriest02, value = 1},
{storage = Storage.WrathoftheEmperor.GhostOfAPriest03, value = 1},
{storage = Storage.WrathoftheEmperor.InterdimensionalPotion, value = 1},
}
local addStorage = Player.setStorageValue
for i = 1, #questStorages do
addStorage(player, questStorages[i].storage, questStorages[i].value)
end
-- Promotion
local vocation = player:getVocation()
local promotion = vocation:getPromotion()
if player:isPremium() then
local value = player:getStorageValue(Storage.Promotion)
if not promotion and value ~= 1 then
player:setStorageValue(Storage.Promotion, 1)
elseif value == 1 then
player:setVocation(promotion)
end
elseif not promotion then
player:setVocation(vocation:getDemotion())
end
-- Rewards notice
local rewards = #player:getRewardList()
if rewards > 0 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %s %s in your reward chest.", rewards == 1 and 'one' or rewards, rewards > 1 and "rewards" or "reward"))
end
-- Update player id
local stats = player:inBossFight()
if stats then
stats.playerId = player:getId()
end
-- Events
for i = 1, #events do
player:registerEvent(events[i])
player:registerEvent("BossParticipation")
player:registerEvent("lowerRoshamuul")
end
if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
onMovementRemoveProtection(playerId, player:getPosition(), 10)
end
db.query('INSERT INTO `players_online` (`player_id`) VALUES (' .. playerId .. ')')
db.query("UPDATE `players` SET `cast` = 0 WHERE `id` = " ..playerId .. ";")
return true
end
npc/scripts/Izsh.lua:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'mission') then
if Player(cid):getStorageValue(Storage.WrathoftheEmperor.Questline) == 33 then
npcHandler:say('Oh yez, let me zee ze documentz. Here we go: zree cheztz filled wiz platinum, one houze, a zet of elite armor, and an unending mana cazket. Iz ziz correct?', cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
npcHandler:say({
'Fine, zo let\'z prozeed. You uzed forged documentz to enter our zity, killed zeveral guardz who enjoyed a quite excluzive and expenzive training, deztroyed rare magical devizez in ze pozzezzion of ze emperor. ...',
'Ze good newz iz, your zree cheztz of platinum should be nearly enough to pay ze finez. Lucky you, ziz could have left you broke. ...',
'Zere are alzo zertain noble familiez complaining about ze murder of zeveral of zeir beloved onez. ...',
'I zink I can make a deal wiz ze noblez by zelling zem your property in ze zity. Your prezenze would ruin ze houze prizez zere anyway. ...',
'Of courze zat will not zuffize to compenzate zeir grief, zo I guezz you\'ll have to part wiz zat elite armor, too. Zadly, prizez for armor are on an all time low right now. ...',
'But luckily you ztill have zat mana cazket. Well, you had it. Now we have to zell it. ...',
'But not all iz lozt my blank-zkinned vizitor. According to my calculationz, zere iz ztill a bit left. ...',
'I zink we can zave you zome gold and zome treazurez, and you can keep one pieze of your elite armor at leazt. ...',
'You will find your rewardz in one of ze old zupply zellarz. Beware of ze ratz zough. ...',
'Ze rednezz of your faze and ze zound you make wiz your teez iz obviouzly a zign of gratitude of your zpeziez! I am flattered, but pleaze leave now az I have to attend to zome important buzinezz.'
}, cid)
Player(cid):setStorageValue(Storage.WrathoftheEmperor.Questline, 34)
npcHandler.topic[cid] = 0
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, 'Greetingz zcalelezz being.')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If you need another script i'll post it.
Thanks.