Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Guild System
#1
[Image: guild1ot4.png]

Edit: Fixed the font colors. As the leader of the guild, you'll get this text color on the guild:
[Image: guild2rp3.png]
Don't tell me that aint respect Wink

And for those who are interested in some of the code xD I thouhgt it would be a lot less code at the begining.

Code:
Private Sub HandleSMsgLeaveGuild(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim i As Byte

  For i = 1 To MAX_GUILD_MEMBERS
    If GetVar(App.Path & "\accounts\GuildMembers.ini", Player(Index).Char(Player(Index).CharNum).GuildName, "GuildMember" & i) = GetPlayerName(Index) Then
        Call PutVar(App.Path & "\accounts\GuildMembers.ini", Player(Index).Char(Player(Index).CharNum).GuildName, "GuildMember" & i, "")
        Exit For
    End If
  Next i
  
  Player(Index).Char(Player(Index).CharNum).GuildName = vbNullString
  Player(Index).Char(Player(Index).CharNum).GuildAccess = 0
  
  For i = 1 To MAX_GUILD_MEMBERS
    Player(Index).Char(Player(Index).CharNum).GuildMembers(i) = vbNullString
  Next i
  Call SendGuildInfo(Index)
End Sub

Private Sub HandleSMsgKickMember(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim i As Byte, N As Byte
Dim Buffer() As Byte
Dim Name As String

  Buffer = FillBuffer(StartAddr, ByteLen)
  Name = GetStringFromBuffer(Buffer, True)
  
  N = FindPlayer(Name)
  For i = 1 To MAX_GUILD_MEMBERS
    If GetVar(App.Path & "\accounts\GuildMembers.ini", Player(N).Char(Player(N).CharNum).GuildName, "GuildMember" & i) = GetPlayerName(N) Then
        Call PutVar(App.Path & "\accounts\GuildMembers.ini", Player(N).Char(Player(N).CharNum).GuildName, "GuildMember" & i, "")
        Exit For
    End If
  Next i
  
  Player(N).Char(Player(N).CharNum).GuildName = vbNullString
  Player(N).Char(Player(N).CharNum).GuildAccess = 0
  
  For i = 1 To MAX_GUILD_MEMBERS
    Player(N).Char(Player(N).CharNum).GuildMembers(i) = vbNullString
  Next i
  Call SendGuildInfo(N)
End Sub

Private Sub HandleSMsgRecruit(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim i As Byte, N As Byte
Dim Buffer() As Byte
Dim Name As String, Access As Byte

  Buffer = FillBuffer(StartAddr, ByteLen)
  Name = GetStringFromBuffer(Buffer, True)
  Access = GetByteFromBuffer(Buffer, True)
  
  If Access = 0 Or Access = 1 Or Access = 2 Then
  Else
    Call PlayerMsg(Index, "The access can only be 0,1 and 2.", 0)
    Exit Sub
  End If
  
  If FindPlayer(Name) > 0 Then
    N = FindPlayer(Name)
  Else
    Call PlayerMsg(Index, "Player is not online or doesn't exist.", 0)
    Exit Sub
  End If
  
  If Player(N).Char(Player(N).CharNum).GuildName  vbNullString Then
    Call PlayerMsg(Index, "The player is already in a guild", 0)
    Exit Sub
  End If
  
  Player(N).Char(Player(N).CharNum).GuildName = Player(Index).Char(Player(Index).CharNum).GuildName
  Player(N).Char(Player(N).CharNum).GuildAccess = Access
  
  For i = 1 To MAX_GUILD_MEMBERS
    If GetVar(App.Path & "\accounts\GuildMembers.ini", Player(N).Char(Player(N).CharNum).GuildName, "GuildMember" & i) = vbNullString Then
      Call PutVar(App.Path & "\accounts\GuildMembers.ini", Player(N).Char(Player(N).CharNum).GuildName, "GuildMember" & i, GetPlayerName(N))
        Exit For
    End If
  Next i
  
  For i = 1 To MAX_GUILD_MEMBERS
    Player(N).Char(Player(N).CharNum).GuildMembers(i) = GetVar(App.Path & "\accounts\GuildMembers.ini", Player(N).Char(Player(N).CharNum).GuildName, "GuildMember" & i)
    'If i = MAX_GUILD_MEMBERS Then
    '    Call PlayerMsg(Index, "The guild is full. If you get this, there is a serious bug with the guild system..", 0)
    'End If
  Next i
  Call SendGuildInfo(N)
End Sub

Private Sub HandleSMsgRequestGuild(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim Buffer() As Byte
Dim Name As String
Dim f As Long

  Buffer = FillBuffer(StartAddr, ByteLen)
  Name = GetStringFromBuffer(Buffer, True)
  
  If Player(Index).Char(Player(Index).CharNum).GuildName  vbNullString Then
    Call PlayerMsg(Index, "Your already in a guild.", 0)
    Exit Sub
  End If
  
  If Not FindGuild(Name) Then
    f = FreeFile
    Open App.Path & "\accounts\guild.txt" For Append As #f
        Print #f, Name
    Close #f
  Else
    Call PlayerMsg(Index, "That guild already exists.", 0)
  End If
  
  
  Player(Index).Char(Player(Index).CharNum).GuildName = Name
  Player(Index).Char(Player(Index).CharNum).GuildAccess = 2
  
  Dim i As Byte
  For i = 1 To MAX_GUILD_MEMBERS
    If Player(Index).Char(Player(Index).CharNum).GuildMembers(i) = vbNullString Then
        Player(Index).Char(Player(Index).CharNum).GuildMembers(i) = GetPlayerName(Index)
        Call PutVar(App.Path & "\accounts\GuildMembers.ini", Name, "GuildMember" & 1, Player(Index).Char(Player(Index).CharNum).GuildMembers(1))
        Exit For
    End If
    If i = MAX_GUILD_MEMBERS Then
        Call PlayerMsg(Index, "The guild is full. If you get this, there is a serious bug with the guild system..", 0)
    End If
  Next i
  
  Call SendGuildInfo(Index)
End Sub

Sub SendGuildInfo(ByVal Index As Long)
Dim Packet As String, i As Byte, N As Byte, VarP As String
    Packet = "GUILDINFO" & SEP_CHAR & Player(Index).Char(Player(Index).CharNum).GuildName & SEP_CHAR & Player(Index).Char(Player(Index).CharNum).GuildAccess
    
    If Player(Index).Char(Player(Index).CharNum).GuildName  vbNullString Then
        For i = 1 To MAX_GUILD_MEMBERS
            Packet = Packet & SEP_CHAR & GetVar(App.Path & "\accounts\GuildMembers.ini", Player(Index).Char(Player(Index).CharNum).GuildName, "GuildMember" & i)
        Next i
    Else
        For i = 1 To MAX_GUILD_MEMBERS
            Packet = Packet & SEP_CHAR & ""
        Next i
    End If
    
    If Player(Index).Char(Player(Index).CharNum).GuildName  vbNullString Then
        For i = 1 To MAX_GUILD_MEMBERS
            VarP = GetVar(App.Path & "\accounts\GuildMembers.ini", Player(Index).Char(Player(Index).CharNum).GuildName, "GuildMember" & 0 + i)
            frmServer.labelDD.Caption = frmServer.labelDD.Caption & "|" & VarP & "-" & FindPlayer(VarP)
            If FindPlayer(VarP) > 0 And VarP  vbNullString Then
                N = FindPlayer(VarP)
    
                If IsPlaying(N) = True Then
                    Packet = Packet & SEP_CHAR & 1
                Else
                    Packet = Packet & SEP_CHAR & 0
                End If
            Else
                Packet = Packet & SEP_CHAR & 0
            End If
        Next i
    Else
        For i = 1 To MAX_GUILD_MEMBERS
            Packet = Packet & SEP_CHAR & ""
        Next i
    End If

    Packet = Packet & SEP_CHAR & END_CHAR
    Call SendDataTo(Index, Packet)
End Sub
And god, a lot of things can be optimized. xD But now it all works..
Reply
#2
I see you got rid of the 3D borders on the text boxes. Tongue Looks good.

The text size is a bit small for my screen resolution though, can barely read it. Lol.

Ain't you the one that has it to where you can change the font size though?
Reply
#3
The chat font can be changed. If you are refering to the name and guild above the character. I will increase that size.
Reply
#4
William Wrote:The chat font can be changed. If you are refering to the name and guild above the character. I will increase that size.

I was referring to the map font. ^_^

It don't need to be too much bigger, maybe a size or two.
Reply
#5
Yeah, I pretty much finished the whole guild system now. Only took me about 3-4 hours xD

[Image: guild3hb1.png]
Reply
#6
Paged..? That seems a little.. modern..?
Reply
#7
Well what should I use instead? whispered?

Paged seems good for some reason.
Reply
#8
William Wrote:Well what should I use instead? whispered?

Paged seems good for some reason.

Paged just seems too modern. Whispered, Tells, something of that sort.

Or get creative or something, "So and so magically tells you: Hey".

There's a lot of different things you could use. You just need to use your imagination.
Reply
#9
I just want it short and simple, until someone has some imagination for me, I'll stick with Pages xD
Reply
#10
William Wrote:I just want it short and simple, until someone has some imagination for me, I'll stick with Pages xD

Well, Pages is incorrect in so many ways. You couldn't page someone until like the early 90's, maybe late 80's.

I'm sure, by graphics and such, your game takes place in at most, the 14th century. In which case, they could only use magic to tell someone something instantly when they're no where near each other, or use messengers to carry the message to the other person (but that wasn't instant). You got the game this far on your imagination, you can't figure out something better than pages?
Reply
#11
Perfekt Wrote:
William Wrote:I just want it short and simple, until someone has some imagination for me, I'll stick with Pages xD

Well, Pages is incorrect in so many ways. You couldn't page someone until like the early 90's, maybe late 80's.

I'm sure, by graphics and such, your game takes place in at most, the 14th century. In which case, they could only use magic to tell someone something instantly when they're no where near each other, or use messengers to carry the message to the other person (but that wasn't instant). You got the game this far on your imagination, you can't figure out something better than pages?

Because in the 14th century, magic was the most common means of communication!
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#12
Robin Wrote:
Perfekt Wrote:
William Wrote:I just want it short and simple, until someone has some imagination for me, I'll stick with Pages xD

Well, Pages is incorrect in so many ways. You couldn't page someone until like the early 90's, maybe late 80's.

I'm sure, by graphics and such, your game takes place in at most, the 14th century. In which case, they could only use magic to tell someone something instantly when they're no where near each other, or use messengers to carry the message to the other person (but that wasn't instant). You got the game this far on your imagination, you can't figure out something better than pages?

Because in the 14th century, magic was the most common means of communication!

In fantasy novels and such, it was. I'm just trying to give him examples. I didn't mean that it was from that era, genius.
Reply
#13
Hehe, well I guess I could use "Messaged".
Reply
#14
William Wrote:Hehe, well I guess I could use "Messaged".

Messaged would be better than paged. Lol.
Reply
#15
Perfekt Wrote:
William Wrote:Hehe, well I guess I could use "Messaged".

Messaged would be better than paged. Lol.
Yeah, well I guess I change it now then.
Reply
#16
You still haven't added the new text code I sent you.

Aren't you getting sick of having the players names three feet to the right? xD
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#17
Im gonna add, gotta see if I can find that text file.

Edit: Cant find it xD
Reply
#18
I'll re-write the tutorial out later -_-
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#19
Love the screenshots.

Was wondering if you have female sprites? Or if you're going to have female
characters in your game.
Reply
#20
I won't have females, cause I don't feel like pixeling new armors and everything for them, would take too much time.
Reply
#21
I had some help from Grim, but I found it pretty easy to do actually. There was just a few subs that was tricky, that I really had no idea how to do so Grim did those Tongue But 80% of the packets are easy.

Although, I only have it sending from the client to the server.
Reply
#22
Add a "Declare war" button so guilds can publicly declare war on each other Smile

Maybe, also make a battle arena where guilds can war each other without penalties?
Reply
#23
Renegade Wrote:Add a "Declare war" button so guilds can publicly declare war on each other Smile

Maybe, also make a battle arena where guilds can war each other without penalties?
Yeah, I guess that would be fun to have.
Reply
#24
Make it so if one guild declares war on another, if the other guild declares war back; you dont get marked with pk status if u kill each other.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)