Ir para conteúdo
  • Cadastre-se

(Resolvido)[Demon OAK] TFS 1.5


Ir para solução Resolvido por Tacabala22,

Posts Recomendados

  • Solução

Salve galera, Tudo na paz?
Utilizo como base do meu servidor o TFS 1.5 Downgrade 8.6 do NEKIRO , baixei esse servidor aqui para remover quests e utilizar no meu.

Spoiler

 

 

Copiei os arquivos.
data\actions\scripts\quests\demon oak

demonOak.lua

local config = {
	demonOakIds = {8288, 8289, 8290, 8291},
	sounds = {
		'MY ROOTS ARE SHARP AS A SCYTHE! FEEL IT?!?',
		'CURSE YOU!',
		'RISE, MINIONS, RISE FROM THE DEAD!!!!',
		'AHHHH! YOUR BLOOD MAKES ME STRONG!',
		'GET THE BONES, HELLHOUND! GET THEM!!',
		'GET THERE WHERE I CAN REACH YOU!!!',
		'ETERNAL PAIN AWAITS YOU! NICE REWARD, HUH?!?!',
		'YOU ARE GOING TO PAY FOR EACH HIT WITH DECADES OF TORTURE!!',
		'ARGG! TORTURE IT!! KILL IT SLOWLY MY MINION!!'
	},
	bonebeastChance = 100,
	bonebeastCount = 10,
	waves = 15,
	questArea = {
		fromPosition = {x = 144, y = 257, z = 7},
		toPosition = {x = 163, y = 269, z = 7}
	},
	summonPositions = {
		{x = 152, y = 260, z = 7},
		{x = 149, y = 263, z = 7},
		{x = 158, y = 263, z = 7},
		{x = 157, y = 259, z = 7},
		{x = 158, y = 267, z = 7},
		{x = 147, y = 262, z = 7},
		{x = 160, y = 261, z = 7},
		{x = 155, y = 267, z = 7}
	},
	summons = {
		[8288] = {
			[10] = {'Spectre', 'Blightwalker', 'Braindeath', 'Demon', 'Braindeath', 'Demon', 'Braindeath', 'Demon'},
			[15] = {'Betrayed Wraith', 'Betrayed Wraith', 'Braindeath', 'Demon'}
		},
		[8289] = {
			[10] = {'Plaguesmith', 'Plaguesmith', 'Blightwalker', 'Plaguesmith', 'Plaguesmith', 'Dark Torturer', 'Blightwalker', 'Dark Torturer', 'Blightwalker'},
			[15] = {'Dark Torturer', 'Blightwalker', 'Braindeath', 'Demon', 'Braindeath', 'Demon'}
		},
		[8290] = {
			[15] = {'Banshee', 'Plaguesmith', 'Hellhound', 'Plaguesmith', 'Hellhound', 'Plaguesmith', 'Hellhound', 'Grim Reaper', 'Grim Reaper'},
			[10] = {'Grim Reaper', 'Braindeath', 'Demon'}
		},
		[8291] = {
			[8] = {'Plaguesmith', 'Hellhound', 'Hellhound', 'Hellhound', 'Hellhound', 'Hand of Cursed Fate', 'Hand of Cursed Fate'},
			[12] = {'Undead Dragon', 'Hand of Cursed Fate', 'Braindeath', 'Demon'}
		}
	},
	storages = {
		[8288] = Storage.DemonOak.AxeBlowsBird,
		[8289] = Storage.DemonOak.AxeBlowsLeft,
		[8290] = Storage.DemonOak.AxeBlowsRight,
		[8291] = Storage.DemonOak.AxeBlowsFace
	}
}

