abhi2011 Posted March 18, 2013 Author Share Posted March 18, 2013 Hey there, this is a new tutorial of mine. It has 1 part unfinished which I will have to finish soon. Don't worry about it. It will be done ASAP.**CLIENT SIDE**Download the attachment. It has a picture box containing the details tab.After adding the tab make a label. Name it whatever you like. Caption can also be whatever you like. (This part is the button that opens up the tab. Like the inv button. Since I don't have a picture for a button I am using the method of a label.)Okay now double click on your new label and add the following lines of code.>! ![](http://i.imgur.com/nUkxBT2.png)```picOppDetails.Visible = TruepicInventory.Visible = FalsepicCharacter.Visible = FalsepicSpells.Visible = FalsepicOptions.Visible = FalsepicParty.Visible = False```I suppose that is self explanatory. Now we have to make the target details tab invisible when another tab is open. To do that, find this line of code.```If Not picInventory.Visible Then```Now add this line of code in each case.```picOppDetails.Visible = False```Now that that is done we have to declare our packets.In modEnumerations find```' Make sure SMSG_COUNT is below everything elseSMSG_COUNT```Above that add```STargetDetails```Now in modHandleData in the sub InitMessages add```HandleDataSub(STargetDetails) = GetAddress(AddressOf HandleTargetDetails)```Now at the end of the module add```Private Sub HandleTargetDetails(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Name As String, maxHp As Long, HP As Long, Level As Long, Stat(1 To Stats.Stat_Count - 1) As ByteDim i As LongDim Buffer As clsBufferSet Buffer = New clsBufferBuffer.WriteBytes Data()Name = Buffer.ReadStringLevel = Buffer.ReadBytemaxHp = Buffer.ReadLongHP = Buffer.ReadLongFor i = 1 To Stats.Stat_Count - 1Stat(i) = Buffer.ReadByteNext iWith frmMainIf Not Name = vbNullString Then.lblOppName.Caption = NameElse.lblOppName.Caption = "No Target"End If.lblOppLevel.Caption = LevelFor i = 1 To Stats.Stat_Count - 1.lblOppStat(i).Caption = Stat(i)Next iIf Not maxHp = 0 Then.lblOppHp = HP & "/" & maxHpElse.lblOppHp = "No Target"End IfEnd WithSet Buffer = NothingEnd Sub```in the same module find,```frmMain.imgHPBar.width = ((GetPlayerVital(MyIndex, Vitals.HP) / HPBar_Width) / (GetPlayerMaxVital(MyIndex, Vitals.HP) / HPBar_Width)) * HPBar_Width```Underneath, before the " error handler " add this```if mytargettype = target_type_player thenIf myTarget = MyIndex ThenfrmMain.lblOppHp = GetPlayerVital(MyIndex, HP) & "/" & Player(MyIndex).MaxVital(HP)End Ifend if```in the same module find```MapNpc(MapNpcNum).Vital(i) = Buffer.ReadLong```below that add```If myTargetType = TARGET_TYPE_NPC ThenIf myTarget = MapNpc(MapNpcNum).num ThenfrmMain.lblOppHp.Caption = MapNpc(MapNpcNum).Vital(HP) & "/" & Npc(myTarget).HPEnd IfEnd If```I suppose that is the end of Client Side. There might be more. Just Don't remember ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)**SERVER-SIDE**Lets declare our packet. Go to modEnumeration and find```' Make sure SMSG_COUNT is below everything elseSMSG_COUNT```Above that add```STargetDetails```Go to modHandleData and find this```Private Sub HandleSearch(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)```In this sub above every```sendtarget index```add```sendtargetdetails index```Now in modServerTCP add this at the bottom```Public Sub SendtargetDetails(ByVal index As Long)Dim Buffer As clsBufferDim target As Long, targetType As LongDim i As Longtarget = TempPlayer(index).targettargetType = TempPlayer(index).targetTypeSet Buffer = New clsBufferBuffer.WriteLong stargetdetailsSelect Case targetTypeCase TARGET_TYPE_PLAYERBuffer.WriteString GetPlayerName(target)Buffer.WriteByte GetPlayerLevel(target)Buffer.WriteLong GetPlayerMaxVital(target, HP)Buffer.WriteLong GetPlayerVital(target, HP)For i = 1 To Stats.Stat_Count - 1Buffer.WriteByte Player(target).stat(i)Next iCase TARGET_TYPE_NPCWith Npc(MapNpc(GetPlayerMap(index)).Npc(target).Num)Buffer.WriteString Trim$(.Name)Buffer.WriteByte .LevelBuffer.WriteLong .HPBuffer.WriteLong MapNpc(GetPlayerMap(index)).Npc(target).Vital(HP)For i = 1 To Stats.Stat_Count - 1Buffer.WriteByte .stat(i)Debug.Print .stat(i)Next iEnd WithCase TARGET_TYPE_NONEBuffer.WriteString vbNullStringBuffer.WriteByte 1Buffer.WriteLong 0Buffer.WriteLong 0For i = 1 To Stats.Stat_Count - 1Buffer.WriteByte 0Next iEnd SelectSendDataTo index, Buffer.ToArraySet Buffer = NothingEnd Sub```in modCombat find```' purge target info of anyone who targetted dead guyFor i = 1 To Player_HighIndexIf IsPlaying(i) And IsConnected(i) ThenIf Player(i).Map = GetPlayerMap(attacker) ThenIf TempPlayer(i).target = TARGET_TYPE_PLAYER ThenIf TempPlayer(i).target = victim ThenTempPlayer(i).target = 0TempPlayer(i).targetType = TARGET_TYPE_NONESendTarget iEnd IfEnd IfEnd IfEnd IfNext```Below ' SendTarget i ' ,add```sendtargetdetails i```in the same sub below```Call SendVital(victim, Vitals.HP)```below that add```sendtargetdetails(attacker)```find```'Loop through entire map and purge NPC from targetsFor i = 1 To Player_HighIndexIf IsPlaying(i) And IsConnected(i) ThenIf Player(i).Map = mapNum ThenIf TempPlayer(i).targetType = TARGET_TYPE_NPC ThenIf TempPlayer(i).target = mapNpcNum ThenTempPlayer(i).target = 0TempPlayer(i).targetType = TARGET_TYPE_NONESendTarget iEnd IfEnd IfEnd IfEnd IfNext```Below ' sendtarget i ' add```SendtargetDetails i```Use the full project search feature and find the following```sendtarget index```and add this bellow it```sendtargetdetails index```Thats all there is to the tutorials. If you think I missed something (like when you attack an update doesn't happen) post below.And also if there are compile errors post below as well. Link to comment Share on other sites More sharing options...
Wortel Angels Posted March 18, 2013 Share Posted March 18, 2013 Theres already an tutorial for that (One not fixed and one which is the same fixed by me);-) But thats nice too hahaIm happy to see again something from you Link to comment Share on other sites More sharing options...
abhi2011 Posted March 18, 2013 Author Share Posted March 18, 2013 Oh, there was? Man. Oh well. Link to comment Share on other sites More sharing options...
Alerd Posted March 18, 2013 Share Posted March 18, 2013 Please screenshotThanx Link to comment Share on other sites More sharing options...
DarkDino Posted March 18, 2013 Share Posted March 18, 2013 Buffer.WriteLong MapNpc(GetPlayerMap(index)).Npc(mapNpcNum).Vital(HP)Error in this line :c "Sub index out of range"Please help D: to fix Link to comment Share on other sites More sharing options...
abhi2011 Posted March 19, 2013 Author Share Posted March 19, 2013 Screenshot of the error plz. I tried googling that error but nothing came up. Link to comment Share on other sites More sharing options...
DarkDino Posted March 24, 2013 Share Posted March 24, 2013 This is my error D:[attachment=645:fefe.JPG] Link to comment Share on other sites More sharing options...
abhi2011 Posted March 25, 2013 Author Share Posted March 25, 2013 Hover over each variable. A tooltip is shown. On the variable that shows paste that variable here. Link to comment Share on other sites More sharing options...
DarkDino Posted March 25, 2013 Share Posted March 25, 2013 For i = 1 To Stats.Stat_Count - 1Buffer.WriteByte .stat(i) <– Debug.Print .stat(i) <– Next i Link to comment Share on other sites More sharing options...
DarkDino Posted March 28, 2013 Share Posted March 28, 2013 Please help in error Sbuscript out of Range D:!? Link to comment Share on other sites More sharing options...
abhi2011 Posted March 29, 2013 Author Share Posted March 29, 2013 Do you have TeamViewer? Link to comment Share on other sites More sharing options...
DarkDino Posted March 30, 2013 Share Posted March 30, 2013 Yes i have D: Link to comment Share on other sites More sharing options...
abhi2011 Posted March 30, 2013 Author Share Posted March 30, 2013 Pass me your details, I will try to fix it remotely. Link to comment Share on other sites More sharing options...
WK67 Posted April 25, 2013 Share Posted April 25, 2013 I, too have this problem. I can only view some NPC's HP. Other then that, it RTE9's on me. This is very upsetting. Mainly because this feature works so well, when it works. If there is a fix I'd recommend updating the tutorial. Thanks. Link to comment Share on other sites More sharing options...
abhi2011 Posted April 26, 2013 Author Share Posted April 26, 2013 Run in the IDE. When it errors, click debug in the box. (Make sure debug mode is off)The errored line will be highlighted. Copy paste it here. Hover through all the variables in the line of code that errors and type in the variable value which has the errors. (Var value will be Subscript out of Range.) Link to comment Share on other sites More sharing options...
WK67 Posted April 28, 2013 Share Posted April 28, 2013 Ok, I didn't quite understand what you meant.. But here's what I found. (Excuse my ignorance, I'm not very advanced with VB6 at all.)This is the line that errors:Buffer.WriteLong MapNpc(GetPlayerMap(index)).NPC(mapNpcNum).Vital(HP)When I hovered over everything I found this:(GetPlayerMap(index)) = 1.NPC(mapNpcNum) = 0And out of these lines of code.. I found a few that (Subscript out of Range)'dFor i = 1 To Stats.Stat_Count - 1Buffer.WriteByte .Stat(i) = (Subscript out of Range)Debug.Print .Stat(i) = (Subscript out of Range)Next iEnd WithAlso, for some reason it seems to display the stats of the first NPC in my NPC list.. Rather than the actual map NPC.. I'm very confused. Link to comment Share on other sites More sharing options...
abhi2011 Posted April 28, 2013 Author Share Posted April 28, 2013 Ensure the following.i > 1 < stats.stat_count - 1target > 1 < Max_NPC Link to comment Share on other sites More sharing options...
zomb88 Posted April 28, 2013 Share Posted April 28, 2013 Why are you adding to server load for this feature? When you can do it just client side. Link to comment Share on other sites More sharing options...
abhi2011 Posted April 28, 2013 Author Share Posted April 28, 2013 Because it isn't' always necessary for the client to get the npc/player details. This ensures that the details are valid. Link to comment Share on other sites More sharing options...
zomb88 Posted April 28, 2013 Share Posted April 28, 2013 all you need is the npc num and its current vitals (which already get sent anyway)?? Link to comment Share on other sites More sharing options...
DarkDino Posted April 28, 2013 Share Posted April 28, 2013 > Ok, I didn't quite understand what you meant.. But here's what I found. (Excuse my ignorance, I'm not very advanced with VB6 at all.)> > This is the line that errors:> > Buffer.WriteLong MapNpc(GetPlayerMap(index)).NPC(mapNpcNum).Vital(HP)> > When I hovered over everything I found this:> > (GetPlayerMap(index)) = 1> > .NPC(mapNpcNum) = 0> > And out of these lines of code.. I found a few that (Subscript out of Range)'d> > For i = 1 To Stats.Stat_Count - 1> > Buffer.WriteByte .Stat(i) = (Subscript out of Range)> > Debug.Print .Stat(i) = (Subscript out of Range)> > Next i> > End With> > Also, for some reason it seems to display the stats of the first NPC in my NPC list.. Rather than the actual map NPC.. I'm very confused.Have same error, this dont work :/ Link to comment Share on other sites More sharing options...
WK67 Posted April 28, 2013 Share Posted April 28, 2013 > Ensure the following.> > i > 1 < stats.stat_count - 1> > target > 1 < Max_NPCAs far as I can see, the first one is correct.. I dont know where the hell MAX_NPC is. Though I found MAX_MAP_NPCS which is like this:For i = 1 To MAX_MAP_NPCSStill, I dont understand why when I hover over mapnpcnum… it says "mapnpcnum = 0"... Even though The code is written like this: mapnpcnum = i... Also when i hover over "i" it shows "i = 101"... wtfffffMAYBE, if you uploaded a working version with the source.... I could see exactly what's wrong. ![:huh:](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/huh.png) Link to comment Share on other sites More sharing options...
Sunku Posted April 28, 2013 Share Posted April 28, 2013 Would there be a way to put this into a skill, sort of like "Scan" from Final Fantasy? Link to comment Share on other sites More sharing options...
abhi2011 Posted April 29, 2013 Author Share Posted April 29, 2013 > all you need is the npc num and its current vitals (which already get sent anyway)??The vitals might be delayed, might get corrupted etc, etc. You should never trust the Clients values. (The client can be hacked.)> Have same error, this dont work :/I'll try fixing this ASAP.> As far as I can see, the first one is correct.. I dont know where the hell MAX_NPC is. Though I found MAX_MAP_NPCS which is like this:> > For i = 1 To MAX_MAP_NPCS> > Still, I dont understand why when I hover over mapnpcnum… it says "mapnpcnum = 0"... Even though The code is written like this: mapnpcnum = i... Also when i hover over "i" it shows "i = 101"... wtfffff> > MAYBE, if you uploaded a working version with the source.... I could see exactly what's wrong. ![:huh:](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/huh.png)It should be MAX_NPCS> Would there be a way to put this into a skill, sort of like "Scan" from Final Fantasy?If you mean player skills is shown, sure. You will need to add some more stuff though. (Or did you mean taking a peek into the players skills?) Link to comment Share on other sites More sharing options...
zomb88 Posted April 29, 2013 Share Posted April 29, 2013 > The vitals might be delayed, might get corrupted etc, etc. You should never trust the Clients values. (The client can be hacked.)If the client wants to hack client values then they can go ahead it wont do anything…The vitals come directly from the server and you can display the information through targeting or combat system... i dont see how that is delayed.. 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