Jump to content

Recommended Posts

  • Active Member

Hi.
pi-lbrxjxwgupeesjfuctcl.jpg

And now tutorial how add it into client:

You must add following code to costinfo.py

INPUT_IGNORE = 0

VID = 0
STHX = 0
HPXD = 0

PLAYER_HP = 0
PLAYER_MAX_HP = 0
PLAYER_SP = 0
PLAYER_MAX_SP = 0
PLAYER_NAME = ""

Next, open game.py, and add these things:

import uiHealth
			
			#wskaznikiHP
			"super_quest"				: self.Tabulejtor,
			"pvp_zdruwko"				: self.Mozart,
			
			#inputpowerdziwko
			"get_input_value"				: self.GetInputValue,
			"get_input_start"				: self.GetInputOn,
			"get_input_end"					: self.GetInputOff,

def Mozart(self, data):
		dane = data.split("|")
		constInfo.PLAYER_NAME = str(dane[0])
		constInfo.PLAYER_HP = int(dane[1])
		constInfo.PLAYER_MAX_HP = int(dane[2])
		constInfo.PLAYER_SP = int(dane[3])
		constInfo.PLAYER_MAX_SP = int(dane[4])

def Tabulejtor(self, id):
		constInfo.STHX = int(id)
			
	def GetInputOn(self):
		constInfo.INPUT_IGNORE = 1
		
	def GetInputOff(self):
		constInfo.INPUT_IGNORE = 0
			
	def GetInputValue(self):
		net.SendQuestInputStringPacket(str(constInfo.VID))

def OpenQuestWindow(self, skin, idx):
		if constInfo.INPUT_IGNORE == 1:
			return
		else:
			self.interface.OpenQuestWindow(skin, idx)

Next pieces of code you have to add to uitarget.py

import uiHealth
import constInfo

def OnUpdate(self):		
		if player.IsPVPInstance(self.vid):
			constInfo.VID = self.vid
			event.QuestButtonClick(constInfo.STHX)
			if not self.healthBoard.IsShow() and self.vid != 0:
				self.healthBoard.Show()
		else:
			self.healthBoard.Hide()
		
		if self.isShowButton:
			
			exchangeButton = self.buttonDict[locale.TARGET_BUTTON_EXCHANGE]
			distance = player.GetCharacterDistance(self.vid)

			if distance < 0:
				return

			if exchangeButton.IsShow():
				if distance > self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

			else:
				if distance < self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

In def __init__(self) (uitarget.py) must add this:
 

		self.healthBoard = uiHealth.HealthBoard()

In def Close() must add this:

		self.healthBoard.Hide()

For eg.

def Close(self):
		self.__Initialize()
		self.healthBoard.Hide()
		self.Hide()

Now you must create uihealth.py in root and paste there this code:

#Krzywy
import ui
import constInfo

def GetInfoFrom(id):
	table = {
		1	:	constInfo.PLAYER_NAME,
		2	:	constInfo.PLAYER_HP,
		3	:	constInfo.PLAYER_MAX_HP,
		4	:	constInfo.PLAYER_SP,
		5	:	constInfo.PLAYER_MAX_SP}
		
	if table.has_key(id):
		return table[id]
		

