balliztik1 Posted September 2, 2009 Author Share Posted September 2, 2009 In Eclipse Stable (and maybe older versions), the code is already there to blit out other players' health bars. However, the player's health is never sent to others' clients. This is easily fixed by a slight modification to the SendHP function. Find both instances of SendHP and change them to this:```Sub SendHP(ByVal Index As Long) Call SendDataToMap(GetPlayerMap(index), "PLAYERHP" & SEP_CHAR & Index & SEP_CHAR & GetPlayerMaxHP(Index) & SEP_CHAR & GetPlayerHP(Index) & END_CHAR)End Sub```This makes sure all players on your map get the HP update.Now, you'll need to make sure when a player enters the game, their HP is sent out, and all players' HP is sent to them. The easiest way to do this is to place it in the need map packet, because that packet already sends the data for every characters' equipment on said map. In Sub Packet_NeedMap, alter the For loop like so:``` For I = 1 To MAX_PLAYERS If IsPlaying(I) Then Call SendHP(I) Call SendIndexWornEquipment(I) Call SendWornEquipment(I) End If Next I```Now, everyone on the map gets your updated HP.Finally, you just need to alter the client's packet handling for the SendHP sub. Find the "playerhp" packet handle in the HandleData sub of the Client and change it to this:``` If LCase$(Casestring) = "playerhp" Then Player(Parse(1)).MaxHp = Val(Parse(2)) Call SetPlayerHP(Parse(1), Val(Parse(3))) If Parse(1) = MyIndex And GetPlayerMaxHP(MyIndex) > 0 Then ' frmMirage.shpHP.FillColor = RGB(208, 11, 0) frmMirage.shpHP.Width = ((GetPlayerHP(MyIndex)) / (GetPlayerMaxHP(MyIndex))) * 150 frmMirage.lblHP.Caption = GetPlayerHP(MyIndex) & " / " & GetPlayerMaxHP(MyIndex) End If Exit Sub End If```And that will do it. Link to comment Share on other sites More sharing options...
Kirby4tw Posted September 2, 2009 Share Posted September 2, 2009 Client Error"index out of range exception"in code:``` If LCase$(Casestring) = "playerhp" Then Player(Parse(1)).MaxHp = Val(Parse(2)) Call SetPlayerHP(Parse(1), Val(Parse(3))) If Parse(1) = MyIndex And GetPlayerMaxHP(MyIndex) > 0 Then ' frmMirage.shpHP.FillColor = RGB(208, 11, 0) frmMirage.shpHP.Width = ((GetPlayerHP(MyIndex)) / (GetPlayerMaxHP(MyIndex))) * 150 frmMirage.lblHP.Caption = GetPlayerHP(MyIndex) & " / " & GetPlayerMaxHP(MyIndex) End If Exit Sub End If```Thats the Error-lineCall SetPlayerHP(Parse(1), Val(Parse(3))) Link to comment Share on other sites More sharing options...
Diskmaster Posted September 2, 2009 Share Posted September 2, 2009 (referring to the main post, the one with the code in it)phew, thats a relief, I thought there would never be a fix to this (somewhat unknown) bug!Nice job :cheesy: ;) Link to comment Share on other sites More sharing options...
balliztik1 Posted September 2, 2009 Author Share Posted September 2, 2009 @Kirby4tw:> Client Error> "index out of range exception"> > in code:> > ```> If LCase$(Casestring) = "playerhp" Then> Player(Parse(1)).MaxHp = Val(Parse(2))> Call SetPlayerHP(Parse(1), Val(Parse(3)))> If Parse(1) = MyIndex And GetPlayerMaxHP(MyIndex) > 0 Then> ' frmMirage.shpHP.FillColor = RGB(208, 11, 0)> frmMirage.shpHP.Width = ((GetPlayerHP(MyIndex)) / (GetPlayerMaxHP(MyIndex))) * 150> frmMirage.lblHP.Caption = GetPlayerHP(MyIndex) & " / " & GetPlayerMaxHP(MyIndex)> End If> Exit Sub> End If> ```> Thats the Error-line> Call SetPlayerHP(Parse(1), Val(Parse(3)))Did you change the SendHP sub in both places? It sounds like you've still got the old version of SendHP with the new version of the packet handle. Link to comment Share on other sites More sharing options...
Kirby4tw Posted September 2, 2009 Share Posted September 2, 2009 Im using Eclipse stable…i use your tut but... i cant see my own HPbar anymore...and i cant see others player hp too...:/' FOUND THE ERROR, i think its operates. I test it with multiloginBIG THX! Link to comment Share on other sites More sharing options...
Sr_Sirius Posted September 2, 2009 Share Posted September 2, 2009 Works fine. Thank you :) Link to comment Share on other sites More sharing options...
minipimp Posted September 2, 2009 Share Posted September 2, 2009 so this actually makes is to you can see other players hp, "not your own ontop of everyone"? Link to comment Share on other sites More sharing options...
balliztik1 Posted September 2, 2009 Author Share Posted September 2, 2009 @Hey880:> so this actually makes is to you can see other players hp, "not your own ontop of everyone"?The code for this has been in the engine for who knows how long. It was just a matter of making sure the client gets a value for the HP. Link to comment Share on other sites More sharing options...
Kirby4tw Posted October 8, 2009 Share Posted October 8, 2009 With this code the Sadcript commands like "SetPlayerHP(index,GetPlayerMaxHP(index))"will not work longer if you have worn equip. Please fix this Balliztik1 ^^For Questions: [email protected] (MSN) Link to comment Share on other sites More sharing options...
balliztik1 Posted October 9, 2009 Author Share Posted October 9, 2009 @Kirby4tw:> With this code the Sadcript commands like "SetPlayerHP(index,GetPlayerMaxHP(index))"> will not work longer if you have worn equip. Please fix this Balliztik1 ^^> > For Questions: [email protected] (MSN)Well, I made no changes to the SetPlayerHP sub, so I don't see how that could be an issue with this code. I know there's a post around here about GetPlayerMaxHP not returning the right value. Check that out.At a glance (because I'm leaving in a moment), try reversing the SendHP and the equipment sends. Maybe sending the HP after the equipment is a better idea. Still, I don't think the issue lies here. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now