Ir para conteúdo

Featured Replies

Postado

deu esse error :

 

[Error - CreatureScript Interface]
data/creaturescripts/scripts/DUCA_creaturescript.lua:onLogout
Description:
data/creaturescripts/scripts/DUCA_creaturescript.lua:11: attempt to compare number with string
stack traceback:
        data/creaturescripts/scripts/DUCA_creaturescript.lua:11: in function <data/creaturescripts/scripts/DUCA_creaturescript.lua:10>

[Error - MoveEvents Interface]
data/movements/scripts/DUCA_movements.lua:onStepIn
Description:
data/movements/scripts/DUCA_movements.lua:21: attempt to compare number with string
stack traceback:
        data/movements/scripts/DUCA_movements.lua:21: in function <data/movements/scripts/DUCA_movements.lua:3>

 

 

 

Quem tiver esse erro, é só mudar a storage no arquivo DUCA.lua na lib. Conflito de Storage

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

  • 1 month later...
  • Respostas 33
  • Visualizações 7k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Muito bom, implantei no meu servidor já, quando terminar meu projeto irei testa-lo online! Eu peguei esse mapa de um servidor de WAR, caso alguém queira deixarei o link. Duca on Mediafire (D

  • luanluciano93
    luanluciano93

    Obrigado, já adicionei o mapa opcional ao tópico.

  • luanluciano93
    luanluciano93

    Tópico atualizado, uma pequena modificação para simplicar um código no arquivo creaturescript:    - if (getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 1 and getPlayerStorageValue(target, DUC

Posted Images

Postado

1 Problema e 1 Dúvida.

 

1 Problema - Quando nasce o teleport na localização que eu determinei, ele esta nascendo sem destino, digo... não envia o player para o templo "Black" ou "White. Eu achei que era porque eu não coloquei o ActionID 48000 no chão, então o mesmo eu fiz, só que, ainda sim, não funcionou, e não permitiu minha entrada no TP e exibiu essa mensagem:

 

11:49 The tile seems to be protected against unwanted intruders.

 

1 Dúvida - Como coloco no Global Events para ocorrer o evento todos os dias em 1 determinado horário?

 

<globalevent name="Duca" time="19:00:00" script="DUCA_globalevents.lua" />

 

 

Agora a LIB.

 

-- DUCA EVENTO by luanluciano93

DUCA = {
	EVENT_MINUTES = 2,
	TELEPORT_POSITION = {x = 1102, y = 987, z = 7},
	STORAGE_TEAM = 27000,
	TOTAL_PONTOS = 27001,
	TOTAL_PLAYERS = 27003, -- global storage
	LEVEL_MIN = 500,
	REWARD_FIRST = {11773, 1},
	REWARD_SECOND = {9971, 15},

	TEAMS = {
		[1] = {color = "Black", temple = {x = 2248, y = 1251, z = 7}},
		[2] = {color = "White", temple = {x = 2206, y = 1192, z = 7}},
		[3] = {color = "Red"},
		[4] = {color = "Green"},
    }, 
}

local conditioBlack = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioBlack, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioBlack, {lookType = 128, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114})

local conditioWhite = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioWhite, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioWhite, {lookType = 128, lookHead = 19, lookBody = 19, lookLegs = 19, lookFeet = 19})

local conditioRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioRed, {lookType = 134, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

local conditioGreen = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioGreen, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioGreen, {lookType = 134, lookHead = 101, lookBody = 101, lookLegs = 101, lookFeet = 101})

-- function DUCA.teleportCheck()
DUCA.teleportCheck = function()
	local item = getTileItemById(DUCA.TELEPORT_POSITION, 1387).uid
	if item > 0 then
		doRemoveItem(item)
		DUCA.finishEvent()

		print(">>> Duca Event was finished. <<<")
	else		
		doBroadcastMessage("Duca Event was started and will close in ".. DUCA.EVENT_MINUTES .." minutes.")
		print(">>> Duca Event was started. <<<")

		local teleport = doCreateItem(1387, 1, DUCA.TELEPORT_POSITION)
		doItemSetAttribute(teleport, "aid", 48000)

		setGlobalStorageValue(DUCA.TOTAL_PLAYERS, 0)
		addEvent(DUCA.teleportCheck, DUCA.EVENT_MINUTES * 60 * 1000)
	end
end

-- function DUCA.addPlayerinTeam(cid, team)
DUCA.addPlayerinTeam = function(cid, team)
	doRemoveCondition(cid, CONDITION_OUTFIT)
	doRemoveCondition(cid, CONDITION_INVISIBLE)
	if team == 1 then
		doAddCondition(cid, conditioBlack)
	elseif team == 2 then
		doAddCondition(cid, conditioWhite)
	elseif team == 3 then
		doAddCondition(cid, conditioRed)
	elseif team == 4 then
		doAddCondition(cid, conditioGreen)
	end
	setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, team)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the " .. DUCA.TEAMS[team].color .. " Team.")
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
	doCreatureAddMana(cid, getCreatureMaxMana(cid))
