terabin Posted December 31, 2011 Author Share Posted December 31, 2011 Well, in my time using the EO, I found many bugs, and came to share the solution for everyone.**6 bugs resolved.**Bugs resolved:-If there are three players in one group and one out.-Exp bar only works for the first player.-Division of exp-You can send an invitation if already received-Several clicks are breaking down the server.-Several clicks are breaking down the server.In Party_PlayerLeaveReplace all for it:```Public Sub Party_PlayerLeave(ByVal index As Long)Dim partyNum As Long, i As Long  partyNum = TempPlayer(index).inParty  If partyNum > 0 Then    ' find out how many members we have    Party_CountMembers partyNum    ' make sure there's more than 2 people    If Party(partyNum).MemberCount > 2 Then      ' check if leader      If Party(partyNum).Leader = index Then        ' set next person down as leader        For i = 1 To MAX_PARTY_MEMBERS          If Party(partyNum).Member(i) > 0 And Party(partyNum).Member(i) <> index Then            Party(partyNum).Leader = Party(partyNum).Member(i)            PartyMsg partyNum, GetPlayerName(i) & " é o lider do grupo.", BrightBlue            Exit For          End If        Next        ' leave party        PartyMsg partyNum, GetPlayerName(index) & " saiu do grupo.", BrightRed        ' remove from array        For i = 1 To MAX_PARTY_MEMBERS          If Party(partyNum).Member(i) = index Then            Party(partyNum).Member(i) = 0            TempPlayer(index).inParty = 0            TempPlayer(index).partyInvite = 0            Exit For            End If        Next        ' recount party        Party_CountMembers partyNum        ' set update to all        SendPartyUpdate partyNum        ' send clear to player        SendPartyUpdateTo index      Else        ' not the leader, just leave        PartyMsg partyNum, GetPlayerName(index) & " saiu do grupo.", BrightRed        ' remove from array        For i = 1 To MAX_PARTY_MEMBERS          If Party(partyNum).Member(i) = index Then            Party(partyNum).Member(i) = 0            TempPlayer(index).inParty = 0            TempPlayer(index).partyInvite = 0            Exit For          End If        Next        ' recount party        Party_CountMembers partyNum        ' set update to all        SendPartyUpdate partyNum        ' send clear to player        SendPartyUpdateTo index      End If    Else      ' find out how many members we have      Party_CountMembers partyNum      ' only 2 people, disband      PartyMsg partyNum, "Grupo desfeito.", BrightRed      ' clear out everyone's party      For i = 1 To MAX_PARTY_MEMBERS        index = Party(partyNum).Member(i)        ' player exist?        If index > 0 Then          ' remove them          TempPlayer(index).partyInvite = 0          TempPlayer(index).inParty = 0          ' send clear to players          SendPartyUpdateTo index        End If      Next      ' clear out the party itself      ClearParty partyNum    End If  End IfEnd Sub```In HandlePlayerExpReplace all for it:```Private Sub HandlePlayerExp(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim i As LongDim TNL As Long  ' If debug mode, handle error then exit out  If Options.Debug = 1 Then On Error GoTo errorhandler  Set Buffer = New clsBuffer  Buffer.WriteBytes Data()  SetPlayerExp MyIndex, Buffer.ReadLong  TNL = Buffer.ReadLong  frmMain.lblEXP.Caption = GetPlayerExp(Index) & "/" & TNL  ' mp bar  frmMain.imgEXPBar.width = ((GetPlayerExp(MyIndex) / EXPBar_Width) / (TNL / EXPBar_Width)) * EXPBar_Width  ' Error handler  Exit Suberrorhandler:  HandleError "HandlePlayerExp", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext  Err.Clear  Exit SubEnd Sub```In Party_ShareExpReplace all for it:```Public Sub Party_ShareExp(ByVal partyNum As Long, ByVal exp As Long, ByVal Index As Long, ByVal mapnum As Long)Dim expShare As Long, leftOver As Long, i As Long, tmpIndex As Long, LoseMemberCount As Byte  ' check if it's worth sharing  If Not exp >= Party(partyNum).MemberCount Then    ' no party - keep exp for self    GivePlayerEXP Index, exp    Exit Sub  End If  ' check members in outhers maps  For i = 1 To MAX_PARTY_MEMBERS    tmpIndex = Party(partyNum).Member(i)    If tmpIndex > 0 Then      If IsConnected(tmpIndex) And IsPlaying(tmpIndex) Then        If GetPlayerMap(tmpIndex) <> mapnum Then          LoseMemberCount = LoseMemberCount + 1        End If      End If    End If  Next i  ' find out the equal share  expShare = exp \ (Party(partyNum).MemberCount - LoseMemberCount)  leftOver = exp Mod (Party(partyNum).MemberCount - LoseMemberCount)  ' loop through and give everyone exp  For i = 1 To MAX_PARTY_MEMBERS    tmpIndex = Party(partyNum).Member(i)    ' existing member?Kn    If tmpIndex > 0 Then      ' playing?      If IsConnected(tmpIndex) And IsPlaying(tmpIndex) Then        If GetPlayerMap(tmpIndex) = mapnum Then          ' give them their share          GivePlayerEXP tmpIndex, expShare        End If      End If    End If  Next  ' give the remainder to a random member  tmpIndex = Party(partyNum).Member(RAND(1, Party(partyNum).MemberCount))  ' give the exp  GivePlayerEXP tmpIndex, leftOverEnd Sub```In HandleAcceptTradeRequestReplace all for it:```Sub HandleAcceptTradeRequest(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim tradeTarget As LongDim i As Long  If TempPlayer(index).InTrade > 0 Then    TempPlayer(index).TradeRequest = 0  Else    tradeTarget = TempPlayer(index).TradeRequest    ' let them know they're trading    PlayerMsg index, "You have accepted " & Trim$(GetPlayerName(tradeTarget)) & "'s trade request.", BrightGreen    PlayerMsg tradeTarget, Trim$(GetPlayerName(index)) & " has accepted your trade request.", BrightGreen    ' clear the tradeRequest server-side    TempPlayer(index).TradeRequest = 0    TempPlayer(tradeTarget).TradeRequest = 0    ' set that they're trading with each other    TempPlayer(index).InTrade = tradeTarget    TempPlayer(tradeTarget).InTrade = index    ' clear out their trade offers    For i = 1 To MAX_INV      TempPlayer(index).TradeOffer(i).Num = 0      TempPlayer(index).TradeOffer(i).Value = 0      TempPlayer(tradeTarget).TradeOffer(i).Num = 0      TempPlayer(tradeTarget).TradeOffer(i).Value = 0    Next    ' Used to init the trade window clientside    SendTrade index, tradeTarget    SendTrade tradeTarget, index    ' Send the offer data - Used to clear their client    SendTradeUpdate index, 0    SendTradeUpdate index, 1    SendTradeUpdate tradeTarget, 0    SendTradeUpdate tradeTarget, 1  End IfEnd Sub```In HandleAcceptTrade:Replace all for it:```Sub HandleAcceptTrade(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)  Dim tradeTarget As Long  Dim i As Long  Dim tmpTradeItem(1 To MAX_INV) As PlayerInvRec  Dim tmpTradeItem2(1 To MAX_INV) As PlayerInvRec  Dim itemnum As Long  TempPlayer(index).AcceptTrade = True  tradeTarget = TempPlayer(index).InTrade  If tradeTarget > 0 Then    ' if not both of them accept, then exit    If Not TempPlayer(tradeTarget).AcceptTrade Then      SendTradeStatus index, 2      SendTradeStatus tradeTarget, 1      Exit Sub    End If    ' take their items    For i = 1 To MAX_INV      ' player      If TempPlayer(index).TradeOffer(i).Num > 0 Then        itemnum = Player(index).Inv(TempPlayer(index).TradeOffer(i).Num).Num        If itemnum > 0 Then          ' store temp          tmpTradeItem(i).Num = itemnum          tmpTradeItem(i).Value = TempPlayer(index).TradeOffer(i).Value          ' take item          TakeInvSlot index, TempPlayer(index).TradeOffer(i).Num, tmpTradeItem(i).Value        End If      End If      ' target      If TempPlayer(tradeTarget).TradeOffer(i).Num > 0 Then        itemnum = GetPlayerInvItemNum(tradeTarget, TempPlayer(tradeTarget).TradeOffer(i).Num)        If itemnum > 0 Then          ' store temp          tmpTradeItem2(i).Num = itemnum          tmpTradeItem2(i).Value = TempPlayer(tradeTarget).TradeOffer(i).Value          ' take item          TakeInvSlot tradeTarget, TempPlayer(tradeTarget).TradeOffer(i).Num, tmpTradeItem2(i).Value        End If      End If    Next    ' taken all items. now they can't not get items because of no inventory space.    For i = 1 To MAX_INV      ' player      If tmpTradeItem2(i).Num > 0 Then        ' give away!        GiveInvItem index, tmpTradeItem2(i).Num, tmpTradeItem2(i).Value, False      End If      ' target      If tmpTradeItem(i).Num > 0 Then        ' give away!        GiveInvItem tradeTarget, tmpTradeItem(i).Num, tmpTradeItem(i).Value, False      End If    Next    SendInventory index    SendInventory tradeTarget    ' they now have all the items. Clear out values + let them out of the trade.    For i = 1 To MAX_INV      TempPlayer(index).TradeOffer(i).Num = 0      TempPlayer(index).TradeOffer(i).Value = 0      TempPlayer(tradeTarget).TradeOffer(i).Num = 0      TempPlayer(tradeTarget).TradeOffer(i).Value = 0    Next    TempPlayer(index).InTrade = 0    TempPlayer(tradeTarget).InTrade = 0    PlayerMsg index, "Trade completed.", BrightGreen    PlayerMsg tradeTarget, "Trade completed.", BrightGreen    SendCloseTrade index    SendCloseTrade tradeTarget  End IfEnd Sub```In HandleDeclineTrade:Replace all for it:```Sub HandleDeclineTrade(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim i As LongDim tradeTarget As Long  tradeTarget = TempPlayer(index).InTrade  If tradeTarget > 0 Then    For i = 1 To MAX_INV      TempPlayer(index).TradeOffer(i).Num = 0      TempPlayer(index).TradeOffer(i).Value = 0      TempPlayer(tradeTarget).TradeOffer(i).Num = 0      TempPlayer(tradeTarget).TradeOffer(i).Value = 0    Next    TempPlayer(index).InTrade = 0    TempPlayer(tradeTarget).InTrade = 0    PlayerMsg index, "You declined the trade.", BrightRed    PlayerMsg tradeTarget, GetPlayerName(index) & " has declined the trade.", BrightRed    SendCloseTrade index    SendCloseTrade tradeTarget  End IfEnd Sub```Crédits: Terabin & Marlos Gama Link to comment Share on other sites More sharing options...
Robin Posted December 31, 2011 Share Posted December 31, 2011 Very useful. Still, why didn't you report these bugs you come across? I can't fix something I don't know about. I can only do so much testing myself. The community is pretty much the testing team. Link to comment Share on other sites More sharing options...
terabin Posted December 31, 2011 Author Share Posted December 31, 2011 haha, sorry, I thought the engine was abandoned.most errors occur after the engine is put online for everyone. Link to comment Share on other sites More sharing options...
Robin Posted December 31, 2011 Share Posted December 31, 2011 Well yes. That's the part which is least tested. I rely on the community to test things and when no one makes a game which is even remotely successful it leaves entire features completely untested. Link to comment Share on other sites More sharing options...
erkro1 Posted December 31, 2011 Share Posted December 31, 2011 Can you add a list with the bugs it'll fix? Link to comment Share on other sites More sharing options...
terabin Posted December 31, 2011 Author Share Posted December 31, 2011 Added Link to comment Share on other sites More sharing options...
Whackeddie99 Posted January 1, 2012 Share Posted January 1, 2012 the exp bar only works for first player?!?!?!?! Link to comment Share on other sites More sharing options...
mrmiguu Posted January 1, 2012 Share Posted January 1, 2012 @Whack:> the exp bar only works for first player?!?!?!?!It used to. /awesomeface Link to comment Share on other sites More sharing options...
Whackeddie99 Posted January 1, 2012 Share Posted January 1, 2012 wait so…on eo2.0 the exp bar ONLY works for 1st player, unless i use this...And Miguu, you need to release updates for PVO Now!!! Link to comment Share on other sites More sharing options...
Justn Posted January 7, 2012 Share Posted January 7, 2012 Wow thanks for sharing. Can anyone else confirm if these are actual bug fixes?edit: Or can someone tell me what was changed in the handle party subs? Link to comment Share on other sites More sharing options...
Jumpahead Posted January 28, 2012 Share Posted January 28, 2012 Nice. Thanks :) Link to comment Share on other sites More sharing options...
Zopto Posted January 28, 2012 Share Posted January 28, 2012 tnx!! Link to comment Share on other sites More sharing options...
mrmiguu Posted February 16, 2012 Share Posted February 16, 2012 Something in the _Party_ShareExp_ sub is funky; my server doesn't want to compile. Any calls to it are considered "not optional.":EDIT:I realized that you forgot to patch all the calls to the sub to suit the new parameter: _mapnum_. Link to comment Share on other sites More sharing options...
Justn Posted February 16, 2012 Share Posted February 16, 2012 @MrMiguu:> Something in the _Party_ShareExp_ sub is funky; my server doesn't want to compile. Any calls to it are considered "not optional."I have the same problem everything else seems ok=/ Link to comment Share on other sites More sharing options...
Whackeddie99 Posted July 2, 2012 Share Posted July 2, 2012 Sorry for the necro, but the HandlePlayerExp fix - isn't it exactly the same as in EOv2?I seem to have been having problems with the exp bar not working for players, but after I add that in, the actual bar fills, but it just always says I have 0 exp. Link to comment Share on other sites More sharing options...
Justn Posted July 2, 2012 Share Posted July 2, 2012 Maybe change the GetPlayerExp(index) to (myindex) for the caption like it is for the bar? Link to comment Share on other sites More sharing options...
Whackeddie99 Posted July 2, 2012 Share Posted July 2, 2012 @Justn:> Maybe change the GetPlayerExp(index) to (myindex) for the caption like it is for the bar?Yeah just saw that, thanks. Did you ever figure out what was wrong with Party_shareExp? Link to comment Share on other sites More sharing options...
Justn Posted July 2, 2012 Share Posted July 2, 2012 No never went back to it after I posted about it was busy doing other stuff I'm gonna try it out now I don't even remember what the error was now :/ Link to comment Share on other sites More sharing options...
Whackeddie99 Posted July 2, 2012 Share Posted July 2, 2012 @Justn:> No never went back to it after I posted about it was busy doing other stuff I'm gonna try it out now I don't even remember what the error was now :/Miguu says he didn't edit all the places with Party_ShareExp called, so I found them in PlayerAttackPlayer and PlayerAttackNpc, you have to add mapnum to the end. But the things is I don't think it would actually work.The main reason I'm posting here is because the server crashes on our game when theres 4 people in a party 1 leaves, and they attack and kill something. I think it's an error with share exp, because it gives RTE 9 and highlights this:```Function GetPlayerExp(ByVal Index As Long) As Long  GetPlayerExp = Player(Index).expEnd Function``` Link to comment Share on other sites More sharing options...
Alerd Posted October 21, 2012 Share Posted October 21, 2012 Something in the _Party_ShareExp_ sub is funky; my server doesn't want to compile. Any calls to it are considered "not optional." any fix? Link to comment Share on other sites More sharing options...
Ertzel Posted October 21, 2012 Share Posted October 21, 2012 For one, this is almost a year old tutorial and could be mass outdated compared to the engine you are using.Also, if you want help you need to give us some more information like, what engine are you using? what part of the Party_ShareExp is highlighted when you run the game from vb6? Did you make any extra changes not in the tutorial? Link to comment Share on other sites More sharing options...
Alerd Posted October 21, 2012 Share Posted October 21, 2012 This bug fix for eo 2.0 i have same version ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) Link to comment Share on other sites More sharing options...
Valentine90 Posted October 21, 2012 Share Posted October 21, 2012 These corrections were made by me and Terabin long ago and are outdated, use the corrections of my new threads, I redid a better way. Link to comment Share on other sites More sharing options...
Alerd Posted October 21, 2012 Share Posted October 21, 2012 Wat name this new thread 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