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

Quest error


pollux

Question

  • Honorable Member

error message:

pollux/color_hair.lua:12:expecting 'when' or 'function'
Error occured on compile pollux/color_hair.lua

 

quest:

----------------------------------------------------
-- created @ 2016-10-22 7:58 PM
-- by .PolluX
-- for Electryced2
----------------------------------------------------
quest color_hair begin
	state start begin

		-------------------------
		-- SETTINGS
		-------------------------
		local items = {
			         0, -- dummy item
			70202, -- white
			70203, -- blonde
			70204, -- red
			70205, -- brown	
			70206, -- black
			70201, -- reset
		}
		
		function translate()
			local translate = {
				title = "Hair-Styling",
				
				dialog_start = "[ENTER][ENTER]Herzlichen Glückwunsch![ENTER]Sie wurden ausgewählt eine neue Methode der Haarfärbung[ENTER]zu testen. Bitte wählen Sie die gewünschte Farbe aus![ENTER]",
				dialog_choose = "[ENTER][ENTER]Bist du dir sicher, dass du dieses[ENTER]Färbemittel erhalten möchtest?[ENTER]",
				
				select_title = "Soll es wirklich diese Farbe sein?",
				select_1 = "Her damit!",
				select_2 = "Ne, doch lieber etwas anderes.",
				
				success = "Du hast das Haarfärbemittel in der gewünschten Farbe erhalten.",
			}
			
			return translate
		end
		
		function generateOutput(value)
			say_title(color_hair.translate().select_title)
			say_item(item_name(value),value,"")
			local s = select(color_hair.translate().select_1, color_hair.translate().select_2)
			if(s == 1) then
				chat(color_hair.translate().success)
				pc.give_item2(value, 1)
			end
		end
		
		-------------------------
		-- QUEST START
		-------------------------
		when 38001.use begin
			say_title(color_hair.translate().title)
			color_hair.translate().dialog_start
			
			local f = select ("Weißes Färbemittel", -- 1
										"Blondes Färbemittel", -- 2
										"Rotes Färbemittel", -- 3
										"Braunes Färbemittel", -- 4
										"Schwarzes Färbemittel", -- 5
										"Bleichmittel") -- 6
			
			color_hair.generateOutput(color_hair.items[f])
			
		end
	end
end

 

Where did i fail? Tell me pls :D

Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0
  • Nitro Booster

The local var items is outside a when/function, never seen such a thing like that, but since you can modify the quest compiler, who knows if that actually works.

when you return 0 and server doesn't boot:

unknown.png

Link to comment
  • 0
  • Honorable Member

It should because i have other quests in which this actually is working.

 

But i changed the following things:

- moved the items array behind the 'when'

- changed line 64 (color_hair.items[f] -> items[f]

- added pc.remove_item(10049, 1) on line 36

- added a say to line 55

 

Quest:

 

----------------------------------------------------
-- created @ 2016-10-22 7:58 PM
-- by .PolluX
-- for Electryced2
----------------------------------------------------
quest color_hair begin
	state start begin

		-------------------------
		-- SETTINGS
		-------------------------		
		function translate()
			local translate = {
				title = "Hair-Styling",
				
				dialog_start = "Herzlichen Glückwunsch![ENTER]Sie wurden ausgewählt eine neue Methode der [ENTER]Haarfärbung zu testen. Bitte wählen Sie [ENTER]die gewünschte Farbe aus![ENTER]",
				dialog_choose = "[ENTER][ENTER]Bist du dir sicher, dass du dieses[ENTER]Färbemittel erhalten möchtest?[ENTER]",
				
				select_title = "Soll es wirklich diese Farbe sein?",
				select_1 = "Her damit!",
				select_2 = "Ne, doch lieber etwas anderes.",
				
				success = "Du hast das Haarfärbemittel in der gewünschten Farbe erhalten.",
			}
			
			return translate
		end
		
		function generateOutput(value)
			say_title(color_hair.translate().select_title)
			say_item(item_name(value),value,"")
			local s = select(color_hair.translate().select_1, color_hair.translate().select_2)
			if(s == 1) then
				chat(color_hair.translate().success)
				pc.give_item2(value, 1)
				pc.remove_item(10049, 1)
			end
		end
		
		-------------------------
		-- QUEST START
		-------------------------
		when 10049.use begin
		
			local items = {
				70202, -- white
				70203, -- blonde
				70204, -- red
				70205, -- brown	
				70206, -- black
				70201, -- reset
			}
		
			say_title(color_hair.translate().title)
			say(color_hair.translate().dialog_start)
			
			local f = select ("Weißes Färbemittel", -- 1
										"Blondes Färbemittel", -- 2
										"Rotes Färbemittel", -- 3
										"Braunes Färbemittel", -- 4
										"Schwarzes Färbemittel", -- 5
										"Bleichmittel") -- 6
			
			color_hair.generateOutput(items[f])
			
		end
	end
end

 

 

Now it's working :)

Link to comment

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

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


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.