Jump to content

Skills Cooldown ToolTIP


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hi devs,

I'd like to share a script I developed the other night whilst working on a project, this script is meant to improve the quality of life of Metin2 as often players find it hard to accurately tell the cooldown of skills and end up spamming their keyboards like many of us have.

Preview:
0c51f0568e9284d618e245d2f28ac57d.png

Without any further ado, let's dig right into coding this bad boy.

We start with locale:

Spoiler

First you will have to unpack your locale and look for taskbar.py in your ui folder and look for the following:



	"name" : "quick_slot_1",
	...
	"children" :

And replace the content of "children" : ( ... ), with this:



{
	"name" : "slot_1",
	"type" : "image",
	"x" : 3,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/1.sub",
	"children" :
	(
		{ 
			"name" : "slot_1_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},
{
	"name" : "slot_2",
	"type" : "image",
	"x" : 35,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/2.sub",
	"children" :
	(
		{ 
			"name" : "slot_2_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},
{
	"name" : "slot_3",
	"type" : "image",
	"x" : 67,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/3.sub",
	"children" :
	(
		{ 
			"name" : "slot_3_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},{
	"name" : "slot_4",
	"type" : "image",
	"x" : 99,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/4.sub",
	"children" :
	(
		{ 
			"name" : "slot_4_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},

Then look for:



	"name" : "quick_slot_1",
	...
	"children" :

And replace the content of its "children" : ( ... ), with the following:



{
	"name" : "slot_f1",
	"type" : "image",
	"x" : 3,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/f1.sub",
	"children" :
	(
		{ 
			"name" : "slot_f1_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},
{
	"name" : "slot_f2",
	"type" : "image",
	"x" : 35,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/f2.sub",
	"children" :
	(
		{ 
			"name" : "slot_f2_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},
{
	"name" : "slot_f3",
	"type" : "image",
	"x" : 67,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/f3.sub",
	"children" :
	(
		{ 
			"name" : "slot_f3_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},{
	"name" : "slot_f4",
	"type" : "image",
	"x" : 99,
	"y" : 3,
	"image" : "d:/ymir work/ui/game/taskbar/f4.sub",
	"children" :
	(
		{ 
			"name" : "slot_f4_cd",
			"type" : "text",
			"x" : 0,
			"y" : 0,
			"horizontal_align" : "center",
			"vertical_align" : "center",
			"text" : "10",
			"fontname" : "Tahoma Bold:16",
			"r" : 1, "g" : 1, "b" : 0, "a" : 0,
		},
	),
},

Now save your work in taskbar.py and pack your files.

 

Now we shall move onto root part:

version 1.0

Spoiler

 

Next we'll move onto root so I need you to unpack your root files and look for uitaskbar.py
Now I need you to look for the following line: self.quickslot = [] as you can see below:



self.quickslot = []
self.quickslot.append(self.GetChild("quick_slot_1"))
self.quickslot.append(self.GetChild("quick_slot_2"))

And then enter the following block of code above it:



self.cooldownText = []
self.cooldownText.append(self.GetChild("slot_1_cd"))
self.cooldownText.append(self.GetChild("slot_2_cd"))
self.cooldownText.append(self.GetChild("slot_3_cd"))
self.cooldownText.append(self.GetChild("slot_4_cd"))
self.cooldownText.append(self.GetChild("slot_f1_cd"))
self.cooldownText.append(self.GetChild("slot_f2_cd"))
self.cooldownText.append(self.GetChild("slot_f3_cd"))
self.cooldownText.append(self.GetChild("slot_f4_cd"))
for i in xrange(8):
	self.cooldownText[i-1].Hide()

Note: Please pay attention to code indentation

Afterwards you will need to search for:



if player.IsSkillCoolTime(Position):

and under it add the following:



(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
cooldownDelay = 0
cooldown = coolTime-elapsedTime+cooldownDelay
self.cooldownText[slotNumber].Show()
self.cooldownText[slotNumber].SetText("%d" % cooldown)
self.cooldownText[slotNumber].SetOutline()
if cooldown < 10:
	self.cooldownText[slotNumber].SetPosition(7,0)
elif cooldown > 9 and cooldown < 100:
	self.cooldownText[slotNumber].SetPosition(2,0)
elif cooldown > 99:
	self.cooldownText[slotNumber].SetPosition(-1,0)

Note: Please pay attention to code indentation

Now make a new line under the whole code block of:



if player.IsSkillCoolTime(Position):

and add the following code:



elif not player.IsSkillCoolTime(Position):
	self.cooldownText[slotNumber].Hide()


Awesome! You should be good to go, now pack your root and head in for some testing!

 

version 2.0

Spoiler

Next we'll move onto root so I need you to unpack your root files and look for uitaskbar.py
Now I need you to look for the following line: self.quickslot = [] as you can see below:



self.quickslot = []
self.quickslot.append(self.GetChild("quick_slot_1"))
self.quickslot.append(self.GetChild("quick_slot_2"))

And then enter the following block of code above it:



self.cooldownText = []
self.cooldownText.append(self.GetChild("slot_1_cd"))
self.cooldownText.append(self.GetChild("slot_2_cd"))
self.cooldownText.append(self.GetChild("slot_3_cd"))
self.cooldownText.append(self.GetChild("slot_4_cd"))
self.cooldownText.append(self.GetChild("slot_f1_cd"))
self.cooldownText.append(self.GetChild("slot_f2_cd"))
self.cooldownText.append(self.GetChild("slot_f3_cd"))
self.cooldownText.append(self.GetChild("slot_f4_cd"))
for i in xrange(8):
	self.cooldownText[i-1].Hide()

Note: Please pay attention to code indentation

Afterwards you will need to search for:



def OnUpdate(self):

And add the following block under self.tooltipEXP.Hide()
 



startNumber = 0
for slot in self.quickslot:
	for i in xrange(4):
		slotNumber = i+startNumber
		self.cooldownText[slotNumber].Hide()
		(Type, Position) = player.GetLocalQuickSlot(slotNumber)
				
		if player.IsSkillCoolTime(Position):
		(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
		slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
					
		cooldownDelay = 0
		cooldown = int(coolTime-elapsedTime+cooldownDelay)
		if app.IsPressed(app.DIK_LALT):
			self.cooldownText[slotNumber].Hide()
		else:
			self.cooldownText[slotNumber].SetOutline()
			self.cooldownText[slotNumber].SetText("%d" % cooldown)
			cooldown = str(cooldown)
			self.cooldownText[slotNumber].SetPosition((7, 2, -1)[len(cooldown)-1], 0)
			self.cooldownText[slotNumber].Show()
					
	startNumber += 4

Note 1: Please pay attention to code indentation
Note 2: Also if you have implemented this feature from version 1.0 then you will have to reverse engineer it and apply this version as it's more reliable.

Now get your root files packed and give this bad boy a spin! :lol:

If you encounter any bugs or you have suggestions please let me know! :D 

Changes: 

Spoiler

— version 2.0
> Removed the whole script from function def RefreshQuickSlot(self): and added the updated block under def OnUpdate(self): as it's more reliable and fixes one of the bugs where the cooldown gets stuck.
> Hid the cooldown text before it's processed by the if player.IsSkillCoolTime(Position): condition as opposed to previous version, for a cleaner code.
> Added a new condition which will hide the cooldown text whilst holding down Left ALT. However because the cooldown is set per slot and the pages are overlapping, it also hides the cooldown from the 2nd skill page, but that is just a tiny detail which can be ignored until further improvements.

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 15
  • Sad 1
  • Scream 1
  • Good 4
  • Love 1
  • Love 24
for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

On 7/31/2018 at 2:32 AM, Werwolf94 said:

That's a nice idea!

But I think I found a bug (or I messed up something when I pasted your code to my files).
When you go to another map the counters are freezing after you use a skill.

Hi there Werwolf, I have tested the potential bug you mentioned and I failed to encounter it.
The only aspect of the script which I'm still working on is the possibility to hide the cooldown whilst holding down Alt.
It's not a bug, just a simple adjustment I'd like to add in the future to assure 100% functionability.

Thank you all for the warm feedback, it gladdens me knowing my scripts are useful. :D 

Keep me posted if potential bugs arise.

Cheers!

  • Love 1
for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

4 hours ago, [Dev]Medo said:

same bug here ...

 

 

 

 

Hi there Medo, could you record a video with the bug so I can get a better grasp of the issue and post it here?

Thank you!

for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

Works very well, thanks! :D

On 8/2/2018 at 6:03 AM, Dean said:

Hi there Werwolf, I have tested the potential bug you mentioned and I failed to encounter it.
The only aspect of the script which I'm still working on is the possibility to hide the cooldown whilst holding down Alt.
It's not a bug, just a simple adjustment I'd like to add in the future to assure 100% functionability.

Thank you all for the warm feedback, it gladdens me knowing my scripts are useful. :D 

Keep me posted if potential bugs arise.

Cheers!

And I solve your problem! :D

First of all we don't need this:

					elif not player.IsSkillCoolTime(Position):
						self.cooldownText[slotNumber].Hide()

Then search for this:

slotNumber = i+startNumber

And paste under this:

self.cooldownText[slotNumber].Hide()

That's all.

  • Love 1
Link to comment
Share on other sites

Hello,

 

I have a similiar error like Werwolf94.

For me the timers are stuck at 10.

 

This is my syserr:

 

0809 00:26:48145 :: Traceback (most recent call last):

0809 00:26:48145 ::   File "uiTaskBar.py", line 1007, in OnUpdate

0809 00:26:48145 ::   File "uiTaskBar.py", line 823, in RefreshQuickSlot

0809 00:26:48146 :: AttributeError
0809 00:26:48146 :: : 
0809 00:26:48146 :: 'TextLine' object has no attribute 'setText'
0809 00:26:48146 :: 

 

Link to comment
Share on other sites

  • Bronze
En 5/8/2018 a las 23:15, Werwolf94 dijo:

Hi again!

I updated the two Py file and the "bug" still appears in my client when I go to another map.
In the video you can see when I go to an another map after that the cooldown text's are freezing.
If I press Alt the counters are keep going down.

 

Delete the uiTaskbar.py part from the guide.

Find this in def __OnUpdate(self):

		if True == self.expGaugeBoard.IsIn():
			self.tooltipEXP.Show()
		else:
			self.tooltipEXP.Hide()

Add this under:

		startNumber = 0
		for slot in self.quickslot:
			for i in xrange(4):
				slotNumber = i+startNumber
				(Type, Position) = player.GetLocalQuickSlot(slotNumber)
				if player.IsSkillCoolTime(Position):
					(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
					slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

					cooldownDelay = 0
					cooldown = int(coolTime-elapsedTime+cooldownDelay)
					self.cooldownText[slotNumber].SetOutline()
					self.cooldownText[slotNumber].SetText("%d" % cooldown)
					cooldown = str(cooldown)
					self.cooldownText[slotNumber].SetPosition((7, 2, -1)[len(cooldown) - 1],0)
					self.cooldownText[slotNumber].Show()
				else:
					self.cooldownText[slotNumber].Hide()
			startNumber += 4

 

  • Love 2
Link to comment
Share on other sites

  • 2 weeks later...

Hello everyone. Thank you all for the warm feedback, it's been a pleasure reading all your replies.
Now, I brought some changes to this feature to further improve it.

Also I'd like to thank Shang and Aerrow for pointing out ways of improving the script.

  • Love 3
for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

  • 2 months later...

Hello guys, first sorry for my bad english.

Thank you for share, i have just one reservation.
Its a centering of string.
Your centering is not good because if i have lenght > 1, i have the result more left. 
Here is my proposal to improvement


 

		startNumber = 0
		for slot in self.quickslot:
			for i in xrange(4):
				slotNumber = i+startNumber
				(Type, Position) = player.GetLocalQuickSlot(slotNumber)
				if player.IsSkillCoolTime(Position):
					(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
					slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

					cooldownDelay = 0
					cooldown = int(coolTime-elapsedTime+cooldownDelay)
					self.cooldownText[slotNumber].SetOutline()
					self.cooldownText[slotNumber].SetText("%d" % cooldown)
					cooldown = str(cooldown)
					if len(cooldown) <= 1:
						self.cooldownText[slotNumber].SetPosition(8,0)
					else:
						self.cooldownText[slotNumber].SetPosition(8 - (len(cooldown) + 2), 0)
					self.cooldownText[slotNumber].Show()
				else:
					self.cooldownText[slotNumber].Hide()
			startNumber += 4


                    if len(cooldown) <= 1:
                        self.cooldownText[slotNumber].SetPosition(8,0)
                    else:
                        self.cooldownText[slotNumber].SetPosition(8 - (len(cooldown) + 2),0)
                    self.cooldownText[slotNumber].Show()

 

 

EDIT:
This is good if i have bold:16. If you use more bold, u must change SetPosition(8 - (len(cooldown) + 2), 0)

to SetPosition(8 - (len(cooldown) + x), 0).
If your bold is highest, x is highest too. How much? You must try.

  • Love 1
Link to comment
Share on other sites

  • 1 month later...

 

On 11/3/2018 at 11:10 PM, Co0L said:

@Dean ???

 

On 11/4/2018 at 5:25 AM, Blend said:

I have the same problem ?

Hello to both,

Sorry for late response.
As for the problem at hand I've failed to replicate your issue on my side, unless you have set an actual cooldown to those potions you should not encounter that. So you might want to check that first and see if you find a way to fix it.

TDLR: The piece of code I shared way way above it takes the active cooldown of a skill, if existent, and displays the actual timer which already runs in the background. The main reason of this release was to improve player's reaction have while using their skills as it gives you a better understanding when the skill will be available for next cast.

for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

  • 1 year later...
On 10/28/2018 at 6:43 PM, Co0L said:

For those who have the same problem. Instead of this:

		startNumber = 0
		for slot in self.quickslot:
			for i in xrange(4):
				slotNumber = i+startNumber
				(Type, Position) = player.GetLocalQuickSlot(slotNumber)
				if player.IsSkillCoolTime(Position):
					(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
					slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

					cooldownDelay = 0
					cooldown = int(coolTime-elapsedTime+cooldownDelay)
					self.cooldownText[slotNumber].SetOutline()
					self.cooldownText[slotNumber].SetText("%d" % cooldown)
					cooldown = str(cooldown)
					self.cooldownText[slotNumber].SetPosition((7, 2, -1)[len(cooldown) - 1],0)
					self.cooldownText[slotNumber].Show()
				else:
					self.cooldownText[slotNumber].Hide()
			startNumber += 4

Use this:
 

		startNumber = 0
		for slot in self.quickslot:
			for i in xrange(4):
				slotNumber = i+startNumber
				(Type, Position) = player.GetLocalQuickSlot(slotNumber)
				if player.IsSkillCoolTime(Position) and player.SLOT_TYPE_SKILL == Type:
					(coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
					slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)

					cooldownDelay = 0
					cooldown = int(coolTime-elapsedTime+cooldownDelay)
					self.cooldownText[slotNumber].SetOutline()
					self.cooldownText[slotNumber].SetText("%d" % cooldown)
					cooldown = str(cooldown)
					self.cooldownText[slotNumber].SetPosition((7, 2, -1)[len(cooldown) - 1],0)
					self.cooldownText[slotNumber].Show()
				else:
					self.cooldownText[slotNumber].Hide()
			startNumber += 4

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • Premium

my clien is instantly close when i log in. ?

 

my syserr.txt

0624 00:23:07457 :: 
networkModule.py(line:208) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:30) <module>
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:10) <module>
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - <type 'exceptions.IndentationError'>:unexpected indent (uiTaskBar.py, line 437)

0624 00:23:07457 :: ============================================================================================================
0624 00:23:07457 :: Abort!!!!

 

Ulthar

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

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.