Jump to content
metin2dev
DasSchwarzeT

[SMALL PYTHON RELEASE] Mob's health in %

Recommended Posts

Hey,

according to this topic:

I'd like to release the following modification for monsters targetboards:

17FEh.png

How to add:

open uiTarget.py

search for

def __init__(self):

and add under

		hpGauge = ui.Gauge()
		hpGauge.SetParent(self)
		hpGauge.MakeGauge(130, "red")
		hpGauge.Hide()
		hpPercenttxt = ui.TextLine()
		hpPercenttxt.SetParent(self)
		hpPercenttxt.SetPosition(160, 13)
		hpPercenttxt.SetText("")
		hpPercenttxt.Hide()

Search for 

		self.name = name
		self.hpGauge = hpGauge

and add under this

		self.hpPercenttxt = hpPercenttxt

Search

def Destroy(self):

add it under

self.hpPercenttxt = None

 

Search

def ResetTargetBoard(self):

Find

self.hpGauge.Hide()

add it under

self.hpPercenttxt.Hide()

Now search for

def SetHP(self, hpPercentage):

and add under

			self.UpdatePosition()
			self.hpPercenttxt.SetPosition(200 + 7*self.nameLength-205, 13)
			self.hpPercenttxt.Show()

and under 

		self.hpGauge.SetPercentage(hpPercentage, 100)
		self.hpPercenttxt.SetText("%d%%" % (hpPercentage))

Now you're done and it should look like:

lipBb.png

 

Have fun

Edited by DasSchwarzeT
  • Like 9

Share this post


Link to post
Share on other sites

0705 18:46:27105 ::   File "game.py", line 1088, in SetHPTargetBoard

0705 18:46:27105 ::   File "uiTarget.py", line 338, in SetHP

0705 18:46:27105 :: AttributeError
0705 18:46:27105 :: : 
0705 18:46:27105 :: 'TargetBoard' object has no attribute 'hpPercenttxt'
0705 18:46:27105 :: 

Share this post


Link to post
Share on other sites

0705 18:46:27105 ::   File "game.py", line 1088, in SetHPTargetBoard

0705 18:46:27105 ::   File "uiTarget.py", line 338, in SetHP

0705 18:46:27105 :: AttributeError
0705 18:46:27105 :: : 
0705 18:46:27105 :: 'TargetBoard' object has no attribute 'hpPercenttxt'
0705 18:46:27105 :: 

Under

self.name = name

add this

self.hpPercenttxt = hpPercenttxt

 

  • Like 1

Share this post


Link to post
Share on other sites

0705 20:58:26508 :: Traceback (most recent call last):

0705 20:58:26508 ::   File "networkModule.py", line 247, in SetGamePhase

0705 20:58:26508 ::   File "game.py", line 126, in __init__

0705 20:58:26508 ::   File "uiTarget.py", line 156, in __init__

0705 20:58:26509 :: NameError
0705 20:58:26509 :: : 
0705 20:58:26509 :: global name 'hpPercenttxt' is not defined
0705 20:58:26509 :: 

Share this post


Link to post
Share on other sites

It works, but buggy.

Select a mob, then select a player, and the percent appers too. But the value is not true, and the position in under the player's name.

Edited by TheSLZ

Share this post


Link to post
Share on other sites

I think it will be lot lot lot usefull add the amount of HP the monster\metin stone has.... instead of the Percentage

can someone make a tutorial on how to add HP with value?

Share this post


Link to post
Share on other sites

It works, but buggy.

Select a mob, then select a player, and the percent appers too. But the value is not true, and the position in under the player's name.

Well if you have a gauge on PvP players you have to check if the opponent is a pvp instance:

like this

			self.hpPercenttxt.SetPosition(200 + 7*self.nameLength-205, 13)
			self.hpPercenttxt.Show()
			if player.IsPVPInstance(self.vid):
				self.hpPercenttxt.Hide()

 

Share this post


Link to post
Share on other sites

I tried, problem still there.

Not only in pvp, see:

My uitarget.py: http://pastebin.com/mcjucf92

 

Search

def Destroy(self):

add it under

self.hpPercenttxt = None

 

Search

def ResetTargetBoard(self):

Find

self.hpGauge.Hide()

add it under

self.hpPercenttxt.Hide()

 

Edited by Koray
  • Like 2

Share this post


Link to post
Share on other sites

I tried, problem still there.

Not only in pvp, see:

My uitarget.py: http://pastebin.com/mcjucf92

 

Search

def Destroy(self):

add it under

self.hpPercenttxt = None

 

Search

def ResetTargetBoard(self):

Find

self.hpGauge.Hide()

add it under

self.hpPercenttxt.Hide()

 

I am sorry, I just forgot to write it in this topic. I did it in my code but forgot to edit it here.

  • Like 1

Share this post


Link to post
Share on other sites

Hey guys :) Great tut but:

Spoiler

1204 07:22:27048 :: Traceback (most recent call last):

1204 07:22:27049 ::   File "networkModule.py", line 253, in SetGamePhase

1204 07:22:27049 ::   File "game.py", line 112, in __init__

1204 07:22:27049 ::   File "uiTarget.py", line 47, in __init__

1204 07:22:27049 ::   File "ui.py", line 128, in SetParent

1204 07:22:27049 :: AttributeError
1204 07:22:27049 :: : 
1204 07:22:27049 :: 'TargetBoard' object has no attribute 'hWnd'
1204 07:22:27049 :: 

1204 07:23:59110 :: Exception 
1204 07:23:59110 :: exceptions.AttributeError
1204 07:23:59110 :: : 
1204 07:23:59110 :: "'TargetBoard' object has no attribute 'hWnd'"
1204 07:23:59110 ::  in 
1204 07:23:59110 :: <bound method TargetBoard.__del__ of <uiTarget.TargetBoard object at 0x0F24BE10>>
1204 07:23:59110 ::  ignored

 

Share this post


Link to post
Share on other sites
On 05.07.2015 at 7:03 PM, DasSchwarzeT said:

Hey,

Bu konuya göre:

Ben canavarlar targetboards için aşağıdaki değişikliği serbest İstediklerim:

17FEh.png

Nasıl eklemek için:

Açık uiTarget.py

aramak


ve altına eklediğiniz


 

 

Aramak 


		

ve bu altına eklediğiniz


		

Arama


 

altında ekleyin


 

 

Arama


 

Bulmak


altında ekleyin


Şimdi orada aramak


 

ve altına eklediğiniz


			

			   
			

altında 


		 

		  

Şimdi bitirdiniz ve gibi görünmelidir:

lipBb.png

 

İyi eğlenceler

http://prntscr.com/9wtznl :S 

Share this post


Link to post
Share on other sites

under self.hpPercenttxt.SetPosition(200 + 7*self.nameLength-205, 13)

 

try to add self.hpGauge.SetPosition(170 + 7*self.nameLength-205, 13)

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×