class HealthBoard(ui.ThinBoard):

	def __init__(self):
		ui.ThinBoard.__init__(self)
		
		self.Config()

	def __del__(self):
		ui.ThinBoard.__del__(self)
		
	def Config(self):
		self.SetSize(200, 120)
		self.SetPosition(0, 20)
		
		self.hp_bar = ui.Gauge()
		self.hp_bar.SetParent(self)
		self.hp_bar.SetPosition(30, 30+20)
		self.hp_bar.MakeGauge(130, "red")
		self.hp_bar.Show()
		
		self.sp_bar = ui.Gauge()
		self.sp_bar.SetParent(self)
		self.sp_bar.SetPosition(30, 60+20)
		self.sp_bar.MakeGauge(130, "blue")
		self.sp_bar.Show()
		
		self.name = ui.TextLine()
		self.name.SetParent(self)
		self.name.SetDefaultFontName()
		self.name.SetPosition(45, 30)
		self.name.SetText("")
		self.name.Show()	
		
		self.hp_show = ui.TextLine()
		self.hp_show.SetParent(self)
		self.hp_show.SetDefaultFontName()
		self.hp_show.SetPosition(60-15, 57)
		self.hp_show.SetText("")
		self.hp_show.Show()	
		
		self.sp_show = ui.TextLine()
		self.sp_show.SetParent(self)
		self.sp_show.SetDefaultFontName()
		self.sp_show.SetPosition(60-15, 80+7)
		self.sp_show.SetText("")
		self.sp_show.Show()	
		
	def OnUpdate(self):
		if (GetInfoFrom(2)+GetInfoFrom(3)+GetInfoFrom(4)+GetInfoFrom(5)) == 0:
			self.Hide()
		self.hp_bar.SetPercentage(GetInfoFrom(2), GetInfoFrom(3))
		self.sp_bar.SetPercentage(GetInfoFrom(4), GetInfoFrom(5))
		self.name.SetText(GetInfoFrom(1))
		self.hp_show.SetText("Health Points: %s / %s" % (GetInfoFrom(2), GetInfoFrom(3)))
		self.sp_show.SetText("Mana Points: %s / %s" % (GetInfoFrom(4), GetInfoFrom(5)))
		self.name.SetText("Character: %s" % (GetInfoFrom(1)))

And quest:

-- Quest Opponents HP and MP during pvp
-- Made by: Endymion_
-- Server: Ascarial.pl
quest wskaznikHpWroga begin
	state start begin
		when login begin
			cmdchat("super_quest "..q.getcurrentquestindex())
		end

		when info or button begin
			cmdchat("get_input_start")
			local vid = input(cmdchat("get_input_value"))
			cmdchat("get_input_end")
			local old_pc = pc.select(vid)
			local name = pc.get_name()
			local hp = pc.get_hp()
			local max_hp = pc.get_max_hp()
			local mp = pc.get_sp()
			local max_mp = pc.get_max_sp()
			pc.select(old_pc)
			cmdchat("pvp_zdruwko "..name.."|"..hp.."|"..max_hp.."|"..mp.."|"..max_mp)
		end
	end
end

Dif (created by blackyuko):

game2089

This difference file is created by The Interactive Disassembler

