antiblock
Cyphriun
  • Chatbox

    Did you check out our Discord? https://discord.gg/FFdvMjk9xA
    You don't have permission to chat.
    Load More
  • 0
Sign in to follow this  
Karbust

Ajuda Pet System

Question

boas pessoal

 

venho aqui pedir ajuda no sistema de pets postado pelo rancoroso: http://cyber-gamers.org/index.php?/topic/6119-release-pet-system-advanced-quest/

 

 

eu clico no item abre a cena de atribuir nome, meto nome, mas a pet n aparece, e se voltar a clicar no item, tenho de voltar a atribuir nome, e sempre assim

 

devia criar uma pasta com o nome da personagem, mas n a cria, mas se criar manualmente, ja consigo invocar a pet

 

alguem sabe como resolver isto???

 

leva mts :+1: 's

 

Obrigado

Share this post


Link to post
Share on other sites

44 answers to this question

antiblock
Cyphriun
  • 0

BUMP

Bem... Tanto BUMP

Verifica se puseste todas a functions do pet_system no quest_functions....

 

Mas vou meter aqui a parte do system (esta funcional para mim) do questlib... se quiseres exprimentar....

PetExpTable = { 	[1] = 300, [2] = 600, [3] = 900, 	[4] = 1200, [5] = 1500, [6] = 1800, 	[7] = 2100, [8] = 2400, [9] = 2700, 	[10] = 3000, [11] = 3300, [12] = 3600, 	[13] = 3900, [14] = 4200, [15] = 4500, 	[16] = 4800, [17] = 5100, [18] = 5400, 	[19] = 5700, [20] = 6000, [21] = 6300, 	[22] = 6600, [23] = 6900, [24] = 7200, 	[25] = 7500, [26] = 7800, [27] = 8100, 	[28] = 8400, [29] = 8700, [30] = 9000,	[31] = 9300, [32] = 9600, [33] = 9900, 	[34] = 10200, [35] = 10500, [36] = 10800, 	[37] = 11100, [38] = 11400, [39] = 11700, 	[40] = 12000, [41] = 12300, [42] = 12600, 	[43] = 12900, [44] = 13200, [45] = 13500, 	[46] = 13800, [47] = 14100, [48] = 14400, 	[49] = 14700, [50] = 15000,	[51] = 15300, 	[52] = 15600, [53] = 15900, [54] = 16200, 	[55] = 16500, [56] = 16800, [57] = 17100, 	[58] = 17400, [59] = 17700, [60] = 18000,	[61] = 18300, [62] = 18600, [63] = 18900, 	[64] = 19200, [65] = 19500, [66] = 19800, 	[67] = 20100, [68] = 20400, [69] = 20700, 	[70] = 21000, [71] = 21300, [72] = 21600, 	[73] = 21900, [74] = 22200, [75] = 22500, 	[76] = 22800, [77] = 23100, [78] = 23400, 	[79] = 23700, [80] = 24000,	[81] = 24300, 	[82] = 24600, [83] = 24900, [84] = 25200, 	[85] = 25500, [86] = 25800, [87] = 26100, 	[88] = 26400, [89] = 26700, [90] = 27000,	[91] = 27300, [92] = 27600, [93] = 27900, 	[94] = 28200, [95] = 28500, [96] = 28800, 	[97] = 29100, [98] = 29400, [99] = 29700, 	[100] = 30000, [101] = 30300, [102] = 30600, 	[103] = 30900, [104] = 31200, [105] = 31500, 	[106] = 31800, [107] = 32100, [108] = 32400, 	[109] = 32700, [110] = 33000, [111] = 33300, 	[112] = 33600, [113] = 33900, [114] = 34200, 	[115] = 34500, [116] = 34800, [117] = 35100, 	[118] = 35400, [119] = 35700, [120] = 36000,	[121] = 36300, [122] = 36600, [123] = 36900, 	[124] = 37200, [125] = 37500, [126] = 37800, 	[127] = 38100, [128] = 38400, [129] = 38700, 	[130] = 39000, [131] = 39300, [132] = 39600, 	[133] = 39900, [134] = 40200, [135] = 40500, 	[136] = 40800, [137] = 41100, [138] = 41400, 	[139] = 41700, [140] = 42000, [141] = 42300, 	[142] = 42600, [143] = 42900, [144] = 43200, 	[145] = 43500, [146] = 43800, [147] = 44100, 	[148] = 44400, [149] = 44700, [150] = 45000,}PetBonus = {	{ "offensivo", { "Valore Attacco Fisico","Valore Attacco Magico", }, { "Forte Vs War","Forte Vs Ninja","Forte Vs Sura","Forte Vs Shamy","Forte Vs Mostri", }, { "Danni Critici","Danni Trafiggenti", }, { "Stordimento","Avvelenamento","Rallentamento", }, },	{ "difensivo", { "Difesa Attacco Fisico","Difesa Attacco Magico", }, { "Res. Spada","Res. Spadone","Res. Pugnali","Res. Campana","Res. Ventaglio","Res. Freccia","Res. Magia", }, { "Max HP","Max MP", }, { "Rigenerazione HP","Rigenerazione MP", }, },	{ 1, { 53,55, }, { 59,60,61,62,63, }, { 15,16, }, { 13,12,14, }, },	{ 2, { 54,56, }, { 29,30,31,32,33,34,37, }, { 1,2, }, { 10,11, }, },}PetArray = {	{53001, "fenice_rossa", "Fenice Rossa", 30068, PetExpTable, { 3,1,3,1, }, },	{53002, "fenice_blu", "Fenice Blu", 30068, PetExpTable, { 3,3,1,1, }, },	{53003, "renna", "Renna", 30068, PetExpTable, { 3,1,1,3, }, },	{53005, "azarel", "Azarel", 30068, PetExpTable, { 2,1,3,2, }, },	{53006, "cane", "Cane", 30068, PetExpTable, { 1,3,1,3, }, },	{53007, "leone", "Leone", 30068, PetExpTable, { 1,1,3,3, }, },	{53008, "cinghiale", "Cinghiale", 30068, PetExpTable, { 1,3,3,1, }, },	{53009, "tigre", "Tigre", 30068, PetExpTable, { 2,3,2,1, }, },}PET_NAME 				= 1PET_LEVEL				= 2PET_EXP					= 3PET_TYPE				= 1PET_BON1				= 2PET_BON2				= 3PET_BON3				= 4PET_BON4				= 5PET_SUMMON				= 0PET_UNSUMMON			= 1PET_READ				= 0PET_WRITE				= 1PET_DATA				= 0PET_BONUS				= 1function inizializza(i)	say_title("Pet System:")	say("")	say("Ciao, hai adottato un nuovo cucciolo")	say("per poterlo evocare, come prima cosa")	say("dovrai dargli un nome.")	local scelta = select("Voglio dargli un nome","Non ora")	if scelta == 2 then		return -1	end	say_title("Pet System:")	say("")	say("Assegna un nome al tuo cucciolo")	say("")	say_reward("Nome:")	local PetName = tostring(input())	if PetName == "" then		say_title("Pet System:")		say("")		say_reward("Non puoi lasciare l'input vuoto!")		return -1	end	local DATA_PATH = "locale/germany/quest/pet/"	local LOCAL_PATH = pc.get_name().."/"	local PET_FILE = PetArray[i][2]..".txt"	local PET_BONUS_FILE = PetArray[i][2].."_bonus.txt"	if pc.getqf("local_path") != 1 then		os.execute("cd "..DATA_PATH.." && mkdir "..LOCAL_PATH.." && chmod 777 "..LOCAL_PATH)		pc.setqf("local_path", 1)	end	local file = io.open(DATA_PATH..LOCAL_PATH..PET_FILE , "w")	file:write(PetName.."n1n0n") --nome livello exp	io.close(file)	local bonus = io.open(DATA_PATH..LOCAL_PATH..PET_BONUS_FILE , "w")	bonus:write("0n0n0n0n0n")		io.close(bonus)	os.execute("cd "..DATA_PATH..LOCAL_PATH.." && chmod 777 *.txt") 	return 0endfunction GetGrade(i)	local PetLevel = tonumber(data_tool(i, PET_LEVEL, PET_DATA, PET_READ))	local x = 0	local y = 0	local Grade = 1	while true do		x = x + 1		y = y + 1		if y == 10 then			Grade = Grade + 1			y = 0		end		if x == PetLevel then 			return Grade		end	endend	function evoca(i, stato)	local bonus = { 3,4,5,6, }	local status = PetArray[i][6]	local PetGrade = tonumber(GetGrade(i))	local PetName = data_tool(i, PET_NAME, PET_DATA, PET_READ)	local PetLevel = tonumber(data_tool(i, PET_LEVEL, PET_DATA, PET_READ))	local horse_level = horse.get_level()	local apply = 0	local level = 21 + i	if stato == PET_SUMMON then		local z = 1		while true do			if bonus[z] == nil then break end			apply = PetGrade*status[z]			affect.add_collect(bonus[z], apply, 60*60*8)			z = z + 1		end		horse.set_level(level)		horse.set_name(PetName)		horse.summon()		chat("Il pet e' stato evocato")		horse.set_level(horse_level)	else		local z = 1		while true do			if bonus[z] == nil then break end			apply = PetGrade*status[z]			affect.remove_collect(bonus[z], apply, 60*60*8)			z = z + 1		end		horse.set_level(level)		horse.unsummon()		chat("Il tuo pet e' andato a riposare")		horse.set_level(horse_level)	endendfunction PetInfo(x)	while true do		say_title("Pet System:")		say("Informazioni abilita':")		say("")		say("Lo stile "..PetBonus[x][1].." si divide in 4")		say("categorie principali.")		say("potrai sviluppare una sola tecnica per categoria")		local y = 0		if x == 1 then			y = select( "Valore Attacco","Attacco Vs. Razza","Aumento del danno","Tecniche Speciali","Indietro")		else			y = select( "Valore Difesa","Difesa Vs. Arma","Aumento dei valori vitali","Tecniche Rigenerative","Indietro")		end		if y == 5 then			break		end		while true do			say_title("Pet System:")			say("Informazioni abilita':")			say("")			say("Con l'apprendimento di questa tecnica potrai")			say("incrementare il valore "..PetBonus[x][1])			say("Tecniche disponibili:")			say("")			local z = 1			while true do				if PetBonus[x][y+1][z] == nil then break end				say_reward(PetBonus[x][y+1][z])				z = z + 1			end			local b = select("Indietro")			if b == 1 then				break			end		end	endendfunction PetSet(i, t)	say_title("Pet System:")	say("Gestione abilita':")	say("")	say("Hai scelto uno stile di combattimento")	say("del tipo "..PetBonus[t][1].." per il tuo pet")	say_reward("confermi?")	local conferma = select("Si","No")	if conferma == 2 then		return	end	say_title("Pet System:")	say("Gestione abilita':")	say("")	say("Una volta scelto lo stile di combattimento")	say("hai la possibilita' di allenare nuove abilita'")	say("scegli con cura le abilita' da sviluppare")	say("")	local k = select("Scelgo ora","Scelgo dopo")	if k == 2 then		return	end	local w = 2	local bonus = {}	local bon = {}	while true do		if PetBonus[t][w] == nil then break end		say_title("Pet System:")		say("Gestione abilita': ")		say("")		say_reward("Puoi allenare solo una delle seguenti abilita'")		say_reward("sceglila con cura...")		say("")		local x = select_table( PetBonus[t][w] )		bonus[w-1] = x		bon[w-1] = PetBonus[t][w][x]		w = w + 1	end	say_title("Pet System:")	say("Gestione abilita':")	say("")	say("Hai scelto:")	say("")	say("Bonus 1:  "..bon[1])	say("Bonus 2:  "..bon[2])	say("Bonus 3:  "..bon[3])	say("Bonus 4:  "..bon[4])	say("")	say_reward("Confermi?")	say("")	local c = select("Si","No")	if c == 2 then		return	end	data_tool(i, t.."n"..bonus[1].."n"..bonus[2].."n"..bonus[3].."n"..bonus[4].."n", PET_BONUS, PET_WRITE)endfunction PetMenuAbi(i)	local check = tonumber(data_tool(i, PET_TYPE, PET_BONUS, PET_READ))	local status = PetArray[i][6]	local PetGrade = tonumber(GetGrade(i))	local PetType = tonumber(data_tool(i, PET_TYPE, PET_BONUS, PET_READ))	local bon1 = tonumber(data_tool(i, PET_BON1, PET_BONUS, PET_READ))	local bon2 = tonumber(data_tool(i, PET_BON2, PET_BONUS, PET_READ))	local bon3 = tonumber(data_tool(i, PET_BON3, PET_BONUS, PET_READ))	local bon4 = tonumber(data_tool(i, PET_BON4, PET_BONUS, PET_READ))	if check == 0 then		while true do			say_title("Pet System:")			say("Benvenuto nel sistema di gestione abilita'")			say("come prima cosa devi decidere che tipo")			say("di istruzione vuoi dare al tuo pet")			local z = select( "Offensiva","Difensiva","Informazioni","Chiudi")			if z == 1 then				PetSet(i, z)				return			elseif z == 2 then				PetSet(i, z)				return			elseif z == 3 then				while true do					say_title("Pet System:")					say("Informazioni abilita':")					say("")					say("Ogni pet può sviluppare 4 abilita'")					say("a seconda dello stile di combattimento")					say("")					local x = select( "Stile Offensivo","Stile Difensivo","Indietro")					if x == 1 then						PetInfo(x)					elseif x == 2 then						PetInfo(x)					elseif x == 3 then						break					end				end			elseif z == 4 then				break			end		end	else		say_title("Pet System:")		say("Gestione abilita':")		say("")		say_reward("Cosa desideri fare?")		say("")		local y = select("Stato abilita'","Reset Abilita'","Chiudi")		if y == 1 then			local point = {}			local p = 1			while true do				if status[p] == nil then break end				point[p] = status[p]*PetGrade				p = p + 1			end			say_title("Pet System:")			say("Stato abilita':")			say("")			say_reward("Status:")			say("VIT:  +"..point[1])			say("INT:  +"..point[2])			say("STR:  +"..point[3])			say("DEX:  +"..point[4])			say_reward("Bonus:")			say(PetBonus[PetType][2][bon1]..":  +"..PetGrade)			say(PetBonus[PetType][3][bon2]..":  +"..PetGrade)			say(PetBonus[PetType][4][bon3]..":  +"..PetGrade)			say(PetBonus[PetType][5][bon4]..":  +"..PetGrade)		elseif y == 2 then			say_title("Pet System:")			say("Reset abilita'")			say("che tipo di istruzione vuoi dare al tuo pet?")			say_reward("Ricorda il reset può essere usato ogni 3 giorni")			local j = select("Stile Offensivo","Stile Difensivo","Chiudi")			if j == 1 then				PetSet(i, j)			elseif j == 2 then				PetSet(i, j)			else				return			end		elseif y == 3 then			return		end	endendfunction show_pet_menu(i)	local PetName = data_tool(i, PET_NAME, PET_DATA, PET_READ)	local PetRace = PetArray[i][3]	local PetFood = PetArray[i][4]	local PetGrade = tonumber(GetGrade(i))	local PetLevel = tonumber(data_tool(i, PET_LEVEL, PET_DATA, PET_READ))	local PetExp = tonumber(data_tool(i, PET_EXP, PET_DATA, PET_READ))	local PetNextExp = PetArray[i][5][PetLevel]	while true do		say_title("Pet System:")		say("Benvenuto nel sistema di gestione del pet")		say("")		say_reward("cosa desideri fare?")		local s = select("Stato Pet", "Ciba Pet", "Abilita' Pet", "Altro", "Chiudi" )		if s == 4 then			say_title("Pet System:")			say("Benvenuto nel sistema di gestione del pet")			say("")			say_reward("cosa desideri fare?")			local z = select( "Cambia Nome", "Manda via", "Indietro", "Chiudi" )			if z == 1 then				say_title("Pet System:")				say("")				say("Assegna un nuovo nome al tuo cucciolo")				say("")				say_reward("Nome:")				local PetNewName = tostring(input())				if PetNewName == "" then					say_title("Pet System:")					say("")					say_reward("Non puoi lasciare l'input vuoto!")					return				end				if PetNewName == nome then					say_title("Pet System:")					say("")					say_reward("Non puoi usare lo stesso nome!")					return				end				data_tool(i, PetNewName.."n"..PetLevel.."n"..PetExp.."n", PET_DATA, PET_WRITE)				evoca(i, PET_UNSUMMON)				evoca(i, PET_SUMMON)				return			elseif z == 2 then				evoca(i, PET_UNSUMMON)				return			elseif z == 3 then			elseif z == 4 then				break			end		elseif s == 1 then			say_title("Pet System:")			say("")			say("Nome: "..PetName)			say("Razza: "..PetRace)			say("Livello: "..PetLevel)			say("Grado Istruzione: "..PetGrade)			say("Exp: "..PetExp.." / "..PetNextExp)			say("Salute: "..horse.get_health_pct().."%")			say("Resistenza: "..horse.get_stamina_pct().."%")			say("Cibo: "..item_name(PetFood))			return		elseif s == 2 then			if pc.countitem(PetFood) > 0 then				say_title("Pet System:")				say("")				say("Il tuo cucciolo e' felice")				say("per l'ottimo spuntino che ha fatto")				pc.removeitem(PetFood, 1)				horse.feed()				return			else				say_title("Pet System:")				say("")				say("Per cibare il tuo cucciolo")				say("hai bisogno di: "..item_name(PetFood))				say("")				return			end		elseif s == 3 then			if PetLevel >= 10 then				PetMenuAbi(i)				return			else				say_title("Pet System:")				say("")				say_reward("Il Pet deve essere almeno Lv 10")				return			end		elseif s == 5 then			break		end	endendfunction PetGiveExp(i, Point)	local PetName = data_tool(i, PET_NAME, PET_DATA, PET_READ)	local PetLevel = tonumber(data_tool(i, PET_LEVEL, PET_DATA, PET_READ))	local PetExp = tonumber(data_tool(i, PET_EXP, PET_DATA, PET_READ))	local PetNextExp = PetArray[i][5][PetLevel]	if PetLevel == 150 then		return	end	local PetNewExp = PetExp + Point	while true do		if PetNewExp < PetNextExp then break end		PetNewExp = PetNewExp - PetNextExp		PetLevel = PetLevel + 1	end	data_tool(i, PetName.."n"..PetLevel.."n"..PetNewExp.."n", PET_DATA, PET_WRITE)endfunction data_tool(i, linea, tipo, modo)	local DATA_PATH = "locale/germany/quest/pet/"	local LOCAL_PATH = pc.get_name().."/"	local x = 1	local file = ""	local PET_FILE = ""	local PET_BACKUP = ""	if tipo == PET_DATA then		PET_FILE = PetArray[i][2]..".txt"		PET_BACKUP = PetArray[i][2]..".bak"	elseif tipo == PET_BONUS then		PET_FILE = PetArray[i][2].."_bonus.txt"		PET_BACKUP = PetArray[i][2].."_bonus.bak"	end	if modo == PET_READ then		file = io.open(DATA_PATH..LOCAL_PATH..PET_FILE, "r")		while true do			local line = file:read("*l")			if line == nil then 				break 			end			text = string.gsub(line, "n", "")			if x == linea then 				io.close(file)				return text			end			x = x + 1		end		io.close(file)	elseif modo == PET_WRITE then		os.execute("cd "..DATA_PATH..LOCAL_PATH.." && mv "..PET_FILE.." "..PET_BACKUP)		file = io.open(DATA_PATH..LOCAL_PATH..PET_FILE, "w")		file:write(linea)		io.close(file)		os.execute("cd "..DATA_PATH..LOCAL_PATH.." && chmod 777 "..PET_FILE)	endend

Share this post


Link to post
Share on other sites
  • 0

tenho as funções todas, senao ia dar erro ao fazer qc as questsessa e a questlib ke eu uso, e a das files do rancoroso, eu executei o comando ke tenho na quest para criar a pasta na makina, e criou a pasta, mas pela quest a pasta n e criada, se eu criar manualmente funciona tudo corretamente, o único problema e n criar a pasta

Share this post


Link to post
Share on other sites
  • 0

tenho as funções todas, senao ia dar erro ao fazer qc as questsessa e a questlib ke eu uso, e a das files do rancoroso, eu executei o comando ke tenho na quest para criar a pasta na makina, e criou a pasta, mas pela quest a pasta n e criada, se eu criar manualmente funciona tudo corretamente, o único problema e n criar a pasta

Sim mas se tu repares o commando que cria a pasta esta aqui no quest lib

local DATA_PATH = "locale/germany/quest/pet/"

Exprimente meter este.... Afinal de contas, não perdes nada

Share this post


Link to post
Share on other sites
  • 0

Poderias era ter colocado algo mais útil como o syserr, não somos adivinhos lol

Share this post


Link to post
Share on other sites
  • 0

Poderias era ter colocado algo mais útil como o syserr, não somos adivinhos lol

 

desculpa a demora :S

 

syserr:

SYSERR: May  1 14:37:26 :: RunState: LUA_ERROR: locale/germany/quest/questlib_pets.lua:123: attempt to index local `file' (a nil value)SYSERR: May  1 14:37:26 :: WriteRunningStateToSyserr: LUA_ERROR: quest pet_system.start click

Share this post


Link to post
Share on other sites
  • 0

BUMP

Share this post


Link to post
Share on other sites
  • 0

BUMP

Share this post


Link to post
Share on other sites
  • 0

Continuamos sem poder adivinhar o erro.

SYSERR: May  1 14:37:26 :: RunState: LUA_ERROR: locale/germany/quest/questlib_pets.lua:123: attempt to index local `file' (a nil value)
Isto aponta para a linha 123 do questlib_pets.lua, já a podias ter colocado também que não era difícil entender isso.

Share this post


Link to post
Share on other sites
  • 0

E depois no local 'file' tem um valor nulo (zero)

Share this post


Link to post
Share on other sites
  • 0

linha 123 do questlib_pets.lua:

	file:write(PetName.."n1n0n") --nome livello exp

Share this post


Link to post
Share on other sites
  • 0
	local DATA_PATH = "locale/germany/quest/pet/"	local LOCAL_PATH = pc.get_name().."/"	local PET_FILE = PetArray[i][2]..".txt"	local PET_BONUS_FILE = PetArray[i][2].."_bonus.txt"	if pc.getqf("local_path") != 1 then		os.execute("cd "..DATA_PATH.." && mkdir "..LOCAL_PATH.." && chmod 777 "..LOCAL_PATH)		pc.setqf("local_path", 1)	end	local file = io.open(DATA_PATH..LOCAL_PATH..PET_FILE , "w")	file:write(PetName.."n1n0n") --nome livello exp	io.close(file)
Verifica que tenhas a variavel DATA_PATH com um diretório teu que exista, e que a tua personagem não tenha a quest flag local_path em 1.

Share this post


Link to post
Share on other sites
  • 0
local DATA_PATH = "locale/germany/quest/pet/"	local LOCAL_PATH = pc.get_name().."/"	local PET_FILE = PetArray[i][2]..".txt"	local PET_BONUS_FILE = PetArray[i][2].."_bonus.txt"	if pc.getqf("local_path") != 1 then		os.execute("cd "..DATA_PATH.." && mkdir "..LOCAL_PATH.." && chmod 777 "..LOCAL_PATH)		pc.setqf("local_path", 1)	end	local file = io.open(DATA_PATH..LOCAL_PATH..PET_FILE , "w")	file:write(PetName.."n1n0n") --nome livello exp	io.close(file)
Verifica que tenhas a variavel DATA_PATH com um diretório teu que exista, e que a tua personagem não tenha a quest flag local_path em 1.
eu na minha questlib tentei com esse directório e com o completo (/usr/home/game/share/locale/germany/quest/pet)o resto n entendi bem Srypodes usar palavreado menos caro pff

Share this post


Link to post
Share on other sites
  • 0

BUMP

Share this post


Link to post
Share on other sites
  • 0

BUMP

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this