end


-- function DUCA.balanceTeam()
DUCA.balanceTeam = function()
	local time1, time2 = 0, 0
	for _, cid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 1 then
			time1 = time1 + 1
		elseif getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 2 then
			time2 = time2 + 1
		end
	end

	return (time1 <= time2) and 1 or 2
end

-- function DUCA.removePlayer(cid)
DUCA.removePlayer = function(cid)
	doRemoveCondition(cid, CONDITION_OUTFIT)
	--doRemoveCondition(cid, CONDITION_HUNTING)
	--doRemoveCondition(cid, CONDITION_INFIGHT)
	--doRemoveCondition(cid, CONDITIONID_COMBAT)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are dead in Duca Event and your Duca points is set to 0!")
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
	doCreatureAddMana(cid, getCreatureMaxMana(cid))	
	setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, 0)
	setPlayerStorageValue(cid, DUCA.TOTAL_PONTOS, 0)
	unregisterCreatureEvent(cid, "Duca-Death")
	unregisterCreatureEvent(cid, "Duca-Combat")
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

	setGlobalStorageValue(DUCA.TOTAL_PLAYERS, getGlobalStorageValue(DUCA.TOTAL_PLAYERS) - 1)
end

-- function DUCA.updateRank()
DUCA.updateRank = function()
	local participantes = {}
	for _, uid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then
			table.insert(participantes, uid)
		end
	end

	table.sort(participantes, function(a, b) return getPlayerStorageValue(a, DUCA.TOTAL_PONTOS) > getPlayerStorageValue(b, DUCA.TOTAL_PONTOS) end)
	
	for x = 1, #participantes do
		if getPlayerStorageValue(participantes[x], DUCA.STORAGE_TEAM) >= 3 then
			DUCA.addPlayerinTeam(participantes[x], DUCA.balanceTeam())
		end
	end
	
	if (#participantes >= 1) then
		DUCA.addPlayerinTeam(participantes[1], 4)
	end
    
    	if (#participantes >= 11) then
    		for i = 2, 11 do
			DUCA.addPlayerinTeam(participantes[i], 3)
		end
	end
end

-- function DUCA.finishEvent()
DUCA.finishEvent = function()
	DUCA.updateRank()
	for _, uid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 4 then
			local winner = getCreatureName(uid)
			doBroadcastMessage("Congratulation ".. winner .."!! Duca Event is finish. ".. winner .." win reward.")
			doPlayerAddItem(uid, DUCA.REWARD_FIRST[1], DUCA.REWARD_FIRST[2])
		elseif getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 3 then
			doPlayerAddItem(uid, DUCA.REWARD_SECOND[1], DUCA.REWARD_SECOND[2])
		end

		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then
			DUCA.removePlayer(uid)
		end
	end
end

 

 

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

Postado
2 horas atrás, JcA disse:

1 Problema e 1 Dúvida.

 

1 Problema - Quando nasce o teleport na localização que eu determinei, ele esta nascendo sem destino, digo... não envia o player para o templo "Black" ou "White. Eu achei que era porque eu não coloquei o ActionID 48000 no chão, então o mesmo eu fiz, só que, ainda sim, não funcionou, e não permitiu minha entrada no TP e exibiu essa mensagem:

 

11:49 The tile seems to be protected against unwanted intruders.

 

1 Dúvida - Como coloco no Global Events para ocorrer o evento todos os dias em 1 determinado horário?

 

<globalevent name="Duca" time="19:00:00" script="DUCA_globalevents.lua" />

 

 

Agora a LIB.

 


-- DUCA EVENTO by luanluciano93

DUCA = {
	EVENT_MINUTES = 2,
	TELEPORT_POSITION = {x = 1102, y = 987, z = 7},
	STORAGE_TEAM = 27000,
	TOTAL_PONTOS = 27001,
	TOTAL_PLAYERS = 27003, -- global storage
	LEVEL_MIN = 500,
	REWARD_FIRST = {11773, 1},
	REWARD_SECOND = {9971, 15},

	TEAMS = {
		[1] = {color = "Black", temple = {x = 2248, y = 1251, z = 7}},
		[2] = {color = "White", temple = {x = 2206, y = 1192, z = 7}},
		[3] = {color = "Red"},
		[4] = {color = "Green"},
    }, 
}

local conditioBlack = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioBlack, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioBlack, {lookType = 128, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114})

local conditioWhite = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioWhite, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioWhite, {lookType = 128, lookHead = 19, lookBody = 19, lookLegs = 19, lookFeet = 19})

local conditioRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioRed, {lookType = 134, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

local conditioGreen = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditioGreen, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditioGreen, {lookType = 134, lookHead = 101, lookBody = 101, lookLegs = 101, lookFeet = 101})

-- function DUCA.teleportCheck()
DUCA.teleportCheck = function()
	local item = getTileItemById(DUCA.TELEPORT_POSITION, 1387).uid
	if item > 0 then
		doRemoveItem(item)
		DUCA.finishEvent()

		print(">>> Duca Event was finished. <<<")
	else		
		doBroadcastMessage("Duca Event was started and will close in ".. DUCA.EVENT_MINUTES .." minutes.")
		print(">>> Duca Event was started. <<<")

		local teleport = doCreateItem(1387, 1, DUCA.TELEPORT_POSITION)
		doItemSetAttribute(teleport, "aid", 48000)

		setGlobalStorageValue(DUCA.TOTAL_PLAYERS, 0)
		addEvent(DUCA.teleportCheck, DUCA.EVENT_MINUTES * 60 * 1000)
	end
end

-- function DUCA.addPlayerinTeam(cid, team)
DUCA.addPlayerinTeam = function(cid, team)
	doRemoveCondition(cid, CONDITION_OUTFIT)
	doRemoveCondition(cid, CONDITION_INVISIBLE)
	if team == 1 then
		doAddCondition(cid, conditioBlack)
	elseif team == 2 then
		doAddCondition(cid, conditioWhite)
	elseif team == 3 then
		doAddCondition(cid, conditioRed)
	elseif team == 4 then
		doAddCondition(cid, conditioGreen)
	end
	setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, team)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the " .. DUCA.TEAMS[team].color .. " Team.")
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
	doCreatureAddMana(cid, getCreatureMaxMana(cid))
end


-- function DUCA.balanceTeam()
DUCA.balanceTeam = function()
	local time1, time2 = 0, 0
	for _, cid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 1 then
			time1 = time1 + 1
		elseif getPlayerStorageValue(cid, DUCA.STORAGE_TEAM) == 2 then
			time2 = time2 + 1
		end
	end

	return (time1 <= time2) and 1 or 2
end

-- function DUCA.removePlayer(cid)
DUCA.removePlayer = function(cid)
	doRemoveCondition(cid, CONDITION_OUTFIT)
	--doRemoveCondition(cid, CONDITION_HUNTING)
	--doRemoveCondition(cid, CONDITION_INFIGHT)
	--doRemoveCondition(cid, CONDITIONID_COMBAT)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are dead in Duca Event and your Duca points is set to 0!")
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
	doCreatureAddMana(cid, getCreatureMaxMana(cid))	
	setPlayerStorageValue(cid, DUCA.STORAGE_TEAM, 0)
	setPlayerStorageValue(cid, DUCA.TOTAL_PONTOS, 0)
	unregisterCreatureEvent(cid, "Duca-Death")
	unregisterCreatureEvent(cid, "Duca-Combat")
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

	setGlobalStorageValue(DUCA.TOTAL_PLAYERS, getGlobalStorageValue(DUCA.TOTAL_PLAYERS) - 1)