game2089
0014E673: 53 56
0014E674: 83 53
0014E675: EC 83
0014E676: 24 EC
0014E677: A1 20
0014E678: F8 8B
0014E679: 28 0D
0014E67A: 4C 20
0014E67B: 08 37
0014E67C: 89 4C
0014E67D: 45 08
0014E67E: F8 A1
0014E67F: 31 F8
0014E680: C0 28
0014E681: A1 4C
0014E682: 20 08
0014E683: 37 89
0014E684: 4C 45
0014E685: 08 F4
0014E686: 85 31
0014E688: 74 8B
0014E689: 74 75
0014E68A: A1 08
0014E68B: 20 90
0014E68C: 37 90
0014E68D: 4C 90
0014E68E: 08 90
0014E68F: 89 90
0014E690: 04 85
0014E691: 24 C9
0014E692: E8 74
0014E693: 59 5C
0014E694: FE A1
0014E695: 00 20
0014E696: 00 37
0014E697: 85 4C
0014E698: C0 08
0014E69A: C3 04
0014E69B: 74 24
0014E69C: 07 E8
0014E69D: 8B 4F
0014E69E: 40 FE
0014E69F: 24 00
0014E6A0: 85 00
0014E6A1: C0 85
0014E6A2: 74 C0
0014E6A3: 13 75
0014E6A4: 31 2F
0014E6A5: C0 C7
0014E6A6: 8B 44
0014E6A7: 55 24
0014E6A8: F8 04
0014E6A9: 33 00
0014E6AA: 15 00
0014E6AB: F8 00
0014E6AC: 28 00
0014E6AD: 4C C7
0014E6AE: 08 44
0014E6AF: 75 24
0014E6B0: 76 08
0014E6B1: 83 00
0014E6B2: C4 00
0014E6B3: 24 00
0014E6B4: 5B 00
0014E6B5: 5D 89
0014E6B6: C3 34
0014E6B7: 89 24
0014E6B8: 1C E8
0014E6B9: 24 03
0014E6BA: E8 63
0014E6BB: 31 18
0014E6BC: 38 00
0014E6BD: ED 8B
0014E6BE: FF 55
0014E6BF: 66 F4
0014E6C0: 3D 33
0014E6C1: 3F 15
0014E6C2: 4E F8
0014E6C3: 75 28
0014E6C4: DF 4C
0014E6C5: C7 08
0014E6C6: 44 B8
0014E6C7: 24 01
0014E6C8: 04 00
0014E6C9: 5F 00
0014E6CB: 00 75
0014E6CC: 00 4C
0014E6CD: 89 83
0014E6CE: 1C C4
0014E6CF: 24 20
0014E6D0: E8 5B
0014E6D1: 3B 5E
0014E6D2: 56 5D
0014E6D3: ED C3
0014E6D4: FF 8B
0014E6D5: C7 80
0014E6D6: 04 FC
0014E6D7: 24 00
0014E6DA: 00 52
0014E6DB: 00 50
0014E6DC: 83 DB
0014E6DD: E8 04
0014E6DE: 01 24
0014E6DF: 89 83
0014E6E0: 44 C4
0014E6E1: 24 08
0014E6E2: 04 DD
0014E6E3: E8 5C
0014E6E4: 68 24
0014E6E5: F6 04
0014E6E6: 17 89
0014E6E7: 00 34
0014E6E8: C7 24
0014E6E9: 44 E8
0014E6EA: 24 D2
0014E6EB: 04 62
0014E6EC: 5F 18
0014E6EE: 00 EB
0014E6EF: 00 CD
0014E6F0: 89 C7
0014E6F1: 1C 44
0014E6F3: 89 0C
0014E6F4: 44 E4
0014E6F5: 24 7B
0014E6F6: 08 33
0014E6F7: E8 08
0014E6F8: 74 C7
0014E6F9: 90 44
0014E6FA: ED 24
0014E6FB: FF 08
0014E6FC: EB 1A
0014E6FD: A6 00
0014E6FE: C7 00
0014E6FF: 44 00
0014E700: 24 C7
0014E701: 0C 44
0014E702: E4 24
0014E703: 7B 04
0014E704: 33 CA
0014E705: 08 7B
0014E706: C7 33
0014E707: 44 08
0014E708: 24 C7
0014E709: 08 04
0014E70A: 1A 24
0014E70B: 00 50
0014E70C: 00 A4
0014E70D: 00 35
0014E70E: C7 08
0014E70F: 44 E8
0014E710: 24 98
0014E711: 04 64
0014E712: CA EB
0014E713: 7B FF
0014E714: 33 E9
0014E715: 08 7B
0014E716: C7 FF
0014E717: 04 FF
0014E718: 24 FF
0014E719: 50 E8
0014E71A: A4 5E
0014E71B: 35 6A
0014E71C: 08 EB
0014E71D: E8 FF
0014E71E: 8A 90
0014E71F: 64 90
0014E720: EB 90
0014E721: FF 90
0014E722: E9 90
00312361: 64 67
00312363: 63 74
00312365: 72 76
00312366: 65 69
00312367: 6D 64
00312368: 61 00

 

game34083

This difference file is created by The Interactive Disassembler

