Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • Moderador

Evento Monster Hunt

 

Durante uma hora, o player que mais matar um monstro específico ganha o evento.

 

Na pasta lib, crie um arquivo chamado monsterHunt.lua com isso dentro

MONSTER_HUNT = {
	list = {"Demon", "Rotworm", "Cyclops"},
	days = {
		["Sunday"] = {"13:55"},
		["Monday"] = {"13:55"},
		["Tuesday"] = {"13:55"},
		["Wednesday"] = {"13:55"},
		["Thursday"] = {"13:55"},
		["Friday"] = {"13:55"},
		["Saturday"] = {"13:55"},
	},
	messages = {
		prefix = "[Monster Hunt] ",
		warnInit = "O evento irá começar em %d minuto%s. Seu objetivo será matar a maior quantidade de monstros escolhidos pelo sistema.",
		init = "O monstro escolhido pelo sistema foi %s. Você tem 1 hora para matar a maior quantidade desse monstro.",
		warnEnd = "Faltam %d minuto%s para acabar o evento. Se apressem!",
		final = "O jogador %s foi o ganhador do evento! Parabéns.",
		noWinner = "Não houve ganhadores no evento.",
		reward = "Você recebeu o seu prêmio no mailbox!",
		kill = "Você já matou {%d} %s do evento.",
	},
	rewards = {
		{id = 2160, count = 100},
	},
	storages = {
		monster = 891641,
		player = 891642,
	},
	players = {},
}

function MONSTER_HUNT:initEvent()
	Game.setStorageValue(MONSTER_HUNT.storages.monster, 0)
	Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(5, "s"))
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(3, "s"))
	end, 2 * 60 * 1000)
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(1, ""))
	end, 4 * 60 * 1000)
	addEvent(function()
		local rand = math.random(#MONSTER_HUNT.list)
		Game.setStorageValue(MONSTER_HUNT.storages.monster, rand)
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.init:format(MONSTER_HUNT.list[rand]))
	end, 5 * 60 * 1000)
	return true
end

function MONSTER_HUNT:endEvent()
	Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(5, "s"))
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(3, "s"))
	end, 2 * 60 * 1000)
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(1, ""))
	end, 4 * 60 * 1000)
	addEvent(function()
		if #MONSTER_HUNT.players == nil then
			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.noWinner)
			return
		end
		table.sort(MONSTER_HUNT.players, function(a,b) return a[2] > b[2] end)
		local player = Player(MONSTER_HUNT.players[1][1])
		if player then
			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName()))
			player:setStorageValue(MONSTER_HUNT.storages.player, -1)
			for c, d in ipairs(MONSTER_HUNT.rewards) do
				local item = Game.createItem(d.id, d.count)
				player:addItemEx(item)
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.reward)
				player:getPosition():sendMagicEffect(30)
			end
        --[[ Função exclusiva (ignore)
		else
			local player = Player(MONSTER_HUNT.players[1][1], true)

			if not player then
				return false
			end

			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName()))
			player:setStorageValue(MONSTER_HUNT.storages.player, -1)
			for c, d in ipairs(MONSTER_HUNT.rewards) do
				local item = Game.createItem(d.id, d.count)
				player:getInbox():addItemEx(item, INDEX_WHEREEVER, FLAG_NOLIMIT)
			end
			player:delete()
        --]]
		end
		for a, b in pairs(MONSTER_HUNT.players) do
			local player = Player(b[1])
			if player then
				player:setStorageValue(MONSTER_HUNT.storages.player, 0)
				MONSTER_HUNT.players[a] = nil
          --[[ Função exclusiva (ignore)
			else
				player = Player(b[1], true)
				player:setStorageValue(MONSTER_HUNT.storages.player, 0)
				MONSTER_HUNT.players[a] = nil
				player:delete()
          --]]
			end
		end
		Game.setStorageValue(MONSTER_HUNT.storages.monster, -1)
	end, 5 * 60 * 1000)
	return true
