Jump to content

Get skill count - New Pet System


Go to solution Solved by safademirel,

Recommended Posts

  • Bot

I want to get the number of slots available for the pet's skills and I did this:

In New_PetSystem.cpp

I searched:

CNewPetActor::CNewPetActor(LPCHARACTER owner, DWORD vnum, DWORD options)

I added inside:

m_dwgetskillcount = 0;

somewhere I added this:

void CNewPetActor::GetSkillCount() {
	if (m_dwskillslot[0] > -1 && m_dwskillslot[1] == -1 && m_dwskillslot[2] == -1)
		m_dwgetskillcount = 1;
	else if (m_dwskillslot[0] > -1 && m_dwskillslot[1] > -1 && m_dwskillslot[2] == -1)
		m_dwgetskillcount = 2;
	else if (m_dwskillslot[0] > -1 && m_dwskillslot[1] > -1 && m_dwskillslot[2] > -1)
		m_dwgetskillcount = 3;
}

I searched:

void CNewPetActor::UpdateTime()

inside of:

if (pSummonItem != NULL)

i added:

pSummonItem->SetForceAttribute(7, 1, m_dwgetskillcount);

I searched: 

void CNewPetActor::Unsummon()
{
	if (true == this->IsSummoned())

i added:

pSummonItem->SetForceAttribute(7, 1, m_dwgetskillcount);

I searched:

DWORD CNewPetActor::Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar)

i added:

pSummonItem->SetForceAttribute(7, 1, m_dwgetskillcount);

In New_PetSystem.h

i added:

void			GetSkillCount();

and:

DWORD			m_dwgetskillcount;

in char_item.cpp

in:

if (item->GetVnum() >= 55701 && item->GetVnum() <= 55706) {

and in:

if (item->GetVnum() == 55002 && item->GetAttributeValue(0) > 0) {

i added:

item2->SetForceAttribute(7, 1, item->GetAttributeValue(7));

in uitooltip.py i added:

getskillcount = (int(attrSlot[7][1]))

and:

self.AppendTextLine("("+str(getskillslot)+")", self.NORMAL_COLOR)

But in the game it is shown as 0, it does not add the value of the attrvalue, but yes of the attrtype

ubiGE9yQQvih5nfTKeyIug.png

 

Z6FyAIJFQxKZQ8ubk76LqA.png

 

Can someone help me please? Is there any other way to obtain the amount of spaces available for the power in the description of the article in uitooltip?

Thanks in advance.

Edited by Metin2 Dev
Core X - External 2 Internal

english_banner.gif

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Bot

But how can I instantiate uipetsystem.py to uitooltip.py? I do not know much about python :(

def SetSkill(self, slot, idx, lv):
		if int(idx) != -1:
			self.skillslot.ClearSlot(int(slot))
			self.skillslot.SetPetSkillSlot(int(slot), int(idx), int(lv), 0.5, 0.5)
			self.skillslot.SetCoverButton(int(slot), "d:/ymir work/ui/pet/mini_window/pet_slot_corvermini.sub", "d:/ymir work/ui/pet/mini_window/pet_slot_corvermini.sub", "d:/ymir work/ui/pet/mini_window/pet_slot_corvermini.sub" , "d:/ymir work/ui/pet/mini_window/pet_slot_corvermini.sub")
			self.skillslot.SetAlwaysRenderCoverButton(int(slot), True)
def SetSkill(self, slot, idx, lv):
		if int(idx) != -1:
			self.petskill0.ClearSlot(int(slot))
			self.petskill0.SetPetSkillSlot(int(slot), int(idx), int(lv))
			self.petskill0.SetCoverButton(int(slot))
			self.petskill0.SetAlwaysRenderCoverButton(int(slot), True)
			self.arrytooltip[int(slot)][0] = int(idx)
			self.arrytooltip[int(slot)][1] = int(lv)

How can I make the file uitooltip.py read that which is in uipetsystem.py

english_banner.gif

Link to comment
Share on other sites

On 2/16/2018 at 8:12 PM, WLsj24 said:

But how can I instantiate uipetsystem.py to uitooltip.py? I do not know much about python :(


def SetSkill(self, slot, idx, lv):
		if int(idx) != -1:
			[...................]

How can I make the file uitooltip.py read that which is in uipetsystem.py

I don't know nothing about how it's working that pet, but i think you can do something like that on python, not sure.

  • uiPetSystem.py
import uiToolTip
[..............]
###################################
g_PetSkillSlotAvailableDict = {}
def GetPetSkillSlot():
	return len([slot for slot in g_PetSkillSlotAvailableDict.values() if slot])

###################################
def SetSkill(self, slot, idx, lv):
	if int(idx) != -1:
		[..............]

	g_PetSkillSlotAvailableDict.update({int(slot) : int(idx) != -1})
###################################
  • uiToolTip.py
from uiPetSystem import GetPetSkillSlot
self.AppendTextLine('(%d)' % GetPetSkillSlot(), self.NORMAL_COLOR)
  • game.py
	self.__BuildDebugInfo()
	###############################
	import uiPetSystem
	uiPetSystem.g_PetSkillSlotAvailableDict.clear()

That's a shit thing to do it on python, because you can't see the length of it until you didn't call SetSkill << and for that i think you have to use item, so for tooltip will be bad.

Link to comment
Share on other sites

  • Bot
10 hours ago, safademirel said:

int CNewPetActor::GetSkillCount() {
	int skillCount = 0;

	for (int i = 0; i < 3; i++) {
		if (m_dwskillslot[i] >= 0)
			++skillCount;

	}
	
	return skillCount;
}

pSummonItem->SetForceAttribute(7, 1, GetSkillCount());


 

try something like that.

It works perfectly, thank you very much !!

 

6 hours ago, Tasho said:
On 16/2/2018 at 7:12 PM, WLsj24 said:

But how can I instantiate uipetsystem.py to uitooltip.py? I do not know much about python :(



def SetSkill(self, slot, idx, lv):
		if int(idx) != -1:
			[...................]

How can I make the file uitooltip.py read that which is in uipetsystem.py

I don't know nothing about how it's working that pet, but i think you can do something like that on python, not sure.

  • uiPetSystem.py

import uiToolTip
[..............]
###################################
g_PetSkillSlotAvailableDict = {}
def GetPetSkillSlot():
	return len([slot for slot in g_PetSkillSlotAvailableDict.values() if slot])

###################################
def SetSkill(self, slot, idx, lv):
	if int(idx) != -1:
		[..............]

	g_PetSkillSlotAvailableDict.update({int(slot) : int(idx) != -1})
###################################
  • uiToolTip.py

from uiPetSystem import GetPetSkillSlot
self.AppendTextLine('(%d)' % GetPetSkillSlot(), self.NORMAL_COLOR)
  • game.py

	self.__BuildDebugInfo()
	###############################
	import uiPetSystem
	uiPetSystem.g_PetSkillSlotAvailableDict.clear()

That's a shit thing to do it on python, because you can't see the length of it until you didn't call SetSkill << and for that i think you have to use item, so for tooltip will be bad.

I also tried this method, but it prints 0 always, thanks also for the interest in the help. : D

english_banner.gif

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.