Ir para conteúdo
  • 0

Criei um script aqui mais fica dando esse error


tonynamoral

Pergunta

Olá galera , eu criei um script aqui , que faz o seguinte.

 

O Player começa uma task , que quando mata a certa quantidade , ele é teleportado para outra sala (que é de uma quest do meu servidor) .

 

Então criei esse script :


local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
msg = "You are kiling "..getPlayerStorageValue(cid,storage_moster).." of "..configs.quant.."",
}
local monster = "Dragon"
local monster2 = "Dragon Lord"
local monster3 = "Dragon Lord Hatchling"
local function onTeleportar(cid)
doTeleportThing(cid,pos)
end
local function onContar(cid)
addEvent(doSendAnimatedText,5*1000,getThingPos(cid),1,28)
addEvent(doSendAnimatedText,4*1000,getThingPos(cid),2,28)
addEvent(doSendAnimatedText,3*1000,getThingPos(cid),3,28)
addEvent(doSendAnimatedText,2*1000,getThingPos(cid),4,28)
addEvent(doSendAnimatedText,1*1000,getThingPos(cid),5,28)
end

function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
onContar(cid)
addEvent(function() onTeleportar(cid) end,6*1000)
end
if getPlayerStorageValue(cid,configs.storage_Start) >= 1 then
if getCreatureName(target) == monster or monster2 or monster3 then
setPlayerStorageValue(cid,configs.storage_monster,getPlayerStorageValue(cid,configs.storage_monster)+1)
doPlayerSendTextMessage(cid,27,configs.msg)
return true
end
end
end

 

E fica dando esse error aqui.


[13/12/2012 10:39:23] [Error - CreatureScript Interface] 
[13/12/2012 10:39:23] data/creaturescripts/scripts/scriptdeboss.lua
[13/12/2012 10:39:23] Description: 
[13/12/2012 10:39:23] data/creaturescripts/scripts/scriptdeboss.lua:7: attempt to index global 'configs' (a nil value)
[13/12/2012 10:39:23] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/scriptdeboss.lua)
[13/12/2012 10:39:23] data/creaturescripts/scripts/scriptdeboss.lua:31: 'end' expected (to close 'function' at line 23) near '<eof>'

 

O Que é exatamente isso? poderiam solucionar para min ?

Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0

local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
monsters = {"Dragon", "Dragon Lord", "Dragon Lord Hatchling"}
pos = {x=1111,y=1111,z=1}
}

function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
	for i = 1, 5 do
		addEvent(doSendAnimatedText,i *1000,getThingPos(cid),i,28)
	end
	addEvent(doTeleportThing, 6*1000, cid, config.pos)
   elseif getPlayerStorageValue(cid,configs.storage_Start) >= 1 then
	if isInArray(config.monsters, getCreatureName(target)) then
		setPlayerStorageValue(cid,configs.storage_monster,getPlayerStorageValue(cid,configs.storage_monster)+1)
		doPlayerSendTextMessage(cid,27,"You killed "..getPlayerStorageValue(cid,storage_moster).." of "..configs.quant..".",)
		return true
	end
end
return true
end

 

Fiz aqui rapidão, nem testei. Dá uma olhada e uma lida e compare com o que tu fez, já dá pra ter uma noção do que tava errado.

Editado por iunix
Link para o comentário
Compartilhar em outros sites

  • 0

tonynamoral

Alguns erros ortográficos e de configurações, use esse script:

local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
msg = 'You are kiling "..getPlayerStorageValue(cid, configs.storage_monster).." of "..configs.quant.."'
}
local monster = "Dragon"
local monster2 = "Dragon Lord"
local monster3 = "Dragon Lord Hatchling"
local function onTeleportar(cid)
doTeleportThing(cid, pos)
end
local function onContar(cid)
addEvent(doSendAnimatedText,5*1000,getThingPos(cid),1,28)
addEvent(doSendAnimatedText,4*1000,getThingPos(cid),2,28)
addEvent(doSendAnimatedText,3*1000,getThingPos(cid),3,28)
addEvent(doSendAnimatedText,2*1000,getThingPos(cid),4,28)
addEvent(doSendAnimatedText,1*1000,getThingPos(cid),5,28)
end
function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
onContar(cid)
addEvent(function() onTeleportar(cid) end,6*1000)
end
if getPlayerStorageValue(cid, configs.storage_start) >= 1 then
if getCreatureName(target) == monster or getCreatureName(target) == monster2 or getCreatureName(target) == monster3 then
setPlayerStorageValue(cid, configs.storage_monster, getPlayerStorageValue(cid, configs.storage_monster)+1)
doPlayerSendTextMessage(cid, 27,configs.msg)
return true
end
end
end

 

iunix

Seu script correto seria:

local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
monsters = {"Dragon", "Dragon Lord", "Dragon Lord Hatchling"},
pos = {x=1111,y=1111,z=1}
}
function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
for i = 1, 5 do
addEvent(doSendAnimatedText,i *1000,getThingPos(cid),i,28)
end
addEvent(doTeleportThing, 6*1000, cid, config.pos)
elseif getPlayerStorageValue(cid,configs.storage_Start) >= 1 then
if isInArray(config.monsters, getCreatureName(target)) then
setPlayerStorageValue(cid,configs.storage_monster,getPlayerStorageValue(cid,configs.storage_monster)+1)
doPlayerSendTextMessage(cid,27,"You killed "..getPlayerStorageValue(cid,storage_monster).." of "..configs.quant..".")
return true
end
end
return true
end

Editado por HidekiKty
Link para o comentário
Compartilhar em outros sites

  • 0

tonynamoral

Alguns erros ortográficos e de configurações, use esse script:

local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
msg = 'You are kiling "..getPlayerStorageValue(cid, configs.storage_monster).." of "..configs.quant.."'
}
local monster = "Dragon"
local monster2 = "Dragon Lord"
local monster3 = "Dragon Lord Hatchling"
local function onTeleportar(cid)
doTeleportThing(cid, pos)
end
local function onContar(cid)
addEvent(doSendAnimatedText,5*1000,getThingPos(cid),1,28)
addEvent(doSendAnimatedText,4*1000,getThingPos(cid),2,28)
addEvent(doSendAnimatedText,3*1000,getThingPos(cid),3,28)
addEvent(doSendAnimatedText,2*1000,getThingPos(cid),4,28)
addEvent(doSendAnimatedText,1*1000,getThingPos(cid),5,28)
end
function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
onContar(cid)
addEvent(function() onTeleportar(cid) end,6*1000)
end
if getPlayerStorageValue(cid, configs.storage_start) >= 1 then
if getCreatureName(target) == monster or monster2 or monster3 then
setPlayerStorageValue(cid, configs.storage_monster, getPlayerStorageValue(cid, configs.storage_monster)+1)
doPlayerSendTextMessage(cid, 27,configs.msg)
return true
end
end
end

 

iunix

Seu script correto seria:

local configs = {
storage_start = 87812,
storage_monster = 81251,
storage_finish = 90125,
quant = 100,
quant2 = 99,
monsters = {"Dragon", "Dragon Lord", "Dragon Lord Hatchling"},
pos = {x=1111,y=1111,z=1}
}
function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then
for i = 1, 5 do
addEvent(doSendAnimatedText,i *1000,getThingPos(cid),i,28)
end
addEvent(doTeleportThing, 6*1000, cid, config.pos)
elseif getPlayerStorageValue(cid,configs.storage_Start) >= 1 then
if isInArray(config.monsters, getCreatureName(target)) then
setPlayerStorageValue(cid,configs.storage_monster,getPlayerStorageValue(cid,configs.storage_monster)+1)
doPlayerSendTextMessage(cid,27,"You killed "..getPlayerStorageValue(cid,storage_monster).." of "..configs.quant..".")
return true
end
end
return true
end

Eu reli o script 4x, procurando uma virgula... Valeu ai xD

Link para o comentário
Compartilhar em outros sites

  • 0

tonynamoral

Script incorreto:

 

local configs = {

storage_start = 87812,

storage_monster = 81251,

storage_finish = 90125,

quant = 100,

quant2 = 99,

msg = "You are kiling "..getPlayerStorageValue(cid,storage_moster).." of "..configs.quant.."",

}

local monster = "Dragon"

local monster2 = "Dragon Lord"

local monster3 = "Dragon Lord Hatchling"

local function onTeleportar(cid)

doTeleportThing(cid,pos)

end

local function onContar(cid)

addEvent(doSendAnimatedText,5*1000,getThingPos(cid),1,28)

addEvent(doSendAnimatedText,4*1000,getThingPos(cid),2,28)

addEvent(doSendAnimatedText,3*1000,getThingPos(cid),3,28)

addEvent(doSendAnimatedText,2*1000,getThingPos(cid),4,28)

addEvent(doSendAnimatedText,1*1000,getThingPos(cid),5,28)

end

function onKill(cid, target, lastHit)

if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then

onContar(cid)

addEvent(function() onTeleportar(cid) end,6*1000)

end

if getPlayerStorageValue(cid,configs.storage_Start) >= 1 then

if getCreatureName(target) == monster or monster2 or monster3 then

setPlayerStorageValue(cid,configs.storage_monster,getPlayerStorageValue(cid,configs.storage_monster)+1)

doPlayerSendTextMessage(cid,27,configs.msg)

return true

end

end

end

 

Vermelho: Incorreto.

 

Script correto:

 

local configs = {

storage_start = 87812,

storage_monster = 81251,

storage_finish = 90125,

quant = 100,

quant2 = 99,

msg = 'You are kiling "..getPlayerStorageValue(cid, configs.storage_monster).." of "..configs.quant.."'

}

local monster = "Dragon"

local monster2 = "Dragon Lord"

local monster3 = "Dragon Lord Hatchling"

local function onTeleportar(cid)

doTeleportThing(cid, pos)

end

local function onContar(cid)

addEvent(doSendAnimatedText,5*1000,getThingPos(cid),1,28)

addEvent(doSendAnimatedText,4*1000,getThingPos(cid),2,28)

addEvent(doSendAnimatedText,3*1000,getThingPos(cid),3,28)

addEvent(doSendAnimatedText,2*1000,getThingPos(cid),4,28)

addEvent(doSendAnimatedText,1*1000,getThingPos(cid),5,28)

end

function onKill(cid, target, lastHit)

if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then

onContar(cid)

addEvent(function() onTeleportar(cid) end,6*1000)

end

if getPlayerStorageValue(cid, configs.storage_start) >= 1 then

if getCreatureName(target) == monster or getCreatureName(target) == monster2 or getCreatureName(target) == monster3 then

setPlayerStorageValue(cid, configs.storage_monster, getPlayerStorageValue(cid, configs.storage_monster)+1)

doPlayerSendTextMessage(cid, 27,configs.msg)

return true

end

end

end

 

Azul: Correto.

Editado por HidekiKty
Link para o comentário
Compartilhar em outros sites

  • 0

Tente subistituir:

function onKill(cid, target, lastHit)
if(getPlayerStorageValue(cid,configs.storage_monster) == configs.quant) then

por:

function onKill(cid, target, lastHitKiller)
if getCreatureName(lastHitKiller) == monster or getCreatureName(lastHitKiller) == monster2 or getCreatureName(lastHitKiller) == monster3 and getPlayerStorageValue(cid,configs.storage_monster) == configs.quant then

Editado por HidekiKty
Link para o comentário
Compartilhar em outros sites

  • 0

msg = 'You are kiling "..getPlayerStorageValue(cid, configs.storage_monster).." of "..configs.quant.."'

mano n se pode usar nenhuma funçao q precise do 'cid' fora da funçao principal do script...

essa msg teria q tar embaixo da funçao onKill...

 

e como o nosso querido brun123 sempre diz... para tasks desse tpw, o melhor eh usar onDeath e colocar o evento soh nos monstro da task.. para poupar execuçoes desnecessarias do script.. '--'

 

sem flar q isso..

if getCreatureName(target) == monster or monster2 or monster3 then 

tb esta incorreto.. n se pode fazer esse tpw de comparaçao.. teria q ser..

if getCreatureName(target) == monster or getCreatureName(target) == monster2 or getCreatureName(target) == monster3 then

 

melhor eh pegar o script do @iunix q parece esta 100%

Editado por Slicer
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...