end

-- function DUCA.updateRank()
DUCA.updateRank = function()
	local participantes = {}
	for _, uid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then
			table.insert(participantes, uid)
		end
	end

	table.sort(participantes, function(a, b) return getPlayerStorageValue(a, DUCA.TOTAL_PONTOS) > getPlayerStorageValue(b, DUCA.TOTAL_PONTOS) end)
	
	for x = 1, #participantes do
		if getPlayerStorageValue(participantes[x], DUCA.STORAGE_TEAM) >= 3 then
			DUCA.addPlayerinTeam(participantes[x], DUCA.balanceTeam())
		end
	end
	
	if (#participantes >= 1) then
		DUCA.addPlayerinTeam(participantes[1], 4)
	end
    
    	if (#participantes >= 11) then
    		for i = 2, 11 do
			DUCA.addPlayerinTeam(participantes[i], 3)
		end
	end
end

-- function DUCA.finishEvent()
DUCA.finishEvent = function()
	DUCA.updateRank()
	for _, uid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 4 then
			local winner = getCreatureName(uid)
			doBroadcastMessage("Congratulation ".. winner .."!! Duca Event is finish. ".. winner .." win reward.")
			doPlayerAddItem(uid, DUCA.REWARD_FIRST[1], DUCA.REWARD_FIRST[2])
		elseif getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) == 3 then
			doPlayerAddItem(uid, DUCA.REWARD_SECOND[1], DUCA.REWARD_SECOND[2])
		end

		if getPlayerStorageValue(uid, DUCA.STORAGE_TEAM) > 0 then
			DUCA.removePlayer(uid)
		end
	end
end

 

 

 

 

Que eu me lembre, quando instalei não precisei colocar action id em tile algum, esta action aí é a action do teleport que vai ser criado, a única coisa que você vai fazer é determinar o local em que ele irá aparecer...

E quanto a hora do evento, você já pôs a hora, ué.

 

<globalevent name="Duca" time="19:00:00" script="DUCA_globalevents.lua" />

a hora está ali, é só mudar, e o evento já acontece a todos os dias.

Postado
32 minutos atrás, Skipper disse:

 

Que eu me lembre, quando instalei não precisei colocar action id em tile algum, esta action aí é a action do teleport que vai ser criado, a única coisa que você vai fazer é determinar o local em que ele irá aparecer...

E quanto a hora do evento, você já pôs a hora, ué.

 


<globalevent name="Duca" time="19:00:00" script="DUCA_globalevents.lua" />

a hora está ali, é só mudar, e o evento já acontece a todos os dias.

 

Entendi a questão do horário, só que ainda não funciona a destinação.

 

Por exemplo, removi o actionid no chão, porque assim que começa o evento, o proprio script faz um teleport com a actionid nele, e envia os players paras posições configuradas.

 

POREM, é isso que não ocorre, nasce o teleport, e eu entro em cima dele, e não envia para as posições.

 

[1] = {color = "Black", temple = {x = 2248, y = 1251, z = 7}},
[2] = {color = "White", temple = {x = 2206, y = 1192, z = 7}},

Postado
Em 27/08/2017 em 15:26, JcA disse:

 

Entendi a questão do horário, só que ainda não funciona a destinação.

 

Por exemplo, removi o actionid no chão, porque assim que começa o evento, o proprio script faz um teleport com a actionid nele, e envia os players paras posições configuradas.

 

POREM, é isso que não ocorre, nasce o teleport, e eu entro em cima dele, e não envia para as posições.

 

[1] = {color = "Black", temple = {x = 2248, y = 1251, z = 7}},
[2] = {color = "White", temple = {x = 2206, y = 1192, z = 7}},

 

<movevent type="StepIn" actionid="48000" event="script" value="DUCA_movements.lua"/>

 

Resolvi o erro do teleport (era a tag que ta errada no tutorial), na hora de destinar os players, agora só esta ocorrendo 1 problema, quando entra o primeiro player, os demais não entram.

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

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo