Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Jade's Party system


JadeCurt1ss
 Share

Recommended Posts

This is my basic window for picParty

[![](http://img91.imageshack.us/img91/5729/jadespartyexpr1.th.jpg)](http://img91.imageshack.us/my.php?image=jadespartyexpr1.jpg)[![](http://img91.imageshack.us/images/thpix.gif)](http://g.imageshack.us/thpix.php)

lstParty will have the names of your party members that can be added to with a simple lstParty.AddValue. but how then do I subtract something from that list? lstParty.RemoveValue?

The labels will do exactly as they say on the caption: (Though I forgot the textbox that you input the characters name in. Actually… can I call a windowed textbox that i can input text into?)

I have yet to find the "CreateParty" sub... does it exist? Further, what about setting a party leader?

Further what features do parties have at the moment and what needs to be fixed with them?
Link to comment
Share on other sites

Found under the "modClientTCP"```
Sub SendPartyRequest(ByVal Name As String)
    Call SendData("party" & SEP_CHAR & Name & END_CHAR)
End Sub

Sub SendJoinParty()
    Call SendData("joinparty" & END_CHAR)
End Sub

Sub SendLeaveParty()
    Call SendData("leaveparty" & END_CHAR)
End Sub
```
and these… found under the "modGameLogic"```
        ' Party request
        If LCase$(Mid$(MyText, 1, 6)) = "/party" Then
            ' Make sure they are actually sending something
            If Len(MyText) > 7 Then
                ChatText = Mid$(MyText, 8, Len(MyText) - 7)
                Call SendPartyRequest(ChatText)
            Else
                Call AddText("Usage: /party playernamehere", AlertColor)
            End If
            MyText = vbNullString
            Exit Sub
        End If

        ' Join party
        If LCase$(Mid$(MyText, 1, 5)) = "/join" Then
            Call SendJoinParty
            MyText = vbNullString
            Exit Sub
        End If

        ' Leave party
        If LCase$(Mid$(MyText, 1, 6)) = "/leave" Then
            Call SendLeaveParty
            MyText = vbNullString
            Exit Sub
        End If
```
More under "modHandleData"```
    If casestring = "leaveparty211" Then
        For i = 1 To MAX_PARTY_MEMBERS
            Player(MyIndex).Party.Member(i) = 0
        Next i
        Exit Sub
    End If
```
More under "modHandleData"```
    If LCase$(parse(0)) = "removemembers" Then
        For n = 1 To MAX_PARTY_MEMBERS
            Player(MyIndex).Party.Member(n) = 0
        Next n
        Exit Sub
    End If

    If LCase$(parse(0)) = "updatemembers" Then
        Player(MyIndex).Party.Member(Val(parse(1))) = Val(parse(2))
        Exit Sub
    End If
```That's all i see in the EE 2.7 source that has to deal with "Parties"

Also, i believe the commands to add/remove things to/from lists are
```
AddItem
```and```
RemoveItem
```
Link to comment
Share on other sites

This is all the planning stages, I'll post my code once I get enough data from everyone:

Took a peek at the source myself and found that no special designation for "party leader" exists. However, there is an entry into modTypes for it. So I'd need to create a "Party Leader" Packet, and a CreateParty Sub that will set things up, and from there, I can have my lbl's + txtboxes take care of things from there.

Last thing before  record this and go to bed (Test tommorow: needs sleep.)

Can somone explain "If LCase$(parse(0))" To me?
Link to comment
Share on other sites

@JadeCurt1ss:

> This is all the planning stages, I'll post my code once I get enough data from everyone:
>
> Took a peek at the source myself and found that no special designation for "party leader" exists. However, there is an entry into modTypes for it. So I'd need to create a "Party Leader" Packet, and a CreateParty Sub that will set things up, and from there, I can have my lbl's + txtboxes take care of things from there.

Actually, with a little editing, i don't think you need to create another sub for creating a party… just some coding for the "addplayertoparty" button, i would think something along these lines```
Private Sub picAddMem_Click()
If Trim$(txtName.Text) <> vbNullString Then
Msg = Trim$(txtName.Text)
If Len(Trim$(txtName.Text)) < 3 Then
MsgBox "Character name must be at least three characters in length."
Exit Sub
End If
For i = 1 To Len(Msg)
If Asc(Mid$(Msg, i, 1)) < 32 Or Asc(Mid$(Msg, i, 1)) > 255 Then
Call MsgBox("You cannot use high ascii chars in your name, please reenter.", vbOKOnly, GAME_NAME)
txtName.Text = vbNullString
Exit Sub
End If
Next i
Call SendPartyRequest(Msg)
```And after you do that, you should probably remove the stuff relating to```
If LCase(blahblah blah) = "/Party"
```
Link to comment
Share on other sites

Yeah, you got it. It just requires someone to add to an existing party. The way I'm coding it is this:

lblCreateParty will join/add/put you into a party. From there you can invite more people. It also adds your name to the listbox. (I think it needs to be lstParty.Additem. Getplayername (index), 1?)

Add will take text from the textbox and search for that character's name, if he/she is online, he/she will get a party invite. If they accept they will be added into your listbox, and they will add their own name, and the name of any others.

So far, I've got the concept nailed, but I want to create a designated party leader whose name is always on the top listing for the listbox. I need to code that, I also need code for Checking if the text you typed is a player name, if they are online, and if they are already in a party. THEN if They Aren't already,  you can add them.

Is there a way to differentiate party members from one another? I also need to call some sort of data about the party to send to the new member's listbox.

Alright, this is what I'm thinking about so far. Discuss!
Link to comment
Share on other sites

It's ok, nice of you to help out with what you did.

EDIT: I worte out a createparty sub with a friend's help.

This is all server side.

> Added to modTypes:   
>
> 'Most of that was there already, I forgot what I added ^^
> Type PartyRec
>     PartyID As Integer
>     Leader As Byte
>     Member() As Byte
>     ShareExp As Boolean
> End Type
>
> Public Party() As PartyRec
> Public CurrentPartyAmount As Long
>
> In AccountRec
>     PartyID As Long
> 'End of ModTypes additions
>
> In modHandleData
>
> Case "createparty"
>             Call Packet_CreateParty(index)
>             Exit Sub
>
> Public Sub Packet_CreateParty(ByVal index As Long)
> Dim GotParty As Boolean
> Dim PartyCount As Long
> Dim i As Long
>
> Player(index).InParty = False
> If CurrentPartyAmount < 1 Then
>     CurrentPartyAmount = 1
>     ReDim Preserve Party(1 To CurrentPartyAmount) As PartyRec
> End If
>     For i = 1 To CurrentPartyAmount
>         If Party(i).PartyID = 0 Then
>             Player(index).PartyID = i
>             Party(i).PartyID = Player(index).PartyID
>             GotParty = True
>         End If
>     Next
>
> If Player(index).InParty = True Then
>     PartyCount = PartyCount + 1
>     ReDim Preserve Party(1 To PartyCount) As PartyRec
>     Player(index).PartyID = PartyCount
>     Party(PartyCount).PartyID = Player(index).PartyID
> End If
>
> Party(Player(index).PartyID).PartyNum = 0
> Party(Player(index).PartyID).PartyNum = Party(Player(index).PartyID).PartyNum + 1
>
> Party(Player(index).GroupID).PartyLeader = GetPlayerName(index)
> CreateParty = Player(index).PartyID
> Player(index).PartyPlayer = index
>
> End Sub

I'm missing something. I just know it…
Critique this, I'm a novice coder, and she is an intermediate coder.

Some things she wrote that don't make sense to me:

> Party(Player(index).PartyID).PartyNum = 0
> Party(Player(index).PartyID).PartyNum = Party(Player(index).PartyID).PartyNum + 1

Would that be the same as

> Party(Player(index).PartyID).PartyCount = 0
> Party(Player(index).PartyID).PartyCount = Party(Player(index).PartyID).PartyCount+ 1

?

Lastly, this appears to say if you are not in a party, nothing happens, but if you are then you create a new one…

The way she wrote it was confusing.
unnown, you out there!?
Link to comment
Share on other sites

Uhmm, I'm looking at a mostly un-edited server source code… and it does have a slight reference to the person that creates the party..
ServerSide: ModTypes```
    PartyStarter As Byte
    GettingMap As Byte
    Party As PartyRec
    InvitedBy As Byte
```I'll try to search some more into where these are refered to in the server side source… to try and help you a bit ;)
Also, if you just search the whole project source for "party" in vb6, it'll take you through it all(though you can be a bit more specific and search for "partystarter" hehe)
Link to comment
Share on other sites

The only thing "PartyStarter" is used for is on startup, the game checks if you are in a party, or sets you to not be in a party. I think the code we wrote out will work, I just need to edit it a bit with everyone's help.

It needs to set the player making the request as Player(index).Party.Leader…
Link to comment
Share on other sites

No, the party.leader stuff iexists outside the "createparty" sub
ServerSide: modGameLogic```
Public Sub UpdateParty(ByVal Index As Long)
    Player(Index).Party = Player(Player(Index).Party.Leader).Party
End Sub

Public Sub SetPShare(ByVal Index As Long, ByVal share As Boolean)
    Player(Index).Party.ShareExp = share
End Sub

Function GetPLeader(ByVal Index As Long) As Long
    GetPLeader = Player(Index).Party.Leader
End Function

Function GetPMember(ByVal Index As Long, ByVal Member As Long) As Long
    GetPMember = Player(Index).Party.Member(Member)
End Function

Function GetPShare(ByVal Index As Long) As Boolean
    GetPShare = Player(Index).Party.ShareExp
End Function
```
Link to comment
Share on other sites

They are in use, but this makes the code much simpler I think: all it needs to be is

> Public Sub Packet_CreateParty(ByVal Index As Long)
>   Dim i As Long
>     Do While i < MAX_PARTY_MEMBERS
>     If Player(Index).InParty = True Then
>         Call PlayerMsg(Index, "You are already in a party. Leave your party and try again.", PINK)
>     Else:
>         Call SetPMember(i, i + 1)
>         Call PlayerMsg(Index, "You are now in a party. Happy Hunting!", PINK)
> End If
> End Sub

and above it:

Case "createparty"
            Call Packet_CreateParty(index)
            Exit Sub

So now that I've made a createparty packet, how do I get it across to the client?

Edit, I think I have it… In modTCP make a

Sub SendCreateParty()
    Call SendData("createparty" & END_CHAR)
End Sub
Link to comment
Share on other sites

No, the last 3 commands in my other post(GetPLeader, GetPMember, GetPShare) aren't used anywhere in the server-side source…(gah, just had an idea for some party SScripting commands!) You can call those through some of your "Party Options" stuff..

Also, these subs pretty much already have that covered
ServerSide modHandleData
```
Public Sub Packet_Party(ByVal Index As Long, ByVal Name As String)
    Dim PlayerIndex As Long
    Dim PartyCount As Long
    Dim I As Long

    PlayerIndex = FindPlayer(Name)

    If PlayerIndex = 0 Then
        Call PlayerMsg(Index, Name & " is currently offline.", PINK)
        Exit Sub
    End If

    If PlayerIndex = Index Then
        Call PlayerMsg(Index, "You cannot party with yourself!", PINK)
        Exit Sub
    End If

    If Player(Index).InParty Then
        For I = 1 To MAX_PARTY_MEMBERS
            If Player(Index).Party.Member(I) > 0 Then
                PartyCount = PartyCount + 1
            End If
        Next I

        If PartyCount > (MAX_PARTY_MEMBERS - 1) Then
            Call PlayerMsg(Index, "Your party is full!", PINK)
            Exit Sub
        End If
    End If

    If Not Player(PlayerIndex).InParty Then
        Call PlayerMsg(Index, GetPlayerName(PlayerIndex) & " has been invited to your party.", PINK)
        Call PlayerMsg(PlayerIndex, GetPlayerName(Index) & " has invited you to join their party. Type /join to join, or /leave to decline.", PINK)

        Player(PlayerIndex).InvitedBy = Index
    Else
        Call PlayerMsg(Index, "Player is already in a party!", PINK)
    End If
End Sub

Public Sub Packet_JoinParty(ByVal Index As Long)
    Dim PlayerIndex As Long
    Dim I As Long

    PlayerIndex = Player(Index).InvitedBy

    If PlayerIndex > 0 Then
        Call PlayerMsg(Index, "You have joined " & GetPlayerName(PlayerIndex) & "'s party!", PINK)

        If Not Player(PlayerIndex).InParty Then
            Call SetPMember(PlayerIndex, PlayerIndex)
            Player(PlayerIndex).InParty = True
            Call SetPShare(PlayerIndex, True)
        End If

        Player(Index).InParty = True
        Player(Index).Party.Leader = PlayerIndex

        Call SetPMember(PlayerIndex, Index)

        If GetPlayerLevel(Index) + 5 < GetPlayerLevel(PlayerIndex) Or GetPlayerLevel(Index) - 5 > GetPlayerLevel(PlayerIndex) Then
            Call PlayerMsg(Index, "There is more then a 5 level gap between you two, you will not share experience.", PINK)
            Call PlayerMsg(PlayerIndex, "There is more then a 5 level gap between you two, you will not share experience.", PINK)
            Call SetPShare(Index, False)
        Else
            Call SetPShare(Index, True)
        End If

        For I = 1 To MAX_PARTY_MEMBERS
            If Player(Index).Party.Member(I) > 0 Then
                If Player(Index).Party.Member(I) <> Index Then
                    Call PlayerMsg(Player(Index).Party.Member(I), GetPlayerName(Index) & " has joined your party!", PINK)
                End If
            End If
        Next I

        For I = 1 To MAX_PARTY_MEMBERS
            If Player(Index).Party.Member(I) = Index Then
                For PlayerIndex = 1 To MAX_PARTY_MEMBERS
                    Call SendDataTo(PlayerIndex, "updatemembers" & SEP_CHAR & I & SEP_CHAR & Index & END_CHAR)
                Next PlayerIndex
            End If
        Next I

        For I = 1 To MAX_PARTY_MEMBERS
            Call SendDataTo(Index, "updatemembers" & SEP_CHAR & I & SEP_CHAR & Player(Index).Party.Member(I) & END_CHAR)
        Next I
    Else
        Call PlayerMsg(Index, "You have not been invited into a party!", PINK)
    End If
End Sub
```with a few choice edits(calling msgs mostly) it can easily be adapted to your needs.. Especially if your just gonna bring up a message box for the invitee(asking if they want to join the inviter's party)
Link to comment
Share on other sites

I'm still working on the createparty sub. I want confirmation that the party is now existing with me as its first member and leader.

EDIT AGAIN: Bobosk: they are in use in the server, trust me. Search for them, and you'll see they are used extensively in the source. I forgot to put the dim in there xD.
The new pic on frmmirage works nicely, however.

There

> Public Sub Packet_CreateParty(ByVal Index As Long, Name As String)
>   Dim I As Long
>   Dim PlayerIndex As Long
>   PlayerIndex = Player(Index).Char(Player(Index).CharNum).Name
>  
>   For I = 1 And I + 1 = 2 To MAX_PARTY_MEMBERS
>         If Player(PlayerIndex).InParty Then
>         Call PlayerMsg(Index, "You are already in a party. Leave your party and try again.", PINK)
>  
>         If Not Player(PlayerIndex).InParty Then
>             Call SetPMember(PlayerIndex, PlayerIndex)
>             Player(PlayerIndex).InParty = True
>             Call SetPShare(PlayerIndex, True)
>         End If
>
>         Player(Index).InParty = True
>         Player(Index).Party.Leader = PlayerIndex
>        
>         Call PlayerMsg(Index, "You are now the leader of a party. Happy Hunting!", PINK)
>
> End If
> Next I
> End Sub

Rewrote it again, but now whenever I use theis command client side, I get a loss of connection. I think this means I'm getting somewhere. I'll post the Client-side code for everyone.

modHandledata

> If LCase$(parse(0)) = "createparty" Then
>         For n = 1 To MAX_PARTY_MEMBERS
>         Player(MyIndex).Party.Member(n) = 1
>         Player(MyIndex).Party.Leader(n) = 1
>         Next n
>         Exit Sub
>     End If
>     End If

modClientTCP

> Sub SendCreateParty()
>     Call SendData("createparty" & END_CHAR)
> End Sub

That's it.
Link to comment
Share on other sites

Bump:

Anybody got ideas? I'm restarting this topic since my psychology project is finished.

When I click lblCreate, I want the game to do the following: Set Me in a party, Make me the Leader, and put my name in the listbox (lstParty)

I know how to do the listbox part. But what about the rest?
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...