Ir para conteúdo
  • Cadastre-se

(Resolvido)Event Creaturescripts


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Alguem poderia me dizer porque esse script não funciona ?

é um boss e quando esse boss morre todos em determinada area recebe o premio:

 

Obs: ja registrei no monster

 

Spoiler

local config = {
    playerCount = 3915, -- Global storage for counting the players left/entered in the event
    fromPosition = {x = 1163, y = 1056, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1187, y = 1083, z = 7}, -- bottom right cornor of the playground

}

 

local boss1 = "Agorak"
 

local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
        if isInRange(getPlayerPosition(pid), config.fromPosition, config.toPosition) then
            table.insert(players, pid)
        end
    end

 

function onDeath(cid)

                if isMonster and getCreatureName(cid) == boss1 then
                if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
                doBroadcastMessage("O boss (".. boss1 .. ") foi morto e os jogadores dentro do World Boss Event foram recompensados com 10 event coins, 10 crystal coins e 5 event points.", MESSAGE_STATUS_CONSOLE_BLUE)            
                for i = 1, 10 do  
                doPlayerAddItem(cid, 2159, 10)
                doPlayerAddItem(cid, 2160, 10)
                doPlayerAddPontos(cid, 5)
                end
                end
                end
           

 

Link para o post
Compartilhar em outros sites

Aparece na distro algum erro??

Editado por tetheuscunha (veja o histórico de edições)

Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.

Link para o post
Compartilhar em outros sites

[15/9/2018 21:39:22] [Error - CreatureScript Interface] 
[15/9/2018 21:39:22] data/creaturescripts/scripts/world teste.lua:onDeath
[15/9/2018 21:39:22] Description: 
[15/9/2018 21:39:22] (LuaInterface::luaDoPlayerAddItem) Player not found

Link para o post
Compartilhar em outros sites

Tenta assim:

 

local config = {
    playerCount = 3915, -- Global storage for counting the players left/entered in the event
    fromPosition = {x = 1163, y = 1056, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1187, y = 1083, z = 7}, -- bottom right cornor of the playground

}

 

local boss1 = "Agorak"
 

local players = {}
    for _, pid in ipairs(getPlayersOnline()) do
        if isInRange(getPlayerPosition(pid), config.fromPosition, config.toPosition) then
            table.insert(players, pid)
        end
    end

 

function onDeath(cid)

                if isMonster and getCreatureName(cid) == boss1 then
                if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
                doBroadcastMessage("O boss (".. boss1 .. ") foi morto e os jogadores dentro do World Boss Event foram recompensados com 10 event coins, 10 crystal coins e 5 event points.", MESSAGE_STATUS_CONSOLE_BLUE)            
                for i = 1, 10 do  
                doPlayerAddItem(players, 2159, 10)
                doPlayerAddItem(players, 2160, 10)
                doPlayerAddPontos(players, 5)
                end
                end
                end

Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.

Link para o post
Compartilhar em outros sites

O erro ainda continua 

 

Spoiler

[16/9/2018 8:20:25] [Error - CreatureScript Interface] 
[16/9/2018 8:20:25] In a timer event called from: 
[16/9/2018 8:20:25] data/creaturescripts/scripts/world teste.lua:onDeath
[16/9/2018 8:20:25] Description: 
[16/9/2018 8:20:25] (LuaInterface::luaDoPlayerAddItem) Player not found

[16/9/2018 8:20:25] [Error - CreatureScript Interface] 
[16/9/2018 8:20:25] In a timer event called from: 
[16/9/2018 8:20:25] data/creaturescripts/scripts/world teste.lua:onDeath
[16/9/2018 8:20:25] Description: 
[16/9/2018 8:20:25] (LuaInterface::luaDoPlayerAddItem) Player not found

[16/9/2018 8:20:25] [Error - CreatureScript Interface] 
[16/9/2018 8:20:25] In a timer event called from: 
[16/9/2018 8:20:25] data/creaturescripts/scripts/world teste.lua:onDeath
[16/9/2018 8:20:25] Description: 
[16/9/2018 8:20:25] (LuaInterface::luaGetCreatureStorage) Creature not found
 

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • Solução
local config = {
    playerCount = 3915, -- Global storage for counting the players left/entered in the event
    fromPosition = {x = 1163, y = 1056, z = 7}, -- top left cornor of the playground
    toPosition = {x = 1187, y = 1083, z = 7} -- bottom right cornor of the playground

}
local boss1 = "Agorak"
function onDeath(cid)
	if isMonster and getCreatureName(cid) == boss1 then
		if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
                	doBroadcastMessage("O boss (".. boss1 .. ") foi morto e os jogadores dentro do World Boss Event foram recompensados com 10 event coins, 10 crystal coins e 5 event points.", MESSAGE_STATUS_CONSOLE_BLUE)
			    for _, pid in ipairs(getPlayersOnline()) do
        			if isInRange(getPlayerPosition(pid), config.fromPosition, config.toPosition) then            
                			doPlayerAddItem(pid, 2159, 10)
                			doPlayerAddItem(pid, 2160, 10)
                			doPlayerAddPontos(pid, 5)
				end
			end
		end
	end
return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo