How to get target vitals?

i make a gui showing the target stats,but in the field of hp he shows 0.

what i do?

re cheak your code or maby its becuse the gui has that.

i put GetPlayerMaxVital(mytarget)

but he appear as 0.

all other stats is working fine.

re cheak your code or maby its becuse the gui has that.

I appreciate you’re trying to be helpful, but: If You Don’t Know the Answer, Don’t Reply.

GetPlayerMaxVital is the maximum of the Vital from an Player

So its getplayervital(Target) for players or mytarget idk now exact

and for NPC’s is there NPC(NPCNum).HP if im correct there

artix… i know you want help but please… HP stuff is already coded so please please take a look first in the code befor you write some wrong stuff

(Wrote on my Mobile)

how are you trying to do this? Are you requesting the vitals from the server and display them in when the server sends them or is your code only client side? Also are you checking to see if the target type is NPC or Player? Post your code here it will be easier for us to help you this way

RenderText Font_Default, Trim$(Player(mytarget).Vitals(HP)) & “/” & Trim$(Player(mytarget).MaxVitals(HP)), dX + 340, 302 - 237, White, 0, False

you are never checking to see if the target is an npc or a player so if your target is an npc mytarget holds the wring index

This is a little part of the sub.

I need to make a RequestTargetVitals sub and in server side i need to make a SendTargetVitals i think…

If you are using Origins or Mega then here’s a thought that may clear things up and make it easier for you.

(1st)

When you click to target something, PlayerSearch(CurX, CurY) is called in the HandleMouseDown sub. This sends a packet to the server where the server interprets it in modHandleData - HandleSearch.

(2nd)

HandleSearch figures out if you’ve targeted an npc or a player and then sends back the index and the target type to modHandleData - HandleTarget.

(3rd)

Now the client has the target and the type of target.

My recommendation is to simply use the global variable ‘MyTargetType’ to identify the target and simply get the vitals appropriately.

This can all be done Client-Side.

I know I could have just said that but I feel you should know more about what you’re doing to get better at doing it.

(Side-Note)

To be clear:

GetPlayerVital(index, HP) Returns the player’s current health

GetPlayerMaxVital(index, HP) Returns a player’s health when it’s full

NPC(npcnum).HP Returns an npc’s health when it’s full

Correct me if I’m wrong in any way. I’m not a god, I do make mistakes.

Wouldn’t it be better to let the server send the target details?

Wouldn’t it be better to let the server send the target details?

As soon as you click something on-screen, if it is target-able, it is sent to the server which interprets it and sends it back. I just said that up above bud.

This can all be done Client-Side.

Wouldn’t it be better to let the server send the target details?

facepalm

Meaning you don’t have to add anything to the Server…

So to answer your question; Obviously yes because it already does.

Please excuse me for not being more clear. I apologize

Also excuse my attitude, I’ve been up all night. I’m tired and stressed ;)

My question is why not do it server side. It would mean that the values are at least valid and trustworthy. If the client doesn’t get a certain update like a players level, then the target details is never updated.

You make a good point, I’ll give you that. You can do it that way. In my opinion, I don’t see a point in adding more to the server. It shouldn’t cause any issue with hacking anyway so why not use what’s already given to you. This doesn’t mean you have to, however. I just made a recommendation.

Log in to reply