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

[EO] Visual Party


Yxxe
 Share

Recommended Posts

Well I coded this a few days ago for OTLR, and decided it could be useful to someone else in the future, so I'll share the code with you, and tell you what to do with it. It basically opens a little window and tells you who is in your party and what level they are. Its fairly simple, but I like it. I may in future release the code for parties with more than two members.

This is what it should look like by the time you have finished this tutorial:

![](http://i801.photobucket.com/albums/yy294/Adrammelech_2009/partytutimg1.png)

**Server Side:**

Go to modGameLogic, and paste these two subs at the bottom of it:

```
Sub UpdatePartyData(ByVal Leader As Long, ByVal Member As Long)
Dim buffer As clsBuffer
Dim LeaderName As String, MemberName As String, LeaderLv As String, MemberLv As String

    LeaderName = GetPlayerName(Leader)
    LeaderLv = GetPlayerLevel(Leader)
    MemberName = GetPlayerName(Member)
    MemberLv = GetPlayerLevel(Member)

    Set buffer = New clsBuffer

    buffer.WriteLong SSendPartyMembers
    buffer.WriteString LeaderName
    buffer.WriteString LeaderLv
    buffer.WriteString MemberName
    buffer.WriteString MemberLv

    'send to member
    SendDataTo Member, buffer.ToArray()
    Set buffer = Nothing

    Set buffer = New clsBuffer
    buffer.WriteLong SSendPartyMembers

    buffer.WriteString LeaderName
    buffer.WriteString LeaderLv
    buffer.WriteString MemberName
    buffer.WriteString MemberLv
    'send to leader
    SendDataTo Leader, buffer.ToArray()

    Set buffer = Nothing
End Sub

Sub PartyEnd(ByVal Leader As Long, ByVal Member As Long)
Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteLong SPartyEnd

'send to leader
SendDataTo Leader, buffer.ToArray()

Set buffer = Nothing

Set buffer = New clsBuffer

buffer.WriteLong SPartyEnd
'send to member
SendDataTo Member, buffer.ToArray()

Set buffer = Nothing
End Sub
```
Next, go to modHandleData, and find "Sub HandleJoinParty" and find this bit of code:

```
' Check to make sure that each of there party players match
            If TempPlayer(n).PartyPlayer = Index Then
                Call PlayerMsg(Index, "You have joined " & GetPlayerName(n) & "'s party!", BrightGreen)
                Call PlayerMsg(n, GetPlayerName(Index) & " has joined your party!", BrightGreen)
                TempPlayer(Index).InParty = YES
                TempPlayer(n).InParty = YES
```
Under that, paste this:

```
Call UpdatePartyData(n, Index)
```
Next, stay in modHandleData and go to the next sub, "Sub HandleLeaveParty"
Replace your "Sub HandleLeaveParty" with this:

```
Sub HandleLeaveParty(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    n = TempPlayer(Index).PartyPlayer

    If n > 0 Then
        If TempPlayer(Index).InParty = YES Then
            Call PlayerMsg(Index, "You have left the party.", BrightBlue)
            Call PlayerMsg(n, GetPlayerName(Index) & " has left the party.", BrightBlue)
            TempPlayer(Index).PartyPlayer = 0
            TempPlayer(Index).PartyStarter = NO
            TempPlayer(Index).InParty = NO
            TempPlayer(n).PartyPlayer = 0
            TempPlayer(n).PartyStarter = NO
            TempPlayer(n).InParty = NO

            Call PartyEnd(Index, n)
        Else
            Call PlayerMsg(Index, "Declined party request.", BrightGreen)
            Call PlayerMsg(n, GetPlayerName(Index) & " declined your request.", BrightGreen)
            TempPlayer(Index).PartyPlayer = 0
            TempPlayer(Index).PartyStarter = NO
            TempPlayer(Index).InParty = NO
            TempPlayer(n).PartyPlayer = 0
            TempPlayer(n).PartyStarter = NO
            TempPlayer(n).InParty = NO

            Call PartyEnd(Index, n)
        End If

    Else
        Call PlayerMsg(Index, "You are not in a party!", BrightRed)
    End If

End Sub
```
After that, go to ModPlayer and search for "Sub LeftGame" and find this If statement:
```
If TempPlayer(Index).InParty = YES Then
            n = TempPlayer(Index).PartyPlayer
            Call PlayerMsg(n, GetPlayerName(Index) & " has left " & Options.Game_Name & ", disbanning party.", BrightBlue)
            TempPlayer(n).InParty = NO
            TempPlayer(n).PartyPlayer = 0
        End If
```
Add this just before the "End If":

```
Call PartyEnd(n, Index)
```
Lastly, go to modEnumerations and add this just above "SMSG_COUNT" in Public Enum ServerPackets:

```
'Party Packets
    SSendPartyMembers
    SPartyEnd
```
That is all for the server side!

**Client Side:**

Open your frmMainGame and make a PictureBox. Call it "imgPartyData". Make its dimensions 91 pixels in height and 123 pixels in width.

Next, make three labels on the picturebox, the first called "lblLeader", the second called "lblMember" and the last call "lblLeave".

Next, go into the "lblLeave_Click" event and paste in this line of code:

```
SendLeaveParty
```
After you have done this, open up your "modHandleData" module, and find "Public Sub InitMessages". Paste these at the bottom of this sub:

```
'Visual Party Subs
    HandleDataSub(SSendPartyMembers) = GetAddress(AddressOf HandleSendPartyMembers)
    HandleDataSub(SPartyEnd) = GetAddress(AddressOf HandlePartyEnd)
```
After you have done this, paste these two subs at the bottom of your modHandleData:

```
Private Sub HandleSendPartyMembers(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim LeaderName As String, MemberName As String, LeaderLv As String, MemberLv As String
Dim buffer As clsBuffer

Set buffer = New clsBuffer
buffer.WriteBytes Data()

LeaderName = buffer.ReadString
LeaderLv = buffer.ReadString
MemberName = buffer.ReadString
MemberLv = buffer.ReadString

With frmMainGame
    .lblLeader.Caption = LeaderName & ", Lv: " & LeaderLv
    .lblMember.Caption = MemberName & ", Lv: " & MemberLv
    .imgPartyData.Left = 568
    .imgPartyData.Top = 427

    .txtMyChat.width = 349
    .txtChat.width = 349
    .imgPartyData.Visible = True
End With

Set buffer = Nothing
End Sub

Private Sub HandlePartyEnd(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim buffer As clsBuffer

Set buffer = New clsBuffer
buffer.WriteBytes Data()

With frmMainGame
    .imgPartyData.Visible = False
    .txtMyChat.width = 478
    .txtChat.width = 478
End With

Set buffer = Nothing
End Sub
```
Finally, go to modEnumerations and add this just above "SMSG_COUNT" in Public Enum ServerPackets:

```
'Party Packets
    SSendPartyMembers
    SPartyEnd
```
**And thats it!**

I hope that wasn't too difficult to understand (it's my first tutorial). If you find any problems, don't hesistate to ask. If you are going to use this, credit would be appreciated, but not required.

Regards,

Lightning
Link to comment
Share on other sites

@Ertzel:

> This works great, thx for making this tutorial. I did everything you did just changed it to showing the other members Health instead of Level.

Not a problem, there is only one small thing I noticed (after i posted) which I haven't added which will be added later, so it is all complete.
Link to comment
Share on other sites

Added this: Server Side:

Go to ModPlayer and search for "Sub LeftGame" and find this If statement:
```
If TempPlayer(Index).InParty = YES Then
            n = TempPlayer(Index).PartyPlayer
            Call PlayerMsg(n, GetPlayerName(Index) & " has left " & Options.Game_Name & ", disbanning party.", BrightBlue)
            TempPlayer(n).InParty = NO
            TempPlayer(n).PartyPlayer = 0
        End If
```
Add this just before the "End If":

```
Call PartyEnd(n, Index)
```
Link to comment
Share on other sites

@Urame:

> Looks pretty good! Could easily be modified to suit someone's needs, should be useful for a lot of Eclipse users ^^

Thanks!
I thought that too, there are a few I can think of now, HP, MP, EXP etc.

@Urame:

> Darn! I was too slow in coding something similar and posting it xD

;D sorry!
Link to comment
Share on other sites

@Ertzel:

> One problem I found is when u leave a party it doesn't clear the party window, it still shows the other persons and your own Name/level even once your not in a party with them.

Added in the new fix. It did disappear if you typed "/leave" or clicked the leave button, however, it didn't if you just left the game. Look a couple of posts up, you only have to call the EndParty procedure again.

-Lightning
Link to comment
Share on other sites

I was leaving the party by clicking the leave label, not logging out. It only closes the party window, it doesn't erase the text from the labels.

If u just add
```
    .lblLeader.Caption = vbNullString
    .lblMember.Caption = vbNullString
```
To the EndParty thing under .imgPartyData.Visible = False
then it updates the labels and take away the names.
Link to comment
Share on other sites

@Ertzel:

> I was leaving the party by clicking the leave label, not logging out. It only closes the party window, it doesn't erase the text from the labels.
>
> If u just add
> ```
>     .lblLeader.Caption = vbNullString
>     .lblMember.Caption = vbNullString
> ```
> To the EndParty thing under .imgPartyData.Visible = False
> then it updates the labels and take away the names.

But if it isn't visible, then it doesn't really matter, does it? =P
Especially since on joining a party, it updates the labels _before_ the party menu becomes visible.

~Urame
Link to comment
Share on other sites

@Ertzel:

> I guess its just more of a personal fix then :P I have it so pressing "P" opens/closes the party window, so it can be open when ur not in a party.

Sounds good, might do something like that later, its all I need for OTLR at the moment, but if I come up with something else, I will probably add it to the tutorial.
Link to comment
Share on other sites

@Ertzel:

> I guess its just more of a personal fix then :P I have it so pressing "P" opens/closes the party window, so it can be open when ur not in a party.

Ah, makes sense then.
Although, if it were me, I'd make it so it'd only show up if you were in a party, but yeah xD

~Urame
Warning - while you were typing a new reply has been posted. You may wish to review your post.
@Lightning:

> @Ertzel:
>
> > I guess its just more of a personal fix then :P I have it so pressing "P" opens/closes the party window, so it can be open when ur not in a party.
>
> Sounds good, might do something like that later, its all I need for OTLR at the moment, but if I come up with something else, I will probably add it to the tutorial.

Don't release too many things, or nothing in your game will be original xD
Link to comment
Share on other sites

@Urame:

> @Lightning:
>
> > Sounds good, might do something like that later, its all I need for OTLR at the moment, but if I come up with something else, I will probably add it to the tutorial.
>
> Don't release too many things, or nothing in your game will be original xD

Parties arent exactly original in an MMO as it is, so why not? I can't think of many other things to add, and would say none of them are exactly original.
Link to comment
Share on other sites

@Lightning:

> @Urame:
>
> > @Lightning:
> >
> > > Sounds good, might do something like that later, its all I need for OTLR at the moment, but if I come up with something else, I will probably add it to the tutorial.
> >
> > Don't release too many things, or nothing in your game will be original xD
>
> Parties arent exactly original in an MMO as it is, so why not? I can't think of many other things to add, and would say none of them are exactly original.

Ehh, I was going for more of in-general, not necessarily parties. And a visual party system is pretty original in Eclipse, definitely not in MMOs, but in Eclipse =P

~Urame
Link to comment
Share on other sites

@Urame:

> Ehh, I was going for more of in-general, not necessarily parties. And a visual party system is pretty original in Eclipse, definitely not in MMOs, but in Eclipse =P
>
> ~Urame

I completely agree. I have considered releasing other tutorials such as my Life Skills system in the past, but decided against it.
Link to comment
Share on other sites

With the way this is made its also really easy for people to add the option to have more people in there parties to fit there game. Im working on making parties old 10 people right now, only kindda hard party about it will be the way I'm trying to setup the imgPartyData to change sizes depending on the amount of people in a party so if u only have 2 people its not showing a huge box for 10 labels :P

Thx for this base party system though cuz I had no idea how I was gunna try and add parties in before but this is the exact way I wanted it to work :P
Link to comment
Share on other sites

@Ertzel:

> With the way this is made its also really easy for people to add the option to have more people in there parties to fit there game. Im working on making parties old 10 people right now, only kindda hard party about it will be the way I'm trying to setup the imgPartyData to change sizes depending on the amount of people in a party so if u only have 2 people its not showing a huge box for 10 labels :P
>
> Thx for this base party system though cuz I had no idea how I was gunna try and add parties in before but this is the exact way I wanted it to work :P

What you _could_ do, is have 5 buttons on the top, and each would show a different part of the menu via click, each menu containing two player's info, or have less buttons and holding more player's info. That way you can keep the menu smaller and still have it be as useful =P
@Lightning:

> @Urame:
>
> > Ehh, I was going for more of in-general, not necessarily parties. And a visual party system is pretty original in Eclipse, definitely not in MMOs, but in Eclipse =P
> >
> > ~Urame
>
> I completely agree. I have considered releasing other tutorials such as my Life Skills system in the past, but decided against it.

Nice choice on that, can't let people get too lazy, not having to code anything for themselves, especially something like that which would help them get used to editing different parts of the source xP

Again, nice edit, and also as for the tutorial, don't worry about clearness, yours is about as clear as it gets =P
~Urame
Link to comment
Share on other sites

@Vitin:

> Nice edit pretty original for eclipse.But only 2 people in a party?

On-Topic:
Origins only allows two people in a party, that's how it works, so it's not something with this code.
Off-Topic:
Vitin, you sit _in-between_ your chair and your pc? That's unusual…Most people sit on their chair...xP
~Urame
Link to comment
Share on other sites

Thanks for all the positive feedback everyone! Like I said before, many things could be added or modified, and I am glad that people are modifying it slightly to match the needs of their game.

@Ertzel: For more than 2 members you would have to re-code the party system quite a bit. Once you have done that, modifying the visual party code to fit with more than 2 members should be too difficult for you.  :azn:
Link to comment
Share on other sites

@Lightning:

> @Ertzel: For more than 2 members you would have to re-code the party system quite a bit.

Ahh, I never looked at EO's party stuff, didn't know it only allows 2 people  :sad: gunna have to see if I can figure out how to make it work with 10 people :P
Link to comment
Share on other sites

@Ertzel:

> @Lightning:
>
> > @Ertzel: For more than 2 members you would have to re-code the party system quite a bit.
>
> Ahh, I never looked at EO's party stuff, didn't know it only allows 2 people  :sad: gunna have to see if I can figure out how to make it work with 10 people :P

I'll probably have a go at letting 4 or 5 members into a party over the next week if I have time. If I get it done and you get stuck don't be scared to ask ;)
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...