end

 

Não esqueça de registrar essa lib no lib.lua

 

Agora em globalevents, crie um arquivo na pasta scripts com isso dentro

function onThink(interval)
	if MONSTER_HUNT.days[os.date("%A")] then
		local hrs = tostring(os.date("%X")):sub(1, 5)
		if isInArray(MONSTER_HUNT.days[os.date("%A")], hrs) then
			MONSTER_HUNT:initEvent()
		end
	end
	return true
end

function onTime(interval)
	MONSTER_HUNT:endEvent()
	return true
end

Não esqueça de adicionar a tag no globalevents

<globalevent name="MonsterHunt" interval="60000" script="custom/events/monsterHunt.lua" />
<globalevent name="MonsterHuntEnd" time="14:55" script="custom/events/monsterHunt.lua" />

 

Agora em creaturescripts, crie um arquivo na pasta scripts com isso dentro

function onKill(player, target)

	if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
		return true
	end

	if not player or not target then
		return true
	end

	if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
		player:setStorageValue(MONSTER_HUNT.storages.player, 0)
	end

	if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
		player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
		player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
		table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
	end

	return true
end

 

Com a tag no creaturescripts

<event type="kill" name="MonsterHunt" script="custom/monsterHunt.lua" />

 

Não esqueça de registrar o evento no login.lua

player:registerEvent("MonsterHunt")

 

Bom aproveito.

 

Créditos: 100% meu :) 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...
  • Moderador
  • 1 month later...

Fala mano beleza? nesse seu script na mensagem de contar os kills e exibir para os players não esta funcionando, você pode me ajudar?

kill = "Voce ja matou {%d} %s do evento.",

 

Os anuncions de quando inicia o evento etc.. esta funcionando, porem quando eu mato os bixos não aparece o contador

Meu server é em RevScripts

 

caso você entenda e possa me ajudar esse é o meu xml

 

Spoiler

 

local monstereventglobal = GlobalEvent("monstereventglobal")

function monstereventglobal.onThink(interval)
    if MONSTER_HUNT.days[os.date("%A")] then
        local hrs = tostring(os.date("%X")):sub(1, 5)
        if isInArray(MONSTER_HUNT.days[os.date("%A")], hrs) then
            MONSTER_HUNT:initEvent()
        end
    end
    return true
end

function onTime(interval)
    MONSTER_HUNT:endEvent()
    return true
end

monstereventglobal:interval(60000) -- will be executed every 1000ms
monstereventglobal:register()

local monstereventcreature = CreatureEvent("MonsterHunt")
function monstereventcreature.onKill(player, target)

    if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
        return true
    end

    if not player or not target then
        return true
    end

    if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
        player:setStorageValue(MONSTER_HUNT.storages.player, 0)
    end

    if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
        player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
        player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
        table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
    end

    return true
end

monstereventcreature:type("kill")
monstereventcreature:register()

 

local monstereventcreature = CreatureEvent("MonsterHunt")
function monstereventcreature.onKill(player, target)

    if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
        return true
    end

    if not player or not target then
        return true
    end

    if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
        player:setStorageValue(MONSTER_HUNT.storages.player, 0)
    end

    if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
        player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
        player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
        table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
    end

    return true
end

monstereventcreature:type("kill")
monstereventcreature:register()

 

 

Editado por leomacedin (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 1 month later...

Olá. Ao testar aqui, ele inicia o evento, dá as mensagens, sorteia o mob, tudo certo, mas quando eu mato o mob sorteado ele dá debug no client, tem alguma ideia?
Nenhum erro na distro.

Valeu.

Link para o post
Compartilhar em outros sites
  • 2 months later...

testei e funciona direitinho, estou passando ele para o revscript está tudo certo na hora de receber o prêmio mas dps que o evento é encerrado acontece de que quando eu mato qualquer outra criatura sendo ou não da lista, aparece o seguinte erro:

 

Lua Script Error: [Scripts Interface]
C:\Users\Desktop\NovoUniServer\otserv - Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:callback
...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        ...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: in function <...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:3>

 

 

 

SCRIPT:

 

 

local monsterHunt = CreatureEvent("monsterHunt")

function monsterHunt.onKill(player, target)

    if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
        return true
    end

    if not player or not target then
        return true
    end

    if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
        player:setStorageValue(MONSTER_HUNT.storages.player, 0)
    end

    if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
        player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
        player:sendTextMessage(30, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
        table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
    end
end

monsterHunt:register()
 

 

 

 

conseguem me ajudar?

Editado por ETinhowww
erro (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 1 month later...
Em 28/06/2021 em 06:54, ETinhowww disse:

testei e funciona direitinho, estou passando ele para o revscript está tudo certo na hora de receber o prêmio mas dps que o evento é encerrado acontece de que quando eu mato qualquer outra criatura sendo ou não da lista, aparece o seguinte erro:

 

Lua Script Error: [Scripts Interface]
C:\Users\Desktop\NovoUniServer\otserv - Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:callback
...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        ...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:17: in function <...- Baiak\data\scripts\creaturescripts\monsterHuntKill.lua:3>

 

 

 

SCRIPT:

 

 

local monsterHunt = CreatureEvent("monsterHunt")

function monsterHunt.onKill(player, target)

    if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
        return true
    end

    if not player or not target then
        return true
    end

    if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
        player:setStorageValue(MONSTER_HUNT.storages.player, 0)
    end

    if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
        player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
        player:sendTextMessage(30, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
        table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
    end
end

monsterHunt:register()
 

 

 

 

conseguem me ajudar?

 

change for:

function onKill(player, target)

	if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
		return true
	end

	if not player or not target then
		return true
	end

	if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
		player:setStorageValue(MONSTER_HUNT.storages.player, 0)
	end
	
	if target:isMonster() ~= nil then
    return true
    end
	
	if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
		player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
		player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
		table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
	end

	return true
end

 

Link para o post
Compartilhar em outros sites
  • 11 months later...
Em 09/08/2021 em 07:18, eSvira disse:

 

change for:



function onKill(player, target)

	if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
		return true
	end

	if not player or not target then
		return true
	end

	if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
		player:setStorageValue(MONSTER_HUNT.storages.player, 0)
	end
	
	if target:isMonster() ~= nil then
    return true
    end
	
	if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
		player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
		player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
		table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
	end

	return true
end

 

 

 

Recibo este error al cambiar el creaturescript, alguna idea?

 

image.thumb.png.28c9f2c4dd7756b895d90d8f43ad4dc7.png

 

Edit: Disculpa, fue mi error. Habia pasado mal las libs. Muchas gracias, funciona!

Editado por pipe23 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 6 months later...
Em 03/11/2020 em 19:05, Movie disse:

Evento Monster Hunt

 

Durante uma hora, o player que mais matar um monstro específico ganha o evento.

 

Na pasta lib, crie um arquivo chamado monsterHunt.lua com isso dentro


MONSTER_HUNT = {
	list = {"Demon", "Rotworm", "Cyclops"},
	days = {
		["Sunday"] = {"13:55"},
		["Monday"] = {"13:55"},
		["Tuesday"] = {"13:55"},
		["Wednesday"] = {"13:55"},
		["Thursday"] = {"13:55"},
		["Friday"] = {"13:55"},
		["Saturday"] = {"13:55"},
	},
	messages = {
		prefix = "[Monster Hunt] ",
		warnInit = "O evento irá começar em %d minuto%s. Seu objetivo será matar a maior quantidade de monstros escolhidos pelo sistema.",
		init = "O monstro escolhido pelo sistema foi %s. Você tem 1 hora para matar a maior quantidade desse monstro.",
		warnEnd = "Faltam %d minuto%s para acabar o evento. Se apressem!",
		final = "O jogador %s foi o ganhador do evento! Parabéns.",
		noWinner = "Não houve ganhadores no evento.",
		reward = "Você recebeu o seu prêmio no mailbox!",
		kill = "Você já matou {%d} %s do evento.",
	},
	rewards = {
		{id = 2160, count = 100},
	},
	storages = {
		monster = 891641,
		player = 891642,
	},
	players = {},
}

function MONSTER_HUNT:initEvent()
	Game.setStorageValue(MONSTER_HUNT.storages.monster, 0)
	Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(5, "s"))
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(3, "s"))
	end, 2 * 60 * 1000)
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnInit:format(1, ""))
	end, 4 * 60 * 1000)
	addEvent(function()
		local rand = math.random(#MONSTER_HUNT.list)
		Game.setStorageValue(MONSTER_HUNT.storages.monster, rand)
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.init:format(MONSTER_HUNT.list[rand]))
	end, 5 * 60 * 1000)
	return true
end

function MONSTER_HUNT:endEvent()
	Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(5, "s"))
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(3, "s"))
	end, 2 * 60 * 1000)
	addEvent(function()
		Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.warnEnd:format(1, ""))
	end, 4 * 60 * 1000)
	addEvent(function()
		if #MONSTER_HUNT.players == nil then
			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.noWinner)
			return
		end
		table.sort(MONSTER_HUNT.players, function(a,b) return a[2] > b[2] end)
		local player = Player(MONSTER_HUNT.players[1][1])
		if player then
			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName()))
			player:setStorageValue(MONSTER_HUNT.storages.player, -1)
			for c, d in ipairs(MONSTER_HUNT.rewards) do
				local item = Game.createItem(d.id, d.count)
				player:addItemEx(item)
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.reward)
				player:getPosition():sendMagicEffect(30)
			end
        --[[ Função exclusiva (ignore)
		else
			local player = Player(MONSTER_HUNT.players[1][1], true)

			if not player then
				return false
			end

			Game.broadcastMessage(MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.final:format(player:getName()))
			player:setStorageValue(MONSTER_HUNT.storages.player, -1)
			for c, d in ipairs(MONSTER_HUNT.rewards) do
				local item = Game.createItem(d.id, d.count)
				player:getInbox():addItemEx(item, INDEX_WHEREEVER, FLAG_NOLIMIT)
			end
			player:delete()
        --]]
		end
		for a, b in pairs(MONSTER_HUNT.players) do
			local player = Player(b[1])
			if player then
				player:setStorageValue(MONSTER_HUNT.storages.player, 0)
				MONSTER_HUNT.players[a] = nil
          --[[ Função exclusiva (ignore)
			else
				player = Player(b[1], true)
				player:setStorageValue(MONSTER_HUNT.storages.player, 0)
				MONSTER_HUNT.players[a] = nil
				player:delete()
          --]]
			end
		end
		Game.setStorageValue(MONSTER_HUNT.storages.monster, -1)
	end, 5 * 60 * 1000)
	return true
end

 

Não esqueça de registrar essa lib no lib.lua

 

Agora em globalevents, crie um arquivo na pasta scripts com isso dentro


function onThink(interval)
	if MONSTER_HUNT.days[os.date("%A")] then
		local hrs = tostring(os.date("%X")):sub(1, 5)
		if isInArray(MONSTER_HUNT.days[os.date("%A")], hrs) then
			MONSTER_HUNT:initEvent()
		end
	end
	return true
end

function onTime(interval)
	MONSTER_HUNT:endEvent()
	return true
end

Não esqueça de adicionar a tag no globalevents


<globalevent name="MonsterHunt" interval="60000" script="custom/events/monsterHunt.lua" />
<globalevent name="MonsterHuntEnd" time="14:55" script="custom/events/monsterHunt.lua" />

 

Agora em creaturescripts, crie um arquivo na pasta scripts com isso dentro


function onKill(player, target)

	if Game.getStorageValue(MONSTER_HUNT.storages.monster) == nil then
		return true
	end

	if not player or not target then
		return true
	end

	if player:getStorageValue(MONSTER_HUNT.storages.player) == -1 then
		player:setStorageValue(MONSTER_HUNT.storages.player, 0)
	end

	if target:isMonster() and target:getName():lower() == (MONSTER_HUNT.list[Game.getStorageValue(MONSTER_HUNT.storages.monster)]):lower() then
		player:setStorageValue(MONSTER_HUNT.storages.player, player:getStorageValue(MONSTER_HUNT.storages.player) + 1)
		player:sendTextMessage(MESSAGE_STATUS_BLUE_LIGHT, MONSTER_HUNT.messages.prefix .. MONSTER_HUNT.messages.kill:format(player:getStorageValue(MONSTER_HUNT.storages.player), target:getName()))
		table.insert(MONSTER_HUNT.players, {player:getId(), player:getStorageValue(MONSTER_HUNT.storages.player)})
	end

	return true
end

 

Com a tag no creaturescripts


<event type="kill" name="MonsterHunt" script="custom/monsterHunt.lua" />

 

Não esqueça de registrar o evento no login.lua


player:registerEvent("MonsterHunt")

 

Bom aproveito.

 

Créditos: 100% meu :) 

 

Agora, Caverinhaaaaa disse:

 

Esta dando erro no Login.lua

 

Link para o post
Compartilhar em outros sites

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por looktsx
      Salve Rapaziada ...

      sera q tem como cria um script de addon doll ou mont doll ? 
      ou um npc q vende addon e montaria, pra versao 13.11 do tibia ?
       
      pode me ajuda fico muito grato 
    • Por Rpzada
      Oi boa tarde.
      Sera q tu pode me ajudar como uma duvida... no meu otserver. Tenho cliente 13 e client otc... ai os npcs no 13 ele reconhece dinheiro do banco quando vou comprar... porem no otc eu tenho q estar com dinheiro na bag.... tu sabe o pq e como arrumo isso... queria q no otc ele reconhecesse o dinheiro no bank
    • Por Anderson Sacani
      Estou criando um servidor com base nos scripts de TFS 1.x e voltado ao público da america latina por causa do baixo ping na VPS... Argentina, Bolívia, Brasil, Chile, entre outros, portanto sei que falamos em português e nossos vizinhos em espanhol.
      Todos os sistemas do meu servidor são pensados para terem traduções e venho por meio deste tópico compartilhar à vocês algumas dessas funções:
       
      Antes de qualquer coisa, você precisará adicionar a seguinte variável em alguma biblioteca:
      USER_LANGUAGE = 1022118443  
      Agora que adicionou essa variável em alguma biblioteca, poderá adicionar as seguintes funções na mesma biblioteca, porém a baixo da variável USER_LANGUAGE.
       
      A primeira função serve para retornar qual idioma o player está usando:
      --[[ getLanguage, how to use: player:getLanguage() ]] function Player.getLanguage(self) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return "portuguese" else return "spanish" end else print("getLanguage: Only works on players..") end end Um exemplo de como usar: player:getLanguage()
       
      A segunda função serve para alterar o idioma do player. O ideal é que seja usada na primeira vez em que o player loga no servidor:
      --[[ setLanguage, how to use: player:setLanguage("portuguese") ]] function Player.setLanguage(self, language) local value = 0 if self:isPlayer() then if language == "portuguese" then value = 0 elseif language == "spanish" then value = 1 else print("setLanguage: Only two options available. Choose one of them: 'portuguese' or 'spanish'.") end return self:setStorageValue(USER_LANGUAGE, value) else print("setLanguage: Only works on players..") end end Exemplos de como usar:
      player:setLanguage("portuguese")
      ou
      player:setLanguage("spanish")
       
      A terceira e não menos importante função, serve para mandar uma mensagem de texto ao jogador, porém ele receberá no idioma em que escolheu:
      --[[ sendLanguageTextMessage, how to use: local portugueseMessage = "Ola, tudo bom? Isto aqui é um algoritmo!" local spanishMessage = "Hola todo bien? Esto de aqui es un algoritmo!" player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage,spanishMessage) ]] function Player.sendLanguageTextMessage(self, type, portugueseMessage, spanishMessage) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return self:sendTextMessage(type, portugueseMessage) else return self:sendTextMessage(type, spanishMessage) end else print("sendLanguageTextMessage: Only works on players..") end end Um exemplo de como usar:
      player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage, spanishMessage)
      O primeiro parâmetro é o tipo de mensagem, o segundo parâmetro será a mensagem em português e o terceiro parâmetro será em espanhol.
    • Por Rodrigo Querobim
      Salve rapaziada eu tenho o server canary open source e quando implementei os bosses atuais começou dar este erro, nem mexi nessa linha que esta dando os erros, alguem sabe me dizer oq pode ser?



       
    • Por Tofames
      Hi,
      Para devolver o que recebi aqui, colocarei para si um sistema de transformação a trabalhar na TFS 1.X.
      (Testei em 1.4.2) 
       
      MUDANÇA DE SOURCE NECESSÁRIA PARA O BOM FUNCIONAMENTO!
      Havia algo dentro do código TFS (e provavelmente outras distros) que não estava funcionando corretamente e depois que eu informei, eles se fundiram em tfs principais, então já está dentro do TFS 1.5, mas não está em versões mais antigas.
      Trata-se de refrescar a velocidade do jogador após a transformação, se você não tiver isso, então sua velocidade do vocations.xml baseSpeed não é refrescada.
      Você precisa adicionar isto às sources:
      https://github.com/otland/forgottenserver/pull/4215/files
      se você não tem acesso às sources, eu tenho um meio de contornar isso, mas não vou inundar este posto, então escreva em pv.
       
      Créditos: 
      Erexo (guião original)
      Itutorial (TFS 1.X),
      Tofame (alteração: talkaction --> spell; source mudanças; correções do scripts)
       

      transform system.mp4  
      no final do global.lua:
      --[[ voc = from vocation newVoc = to vocation looktype = new outfit revertLooktype = current outfit level = lvl needed to transform rage = soul needed to transform (you can disable it, just type 0) kiToTrans = mana to transform addHp = maxHp added when you transform addKi = maxMana added effectOn = magic effect when you use transform aura = magic effect when you have current transform (can be disabled, just type 0). type nil in this version constant = if transform is constant (when it is, player dont lose transform/outfit and maxHp/Mana, and cannot use revert) --]] exhaust_transform = {} -- [1-8] naruto, transform = { [1] = {voc = 1, newVoc = 2, from_looktype = 2, looktype = 3, level = 50, rage = 0, mana = 50, addHealth = 450, addMana = 450, effect = 76, aura = nil, constant = false}, [2] = {voc = 2, newVoc = 3, from_looktype = 3, looktype = 4, level = 100, rage = 0, mana = 50, addHealth = 500, addMana = 500, effect = 76, aura = nil, constant = false}, [3] = {voc = 3, newVoc = 4, from_looktype = 4, looktype = 5, level = 150, rage = 0, mana = 50, addHealth = 650, addMana = 650, effect = 76, aura = nil, constant = false}, [4] = {voc = 4, newVoc = 5, from_looktype = 5, looktype = 6, level = 200, rage = 0, mana = 50, addHealth = 800, addMana = 800, effect = 76, aura = nil, constant = false}, [5] = {voc = 5, newVoc = 6, from_looktype = 6, looktype = 7, level = 250, rage = 0, mana = 50, addHealth = 900, addMana = 900, effect = 76, aura = nil, constant = false}, [6] = {voc = 6, newVoc = 7, from_looktype = 7, looktype = 8, level = 300, rage = 0, mana = 50, addHealth = 1000, addMana = 1000, effect = 76, aura = nil, constant = false}, [7] = {voc = 7, newVoc = 8, from_looktype = 8, looktype = 9, level = 400, rage = 0, mana = 50, addHealth = 1500, addMana = 1500, effect = 76, aura = nil, constant = false}, [8] = {voc = 8, newVoc = 9, from_looktype = 9, looktype = 10, level = 500, rage = 0, mana = 50, addHealth = 1500, addMana = 1500, effect = 76, aura = nil, constant = false} -- end naruto transforms } spells/scripts/revert.lua
      local combat = Combat() combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onCastSpell(player, variant) local pid = player:getId() local TRANS = transform[player:getVocation():getId() - 1] -- - [player:getVocation():getId() - 4] domyslnie, should be -1. if not TRANS then player:sendCancelMessage("You cannot revert.") return false end local outfit = player:getOutfit() outfit.lookType = TRANS.from_looktype if TRANS.constant then player:setOutfit(outfit) else player:setOutfit(outfit, false) end exhaust_transform[pid] = 1 player:setMaxHealth(player:getMaxHealth() - TRANS.addHealth) player:setMaxMana(player:getMaxMana() - TRANS.addMana) player:setVocation(TRANS.voc) player:save() return combat:execute(player, variant) end spells/scripts/transform.lua
      local combat = Combat() combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onCastSpell(player, variant) local effectPosition = Position(player:getPosition().x, player:getPosition().y, player:getPosition().z) local pid = player:getId() local TRANS = transform[player:getVocation():getId()] if not TRANS then player:sendCancelMessage("You cannot transform.") return false end if TRANS.effect == 76 then effectPosition = Position(player:getPosition().x + 2, player:getPosition().y, player:getPosition().z) end if player:getLevel() < TRANS.level then player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.") return false end if player:getSoul() < TRANS.rage then player:sendCancelMessage("You need "..TRANS.rage.." to transform.") return false end if player:getMana() < TRANS.mana then player:sendCancelMessage("You need "..TRANS.mana.." to transform.") return false end local outfit = player:getOutfit() outfit.lookType = TRANS.looktype if TRANS.constant then player:setOutfit(outfit) else player:setOutfit(outfit, false) end player:addSoul(-TRANS.rage) player:setMaxHealth(player:getMaxHealth() + TRANS.addHealth) player:setMaxMana(player:getMaxMana() + TRANS.addMana) effectPosition:sendMagicEffect(TRANS.effect) player:setVocation(TRANS.newVoc) player:save() return combat:execute(player, variant) end spells.xml:
      <instant group="support" spellid="175" name="Revert" words="revert" level="1" mana="10" aggressive="0" selftarget="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="revert.lua" /> <instant group="support" spellid="175" name="Transform" words="transform" level="1" mana="10" aggressive="0" selftarget="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="transform.lua" />  
       
      As coisas abaixo são opcionais, adicione-as se você quiser ter aura. Se você não estiver usando, deixe a aura = nil em global.lua
      Também observei que isso poderia causar atrasos/screen freeze, por isso não recomendo o uso de aura.
       
      globalevents.xml adicionar linha:
      <globalevent name="TransformEffects" interval="2000" script="TransformEffects.lua"/> TransformEffects.lua (data/globalevents/scripts/TransformEffects.lua):
      function onThink(interval) for _, player in pairs(Game.getPlayers()) do if player then TRANS = transform[player:getVocation():getId()] if TRANS then if TRANS.aura ~= nil then player:getPosition():sendMagicEffect(TRANS.aura) end end end end return true end  
      edit:
      só consigo falar um pouco de espanhol e muito bem em inglês, por isso uso DEEPL para falar portugês.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo