Jump to content
×
×
  • Create New...
  • 0

Problem with biologist,


Dimmi

Question

Hi guys,

I got stuck. I made a quest by myself and got this when I try to compile:

[email protected]:/usr/game/share/locale/romania/quest # ./qc biologist.lua
QUEST : biologist
STATE : start
FUNCTION first_mission()
FUNCTION set_mission(mission)
FUNCTION set_cooldown()
FUNCTION remove_cooldown()
FUNCTION set_item(vnum,count)
FUNCTION get_mission()
FUNCTION get_cooldown()
FUNCTION get_count()
FUNCTION get_mission_info(MissionID)
FUNCTION get_mission_id(MissionLevel)
FUNCTION Tasks(playerLevel,playerMissionID,playerCooldown,playerItemsBrought,mission_info)
WHEN  : 20084.take
Abort (core dumped)

My quest is:

quest biologist begin
	state start begin
		function first_mission()
			mysql.query(string.format("INSERT INTO quest.biologistchaegirab (playerid, mission, time, item, count) VALUES ('%d', '%d', '%d', '%d', '%d')", pc.get_player_id(), 0, get_time(), 30305, 10))
		end

		function set_mission(mission)
			mysql.query(string.format("UPDATE quest.biologistchaegirab SET mission = '%d' WHERE playerid = '%d'", mission, pc.get_player_id()))
		end

		function set_cooldown()
			mysql.query(string.format("UPDATE quest.biologistchaegirab SET time = '%d' WHERE playerid = '%d'", get_time() + settings.biologist_time * 60, pc.get_player_id()))
		end
		
		function remove_cooldown()
			syschat("Timpul a fost eliminat.")
			mysql.query(string.format("UPDATE quest.biologistchaegirab SET time = '%d' WHERE playerid = '%d'", get_time() * 1 + 1, pc.get_player_id()))
			pc.removeitem(71035, 1)
		end

		function set_item(vnum, count)
			mysql.query(string.format("UPDATE quest.biologistchaegirab SET item = '%d', count = '%d' WHERE playerid = '%d'", vnum, count, pc.get_player_id()))
		end
		
		function get_mission()
			local mission = mysql.query(string.format("SELECT mission FROM quest.biologistchaegirab WHERE playerid = '%d' LIMIT 1", pc.get_player_id()))
			return mission[1][1]
		end
		
		function get_cooldown()
			local time = mysql.query(string.format("SELECT time FROM quest.biologistchaegirab WHERE playerid = '%d' LIMIT 1", pc.get_player_id()))
			return time[1][1]
		end

		function get_count()
			local count = mysql.query(string.format("SELECT count FROM quest.biologistchaegirab WHERE playerid = '%d' LIMIT 1", pc.get_player_id()))
			return count[1][1]
		end
		
		function get_mission_info(MissionID)
			mission_info_map = {
				-- ID = Level, Nume, VnumItem, Cantitate, Recompensa, BonusID1, BonusVAL1, BonusID2, BonusVAL2, RecompensaItem, RecompensaCantitate 
				[1] = {30, "Dinþii de orc", 30305, 10, "+10% viteza de miºcare (permanentã)[ENTER]Cutie roºie de ebonitã ", 8, 10, 0, 0, 50109, 1 },
				[2] = {40, "Cãrþile blestemelor", 30306, 15, "+5% viteza de atac (permanentã)[ENTER]Cutie de abanos maro", 7, 5, 0, 0, 50110, 1 },
				[3] = {50, "Suvenirele Demonului", 30307, 15, "+60 apãrare (permanentã)[ENTER]Cutie de abanos galbenã ", 54, 60, 0, 0 , 50111, 1 },
				[4] = {60, "Globuri de gheaþã", 30308, 20, "+50 atac (permanent)[ENTER]Cutie de abanos verde-deschis", 53, 50, 0, 0, 50112, 1 },
				[5] = {70, "Crengile Zelkova", 30165, 25, "+10% viteza de miºcare (permanentã)[ENTER]+5% puternic împotriva monºtrilor (permanent)[ENTER]Cutie de abanos verde", 8, 10, 63, 5, 50113, 1 },
				[6] = {80, "Tãbliþele Tugyis", 30166, 30, "+10 forþã (permanent)[ENTER]+10% viteza de atac (permanentã)[ENTER]Cutie de abanos albastrã ", 5, 10, 7, 10, 50114, 1 },
				[7] = {85, "Rãmurelele roºii", 30167, 40, "+10% reducerea pagubelor încasate de la[ENTER]ceilalþi jucãtori[ENTER]Cutie de abanos purpurie", 73, 10, 0, 0, 50115, 1 },
				[8] = {90, "Însemnele Liderilor", 30168, 50, "+10% puternic împotriva semi-oamenilor[ENTER]Cutie de abanos albastrã ", 17, 10, 0, 0, 50114, 1 }
			}
			MissionID = tonumber(MissionID)
			return mission_info_map[MissionID]
		end
		
		function get_mission_id(MissionLevel)
			mission_level_map = {
				[30] = 1,
				[40] = 2,
				[50] = 3,
				[60] = 4,
				[70] = 5,
				[80] = 6,
				[85] = 8,
				[90] = 9
			}
			MissionLevel = tonumber(MissionLevel)
			return mission_level_map[MissionLevel]
		end
		
		function Tasks(playerLevel, playerMissionID, playerCooldown, playerItemsBrought, mission_info)
	
			local Bonus1 = mission_info[6]
			local BonusValue1 = mission_info[7]
			local Bonus2 = mission_info[8]
			local BonusValue2 = mission_info[9]
			local ItemBonus = mission_info[10]
			local ItemBonusCount = mission_info[11]
		
			if get_time() < playerCooldown then
				say_title(mob_name(20084))
				say("")
				say("Momentan nu am terminat de studiat obiectul ")
				say("care mi le-ai adus. Revin-o mai târziu. ")
				say("Poþi aduce un obiect odatã la 10 minute. ")
				say("")
				return
			end
			if playerLevel < mission_info[1] then
				say_title(mob_name(20084))
				say("")
				say("Îmi pare rãu, dar trebuie sã ai nivelul " .. mission_info[1])
				say("pentru aceastã misiune! Revin-o când atingi ")
				say("nivelul necesar. ")
				say("")
				return
			end			
			
			say_title(mob_name(20084))
			say("")
			say("Pentru a finaliza aceastã misiune este nevoie de ")
			local ItemRemaining = mission_info[4] - playerItemsBrought
			say(""..item_name(mission_info[3])..", "..ItemRemaining.." de bucãþi.")
			say("")
			say("Recompensa pentru aceastã misiune este:")
			say_reward(mission_info[5])
			say("")
			if select("Am adus "..item_name(mission_info[3]).."", "Înapoi") == 1 then
				if pc.count_item(mission_info[3]) == 0 then
					say_title(mob_name(20084))
					say("")
					say("Nu ai obiectele necesare.")
					say("Pentru aceastã misiune este nevoie de " .. item_name(mission_info[3]))
					say("")
					return
				end
				local Sansa = { 
					[30] = 2, -- 50%
					[40] = 2, -- 50%
					[50] = 2, -- 50% 
					[60] = 3, -- 33%
					[70] = 3, -- 33% 
					[80] = 3, -- 33% 
					[85] = 4, -- 25% 
					[90] = 4  -- 25% 
				}
				local Prob = number(1, Sansa[mission_info[1]])
				if Prob ~= 1 then
					say_title(mob_name(20084))
					say("")
					say("Îmi pare rãu, dar acest exemplar nu este bun!")
					say("Revin-o cu un exemplar nou.")
					say("")
					pc.remove_item(mission_info[3], 1)
					return
				end			
				playerItemsBrought = playerItemsBrought + 1
				biologist.set_item(mission_info[3], playerItemsBrought)				
				if playerItemsBrought == mission_info[4] then
					pc.remove_item(mission_info[3], 1)
					say_title(mob_name(20084))
					say("")
					say("În sfârºit! Am terminat de studiat aceste obiecte.")
					say("Mulþumesc pentru ajutor. Recompensa ta este")
					say("")
					say_reward(mission_info[5])
					say("")
					affect.add_collect(mission_info[6], mission_info[7], 60*60*24*365*60)
					pc.give_item2 (mission_info[10], mission_info[11])
					if mission_info[8] != 0 then
						affect.add_collect(mission_info[8], mission_info[9], 60*60*24*365*60)
					end
					-- Noua misiune					
					local NextMissionID = playerMissionID + 1
					local NextMission = biologist.get_mission_info(NextMissionID)
					biologist.set_mission(NextMission[1])
					-- Noul item de colectat
					local ItemChallange = NextMission[3]
					biologist.set_item(ItemChallange, 0)
				else
					say_title(mob_name(20084))
					say("")
					say("Excelent! Acest exemplar este de calitate.")
					ItemRemaining = mission_info[4] - playerItemsBrought
					say("Mai trebuie sã aduci doar "..ItemRemaining.." de exemplare.")
					say("")
					biologist.set_cooldown()
					pc.remove_item(mission_info[3], 1)
				end
			end
		end
		
		when 20084.take with pc.get_level() >= 30	
			local mission_info = biologist.get_mission_info(biologist.get_mission_id())
			biologist.Tasks(pc.get_level(), biologist.get_mission_id(), biologist.get_cooldown(), biologist.get_count(), mission_info)
		end
	end
end

Any help please?

Thanks!

Link to comment
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

1 answer to this question

Recommended Posts

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


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.