Get Level of selected char in TargetInfoNewUI
#11


35 minutes ago, Andrein95 said:




After using bHideLevel = FALSE, and added level in server for struct




charStatusPc : public pTypeBase


can't get that struct back in target class.



I've seen that chasStatusPc Struct its used only in EntitiesMP project, then called in Network classes. What do you think?




You send character level information from the server via CmdMsg.cpp .

And in the client, you fill in class CCharacterTarget via setData and already output information through the pointer CCharacterTarget* ptrTarget to TargetInfoNewUI.cpp

And that's it

#12


22 hours ago, Dimaflash said:




You send character level information from the server via CmdMsg.cpp .



And in the client, you fill in class CCharacterTarget via setData and already output information through the pointer CCharacterTarget* ptrTarget to TargetInfoNewUI.cpp

And that's it




Still can't get on client, I'm trying to do:

ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));

 

#13


14 minutes ago, Andrein95 said:




Still can't get on client, I'm trying to do:




ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));


 




ptrTarget = static_cast< CCharacterTarget* >(pObject2)



and:  ptrTarget->your_var_for_level

#14


16 hours ago, Dimaflash said:




ptrTarget = static_cast< CCharacterTarget* >(pObject2)



and:  ptrTarget->your_var_for_level




pObject2

is NULL,

Still doesn't work:

ObjectBase* pObject1 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetServerIdx(eTARGET));
ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));

CCharacterTarget *pTarget1, *pTarget2;
if (pObject1 != NULL)
pTarget1 = static_cast<CCharacterTarget*>(pObject1);
if (pObject2 != NULL)
pTarget2 = static_cast<CCharacterTarget*>(pObject2);

2

2

Since CCharacterTarget is a casted object of ObjectBase, where is filled ObjectBase, in other terms:

1 - Wich methods is called in CmdMsg? I think AppearMsg

2 - Wich class are we talking about in server side for this Object Base class?

#15


7 hours ago, Andrein95 said:





pObject2


is NULL,



Still doesn't work:




ObjectBase* pObject1 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetServerIdx(eTARGET));
ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));

CCharacterTarget *pTarget1, *pTarget2;
if (pObject1 != NULL)
pTarget1 = static_cast<CCharacterTarget*>(pObject1);
if (pObject2 != NULL)
pTarget2 = static_cast<CCharacterTarget*>(pObject2);


2



2



Since CCharacterTarget is a casted object of ObjectBase, where is filled ObjectBase, in other terms:



1 - Wich methods is called in CmdMsg? I think AppearMsg



2 - Wich class are we talking about in server side for this Object Base class?




ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));

Oh, I didn't look at that line of yours.





the GetTargetLevel() function does not need to be called, you will receive information about the level in a different way, through the class pointer CCharacterTarget* :

ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetServerIdx(eTARGET));
CCharacterTarget* ptrTarget = static_cast< CCharacterTarget* >(pObject2);




As you can see, in your screenshots, there is no level variable in the CCharacterTarget class, which I specified as your_var_for_level .



And of course you need to create it and fill it with the SetData() method. I wrote about this above.



On the server side you also need to create a variable in ptype_appear.h - struct appearPc{ } And fill it in void AppearMsg() .





 

#16


18 hours ago, Dimaflash said:





ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetLevel(eTARGET));


Oh, I didn't look at that line of yours.





the GetTargetLevel() function does not need to be called, you will receive information about the level in a different way, through the class pointer CCharacterTarget* :




ObjectBase* pObject2 = ACTORMGR()->GetObject(eOBJ_CHARACTER, pInfo->GetTargetServerIdx(eTARGET));
CCharacterTarget* ptrTarget = static_cast< CCharacterTarget* >(pObject2);





As you can see, in your screenshots, there is no level variable in the CCharacterTarget class, which I specified as your_var_for_level .



And of course you need to create it and fill it with the SetData() method. I wrote about this above.



On the server side you also need to create a variable in ptype_appear.h - struct appearPc{ } And fill it in void AppearMsg() .





 




Thank you. Understood and it works.

As far I know, AppearMsg is sent when a client login, so the client stores the 'new_lavel_value' on client side. But how to update it in case of level up of players? I've seen that in party when someone level up level is automatically updated. Any hint how to achieve that?

#17

/index.php?/profile/21749-dimaflash/&do=hovercard" data-mentionid="21749" href="/index.php?/profile/21749-dimaflash/" rel="">@Dimaflash I think to use the packet sent in party to update life/level. What do you think?

#18


On 5/1/2022 at 6:47 PM, Andrein95 said:




Thank you. Understood and it works.



As far I know, AppearMsg is sent when a client login, so the client stores the 'new_lavel_value' on client side. But how to update it in case of level up of players? I've seen that in party when someone level up level is automatically updated. Any hint how to achieve that?




No.

You can conduct an experiment.

Level up another character in sight. From the point of view of the main character, nothing will change. Now move away from the other character so that he disappears from sight (completely).

And then come back.

And you will see that now the level of another character is displayed correctly for you.

#19


On 5/3/2022 at 8:52 AM, Dimaflash said:




No.

You can conduct an experiment.

Level up another character in sight. From the point of view of the main character, nothing will change. Now move away from the other character so that he disappears from sight (completely).

And then come back.

And you will see that now the level of another character is displayed correctly for you.




Experiment success. This works.

How can make it works without this trick? The level is not updated even If I attack the player and the HP are updated from ' UpdateHPInfo ' function.

#20

@/index.php?/profile/21749-dimaflash/&do=hovercard&referrer=https%253A%252F%252Flckb.dev%252Fforum%252Findex.php%253F%252Ftopic%252F15286-get-level-of-selected-char-in-targetinfonewui%252F" href="/index.php?/profile/21749-dimaflash/" style="background-color:#202020;color:#0789ff;font-size:13px;text-align:left;" title="Go to Dimaflash's profile" rel="">Dimaflash What do you think about this:

1) Check if I have selected target

2) If the target is not my self, I'll start a thread with polling server for asking AppearMsg

3) Check If has refresh HP

4) Update UI



Forum Jump:


Users browsing this thread: 1 Guest(s)