game34083
001690C3: 53 56
001690C4: 83 53
001690C5: EC 83
001690C6: 24 EC
001690C7: A1 20
001690C8: 18 A1
001690C9: 14 18
001690CA: 6A 14
001690CB: 08 6A
001690CC: 89 08
001690CD: 45 89
001690CE: F8 45
001690CF: 31 F4
001690D0: C0 8B
001690D1: A1 75
001690D2: F0 08
001690D3: 23 31
001690D4: 6A C0
001690D5: 08 A1
001690D6: 89 F0
001690D7: 04 23
001690D8: 24 6A
001690D9: E8 08
001690DA: F2 89
001690DB: F2 04
001690DC: 00 24
001690DD: 00 E8
001690DE: 85 EE
001690DF: C0 F2
001690E0: 89 00
001690E1: C3 00
001690E2: 74 85
001690E3: 07 C0
001690E4: 8B 74
001690E5: 40 36
001690E6: 2C EB
001690E7: 85 18
001690E8: C0 B8
001690E9: 74 01
001690EA: 15 00
001690EB: 31 00
001690EC: C0 00
001690EF: F8 F4
001690FA: 24 20
001690FC: 5D 5E
001690FD: C3 5D
001690FE: 89 C3
001690FF: F6 90
00169100: 89 8B
00169101: 1C 80
00169102: 24 04
00169103: E8 01
00169104: D8 00
00169105: A4 00
00169106: EB 52
00169107: FF 50
00169108: 66 DB
00169109: 3D 04
0016910A: 3F 24
0016910B: 4E 83
0016910C: 75 C4
0016910D: DD 08
0016910E: C7 DD
0016910F: 44 5C
00169112: 5F 89
00169113: 00 34
00169114: 00 24
00169115: 00 E8
00169116: 89 B6
00169117: 1C E2
00169118: 24 28
00169119: E8 00
0016911A: A2 EB
0016911B: BD CC
0016911C: EB C7
0016911D: FF 44
0016911E: C7 24
00169120: 24 00
00169124: 00 C7
00169125: 83 44
00169126: E8 24
00169127: 01 08
00169128: 89 00
00169129: 44 00
0016912A: 24 00
0016912B: 04 00
0016912C: E8 89
0016912D: BF 34
0016912E: 82 24
0016912F: 28 E8
00169130: 00 9C
00169131: C7 E2
00169132: 44 28
00169133: 24 00
00169134: 04 EB
00169135: 5F B2
00169136: 00 90
00169137: 00 90
00169138: 00 90
00436D02: 64 67
00436D04: 63 74
00436D06: 72 76
00436D07: 65 69
00436D08: 6D 64
00436D09: 61 00

Greetings.
 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Love 2
Link to comment
https://metin2.dev/topic/592-how-to-display-hp-pm-during-pvp/
Share on other sites

Trololololol :D

It´s possible without using any quest or dif.

Simply Python.

Made it about 2 Years ago for my Server Illirea :o

 

:blink:

I'll leave your post better uncommented, otherwise you won't be happy about what I'd reply.

 

If you want I can rewrite the code so you won't have to go through lua.

  • Love 4

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

  • Active Member

 

Trololololol :D

It´s possible without using any quest or dif.

Simply Python.

Made it about 2 Years ago for my Server Illirea :o

 

:blink:

I'll leave your post better uncommented, otherwise you won't be happy about what I'd reply.

 

If you want I can rewrite the code so you won't have to go through lua.

 

If you have some free time you can rewrite. This version works ok, but why not.

 

Trololololol :D

It´s possible without using any quest or dif.

Simply Python.

Made it about 2 Years ago for my Server Illirea :o

 

:blink:

I'll leave your post better uncommented, otherwise you won't be happy about what I'd reply.

 

If you want I can rewrite the code so you won't have to go through lua.

 

Like i said, it is possible.

But my Actual version for it is made in C++ that´s much better for Performance and also better for not beeing stolen ;)

  • Love 1
  • 2 months later...
0609 12:03:09061 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import
 
networkModule.SetSelectCharacterPhase - exceptions.IndentationError:unindent does not match any outer indentation level (line 462)
 
0609 12:03:09061 :: ============================================================================================================
0609 12:03:09061 :: Abort!!!!
 
 
?
  • 1 month later...
  • Former Staff

anyone can do the file and upload them cus i think 90 % of who including (me) tried they just failed >< "

0609 12:03:09061 :: 

networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import


networkModule.SetSelectCharacterPhase - exceptions.IndentationError:unindent does not match any outer indentation level (line 462)


0609 12:03:09061 :: ============================================================================================================
0609 12:03:09061 :: Abort!!!!

 

anyone can do the file and upload them cus i think 90 % of who including (me) tried they just failed >< "

0609 12:03:09061 :: 

networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import


networkModule.SetSelectCharacterPhase - exceptions.IndentationError:unindent does not match any outer indentation level (line 462)


0609 12:03:09061 :: ============================================================================================================
0609 12:03:09061 :: Abort!!!!

 

tabs -.-

  • Former Staff

 

 

anyone can do the file and upload them cus i think 90 % of who including (me) tried they just failed >< "

0609 12:03:09061 :: 

networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import


networkModule.SetSelectCharacterPhase - exceptions.IndentationError:unindent does not match any outer indentation level (line 462)


0609 12:03:09061 :: ============================================================================================================
0609 12:03:09061 :: Abort!!!!

 

tabs -.-

 

 

i know it's tabs O.O

 

but idk there is something wrong i do every time

 

if it's work for you can you show me the tabs

 

with screenshots??

 

  • Management

0721 10:46:11903 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:26) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
uiTarget.py(line:12) ?
system.py(line:130) __pack_import
 
networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 72)
 
0721 10:46:11903 :: ============================================================================================================
0721 10:46:11903 :: Abort!!!!

raw

raw

  • 3 months later...

Excuse me - so do I have to use diff or not?

I'm using 40250 with vanilla core.

 

Thanks

search servercommand_build add

 

           "getinputbegin"			: self.__Inputget1,
			"getinputend"			: self.__Inputget2,
			"getinput"			: self.__Inputget3,
end game

 

def __Inputget1(self):
		constInfo.INPUT_IGNORE = 1 
		
	def __Inputget2(self):
		constInfo.INPUT_IGNORE = 0
		
	def __Inputget3(self): 
		net.SendQuestInputStringPacket(str(player.GetTargetVID()))
constinfo

 

INPUT_IGNORE = 0
questlib.lua

 

function npc.get_vid()
            cmdchat("getinputbegin")
            local ret = input(cmdchat("getinput"))
            cmdchat("getinputend")
            return ret
        end
by @Croqueta
  • Love 2
  • 2 months later...
0216 16:38:22706 :: Traceback (most recent call last):

0216 16:38:22706 ::   File "uiTarget.py", line 464, in OnUpdate

0216 16:38:22706 :: NameError
0216 16:38:22706 :: : 
0216 16:38:22706 :: global name 'event' is not defined
0216 16:38:22706 :: 

	def OnUpdate(self):
		if player.IsPVPInstance(self.vid):
			constInfo.VID = self.vid
			event.QuestButtonClick(constInfo.STHX)
			if not self.healthBoard.IsShow() and self.vid != 0:
				self.healthBoard.Show()
		else:
			self.healthBoard.Hide()
		
		if self.isShowButton:
			
			exchangeButton = self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE]
			distance = player.GetCharacterDistance(self.vid)

			if distance < 0:
				return

			if exchangeButton.IsShow():
				if distance > self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

			else:
				if distance < self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

Can you help me pls?

0216 16:38:22706 :: Traceback (most recent call last):

0216 16:38:22706 ::   File "uiTarget.py", line 464, in OnUpdate

0216 16:38:22706 :: NameError
0216 16:38:22706 :: : 
0216 16:38:22706 :: global name 'event' is not defined
0216 16:38:22706 :: 

	def OnUpdate(self):
		if player.IsPVPInstance(self.vid):
			constInfo.VID = self.vid
			event.QuestButtonClick(constInfo.STHX)
			if not self.healthBoard.IsShow() and self.vid != 0:
				self.healthBoard.Show()
		else:
			self.healthBoard.Hide()
		
		if self.isShowButton:
			
			exchangeButton = self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE]
			distance = player.GetCharacterDistance(self.vid)

			if distance < 0:
				return

			if exchangeButton.IsShow():
				if distance > self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

			else:
				if distance < self.EXCHANGE_LIMIT_RANGE:
					self.RefreshButton()

Can you help me pls?

 

import event

  • Love 1

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.