Sign in to follow this  
Followers 0
Exygo

[FIX]uiQuest SetEvent bug for some people

2 posts in this topic

Story: Over time I learned that the SetEvent function can cause weird problems in Metin2, maybe you have this bug or maybe not, I actually encountered this problem and found the fix.

How to trigger the bug:

1. Use this quest for a test:

quest test begin
	state start begin
		when 9003.chat."quest test" begin
			say("Hey we are doing a test here")
			local o = select("option 1","option 2")
			if o == 1 then
				return
			elseif o == 2 then
				return
			end
		end
	end
end

2. Now you click on the NPC, choose "quest test" option and don't click on any option(1,2)

3. /transfer your_character with another GM account

4. The character who clicked on "quest test" option and didn't choose any of the sub-options (1 or 2 ) will now have an invisible stucked window on the center and can't click on the ground or click the area in the center of the screen(where the quest ui was before teleportation)

 

How to fix it:

1. Go to uiQuest.py

2. In def MakeQuestion find the SetEvent functions and edit them as below:

	def MakeQuestion(self, n):
		global entire_questbutton_number
		global entire_questpage_number
		global cur_questpage_number
		entire_questpage_number = ((n-2)/7)+1
		entire_questbutton_number = n
		
		if not self.board:
			return

		self.btnAnswer = [self.MakeEachButton(i) for i in xrange (n)]
			
		import localeInfo
		self.prevbutton = self.MakeNextPrevPageButton()
		self.prevbutton.SetPosition(self.sx+self.board.GetWidth()/2-164, self.board.GetHeight()/2-16)
		self.prevbutton.SetText(localeInfo.UI_PREVPAGE)
		#self.prevbutton.SetEvent(self.PrevQuestPageEvent, 1, n) # buggy
		self.prevbutton.SAFE_SetEvent(self.PrevQuestPageEvent, 1, n) # unbuggy

		self.nextbutton = self.MakeNextPrevPageButton()
		self.nextbutton.SetPosition(self.sx+self.board.GetWidth()/2+112, self.board.GetHeight()/2-16)
		self.nextbutton.SetText(localeInfo.UI_NEXTPAGE)
		#self.nextbutton.SetEvent(self.NextQuestPageEvent, 1, n) # buggy
		self.nextbutton.SAFE_SetEvent(self.NextQuestPageEvent, 1, n) # unbuggy

		if cur_questpage_number != 1:
			cur_questpage_number = 1

Note: After that you should check for other SetEvent functions (comment them and see if the bug still happens)

Info: The bug has something to do with the function arguments

Other locations where this bug caused problems:

  • intrologin.py - can cause the arrow keys,enter,esc to not work in the select character phase

 

4 people like this

Share this post


Link to post
Share on other sites

Why no one say thanks?
Thanks exygo for the relase, keep it up

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.