Zappy Posted February 10, 2013 Author Share Posted February 10, 2013 Hey guys! I've ran into a bit of a jam that I can't really figure out. I need to communicate with the client regarding whether or not an npc or player is currently affected by a D.O.T, H.O.T, stun, etc.However I'm not sure exactly what to be doing. I assumed I needed to go into "SendMapNpcto" and 'HandleMapData" and add "BufferReadLong/Writelong" to transmit the new variable, but it isn't reading properly… Anyone familiar with doing this sorta thing willing to give a quick lesson ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)?This is in the client```Private Sub HandleMapNpcData(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim i As LongDim Buffer As clsBuffer' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerSet Buffer = New clsBufferBuffer.WriteBytes data()For i = 1 To MAX_MAP_NPCS With MapNpc(i) .num = Buffer.ReadLong .x = Buffer.ReadLong .y = Buffer.ReadLong .Dir = Buffer.ReadLong .Vital(HP) = Buffer.ReadLong .StatusEffect = Buffer.ReadLong End WithNext' Error handlerExit Suberrorhandler:HandleError "HandleMapNpcData", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```This is in the server```Sub SendMapNpcsTo(ByVal Index As Long, ByVal mapnum As Long)Dim packet As StringDim i As LongDim Buffer As clsBufferSet Buffer = New clsBufferBuffer.WriteLong SMapNpcDataFor i = 1 To MAX_MAP_NPCS Buffer.WriteLong MapNpc(mapnum).NPC(i).Num Buffer.WriteLong MapNpc(mapnum).NPC(i).x Buffer.WriteLong MapNpc(mapnum).NPC(i).y Buffer.WriteLong MapNpc(mapnum).NPC(i).Dir Buffer.WriteLong MapNpc(mapnum).NPC(i).Vital(HP) Buffer.WriteLong MapNpc(mapnum).NPC(i).StatusEffectNextSendDataTo Index, Buffer.ToArray()Set Buffer = NothingEnd Sub```I have the same extra line in SendMapNpcsToMap or whatever.I also have the StatusEffect variable declared in both NpcRec AND MapNpcRec, on both sides. Link to comment Share on other sites More sharing options...
Guest Posted February 10, 2013 Share Posted February 10, 2013 You have the right idea. You need to read/write the same variable and in the same order. If you're writing this:```Buffer.WriteByte NPC.IsHoTedBuffer.WriteLong NPCNum```Then you have to receive it on the other end like this:```NPC.IsHoTed = Buffer.ReadByteBuffer.WriteLong NPCNum```Also if you posted your code it would be a lot easier to help you. Link to comment Share on other sites More sharing options...
Zappy Posted February 10, 2013 Author Share Posted February 10, 2013 Alright, I will ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) I didn't know if it'd be highly important, since it's only a few lines. Link to comment Share on other sites More sharing options...
Zappy Posted February 11, 2013 Author Share Posted February 11, 2013 I posted it in the Op ^ 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