local function getRandomSummonPosition()
	return config.summonPositions[math.random(#config.summonPositions)]
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if not isInArray(config.demonOakIds, target.itemid) then
		return true
	end

	local totalProgress = 0
	for k,v in pairs(config.storages) do
		totalProgress = totalProgress + math.max(0, player:getStorageValue(v))
	end

	local spectators, hasMonsters = Game.getSpectators(DEMON_OAK_POSITION, false, false, 9, 9, 6, 6), false
	for i = 1, #spectators do
		if spectators[i]:isMonster() then
			hasMonsters = true
			break
		end
	end

	local isDefeated = totalProgress == (#config.demonOakIds * (config.waves + 1))
	if (config.killAllBeforeCut or isDefeated)
			and hasMonsters then
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You need to kill all monsters first.')
		return true
	end

	if isDefeated then
		player:teleportTo(DEMON_OAK_KICK_POSITION)
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Tell Oldrak about your great victory against the demon oak.')
		player:setStorageValue(Storage.DemonOak.Done, 1)
		player:setStorageValue(Storage.DemonOak.Progress, 3)
		return true
	end

	local cStorage = config.storages[target.itemid]
	local progress = math.max(player:getStorageValue(cStorage), 1)
	if progress >= config.waves + 1 then
		toPosition:sendMagicEffect(CONST_ME_POFF)
		return true
	end

	local isLastCut = totalProgress == (#config.demonOakIds * (config.waves + 1) - 1)
	local summons = config.summons[target.itemid]
	if summons and summons[progress] then
		-- Summon a single demon on the last hit
		if isLastCut then
			Game.createMonster('Demon', getRandomSummonPosition(), false, true)

		-- Summon normal monsters otherwise
		else
			for i = 1, #summons[progress] do
				Game.createMonster(summons[progress][i], getRandomSummonPosition(), false, true)
			end
		end

	-- if it is not the 5th or 10th there is only a chance to summon bonebeasts
	elseif math.random(100) >= config.bonebeastChance then
		for i = 1, config.bonebeastCount do
			Game.createMonster('Bonebeast', getRandomSummonPosition(), false, true)
		end
	end

	player:say(isLastCut and 'HOW IS THAT POSSIBLE?!? MY MASTER WILL CRUSH YOU!! AHRRGGG!' or config.sounds[math.random(#config.sounds)], TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_POSITION)
	toPosition:sendMagicEffect(CONST_ME_DRAWBLOOD)
	player:setStorageValue(cStorage, progress + 1)
	player:say('-krrrrak-', TALKTYPE_MONSTER_YELL, false, player, toPosition)
	doTargetCombatHealth(0, player, COMBAT_EARTHDAMAGE, -170, -210, CONST_ME_BIGPLANTS)
	return true
end

 

demonOakChest.lua

local chests = {
	[9008] = {itemid = 2495, count = 1},
	[9009] = {itemid = 8905, count = 1},
	[9010] = {itemid = 16111, count = 1},
	[9011] = {itemid = 16112, count = 1}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if chests[item.uid] then
		if player:getStorageValue(Storage.DemonOak.Done) ~= 2 then
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
			return true
		end

		local chest = chests[item.uid]
		local itemType = ItemType(chest.itemid)
		if itemType then
			local article = itemType:getArticle()
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
		end

		player:addItem(chest.itemid, chest.count)
		player:setStorageValue(Storage.DemonOak.Done, 3)
	end

	return true
end

 

demonOakGravestone.lua

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if player:getStorageValue(Storage.DemonOak.Done) == 2 then
		player:teleportTo(DEMON_OAK_REWARDROOM_POSITION)
		DEMON_OAK_REWARDROOM_POSITION:sendMagicEffect(CONST_ME_TELEPORT)
		return true
	end
end

 

Actions.xml

<!-- Demon Oak -->
	<action itemid="8293" script="quests/demon oak/demonOak.lua" />
	<action fromuid="9008" touid="9011" script="quests/demon oak/demonOakChest.lua" />
	<action uniqueid="9007" script="quests/demon oak/demonOakGravestone.lua" />

 

data\movements\scripts\quests\demon oak

 

areaDamage.lua

function onStepIn(creature, item, position, fromPosition)
	local player = creature:getPlayer()
	if not player then
		return true
	end

	if math.random(24) == 1 then
		doTargetCombatHealth(0, player, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
	end
	return true
end

 

entrance.lua

function onStepIn(creature, item, position, fromPosition)
	local player = creature:getPlayer()
	if not player then
		return true
	end

	-- CHECAR SE JÁ TIVER FEITO
	if player:getStorageValue(Storage.DemonOak.Done) >= 2 then
		player:teleportTo(DEMON_OAK_KICK_POSITION)
		player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
		return true
	end
	
	-- CHECAR LEVEL MÍNIMO
	if player:getLevel() < 120 then
		player:say("LEAVE LITTLE FISH, YOU ARE NOT WORTH IT!", TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_POSITION)
		player:teleportTo(DEMON_OAK_KICK_POSITION)
		player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
		return true
	end

	-- CHECAR SE TA TUDO CERTO Vou usar mensagens pra descobrir qual é o conflito
	if (#Game.getSpectators(DEMON_OAK_POSITION, false, true, 9, 9, 6, 6) == 0) then
			if (player:getItemCount(10305) == 0) then
				if player:getStorageValue(Storage.DemonOak.Progress) < 1 then
			player:say("You need finish the demons task!", TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_KICK_POSITION)
			player:teleportTo(DEMON_OAK_KICK_POSITION)
			player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
			return true
			    end
		end
		
		if (player:getItemCount(8293) == 0) then
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Go talk with Odralk and get the Hallowed Axe to kill The Demon Oak.')
		end

		player:removeItem(10305, 1)
		player:teleportTo(DEMON_OAK_ENTER_POSITION)
		player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
		player:setStorageValue(Storage.DemonOak.Progress, 1)
		player:say("I AWAITED YOU! COME HERE AND GET YOUR REWARD!", TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_POSITION)
	else
		player:teleportTo(DEMON_OAK_KICK_POSITION)
		player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
	end
	return true
end

 

squares.lua

local voices = {
	'Release me and you will be rewarded greatefully!',
	'What is this? Demon Legs lying here? Someone might have lost them!',
	'I\'m trapped, come here and free me fast!!',
	'I can bring your beloved back from the dead, just release me!',
	'What a nice shiny golden armor. Come to me and you can have it!',
	'Find a way in here and release me! Pleeeease hurry!',
	'You can have my demon set, if you help me get out of here!'
}

local startUid = 9000
function onStepIn(creature, item, position, fromPosition)
	local player = creature:getPlayer()
	if not player then
		return true
	end

	local status = math.max(player:getStorageValue(Storage.DemonOak.Squares), 0)
	if item.uid - startUid == status + 1 then
		player:setStorageValue(Storage.DemonOak.Squares, status + 1)
		player:say(voices[math.random(#voices)], TALKTYPE_MONSTER_YELL, false, player, DEMON_OAK_POSITION)
	end
	return true
end

 

movements.xml

<!-- Demon Oak Quest -->
	<movevent event="StepIn" uniqueid="9000" script="quests/demon oak/entrance.lua" />
	<movevent event="StepIn" itemid="8292" script="quests/demon oak/areaDamage.lua" />
	<movevent event="StepIn" fromuid="9001" touid="9005" script="quests/demon oak/squares.lua" />

 

data\globalevents\scripts\quests\demon oak

 

voices.lua

local questArea = {
	Position(144, 257, 7),
	Position(163, 269, 7)
}

local sounds = {
	'Release me and you will be rewarded greatefully!',
	'What is this? Demon Legs lying here? Someone might have lost them!',
	'I\'m trapped, come here and free me fast!!',
	'I can bring your beloved back from the dead, just release me!',
	'What a nice shiny golden armor. Come to me and you can have it!',
	'Find a way in here and release me! Pleeeease hurry!',
	'You can have my demon set, if you help me get out of here!'
}

function onThink(interval, lastExecution)
	local spectators, spectator = Game.getSpectators(DEMON_OAK_POSITION, false, true, 0, 15, 0, 15)
	local sound = sounds[math.random(#sounds)]
	for i = 1, #spectators do
		spectator = spectators[i]
		if isInRange(spectator:getPosition(), questArea[1], questArea[2]) then
			return true
		end

		spectator:say(sound, TALKTYPE_MONSTER_YELL, false, 0, DEMON_OAK_POSITION)
	end
	return true
end

 

globalevents.xml

<!-- Demon Oak -->
	<globalevent name="DemonOakVoices" interval="15000" script="quests/demon oak/voices.lua" />

 

data\lib\quests\demonoak

 

demon_oak.lua

DEMON_OAK_POSITION = Position(32716, 32351, 7)
DEMON_OAK_KICK_POSITION = Position(32716, 32340, 7)
DEMON_OAK_ENTER_POSITION = Position(32716, 32347, 7)
DEMON_OAK_REWARDROOM_POSITION = Position(32714, 32398, 8)

 

data\lib\lib.lua

dofile('data/lib/quests/demonoak/demon_oak.lua')

 

E no final está me dando esse erro aqui.

Lua Script Error: [Test Interface]
data/actions/scripts/otbaiak/demonoak.lua
data/actions/scripts/otbaiak/demonoak.lua:50: attempt to index field 'DemonOak' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/scripts/otbaiak/demonoak.lua:50: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/otbaiak/demonoak.lua

 

@Atualização.
Resolvi o problema, script atualizada. Quem quiser utilizar a script fique a vontade. Não sei quem é o autor.

Link para o post
Compartilhar em outros sites
  • 1 year later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo