11-08-2007, 01:56 AM
Credit to: Asrrin
Client Side
Ok, Find "Sub SendAddChar"
now add "ByVal kingdom As Long" to the sub title,
should look like
now in modTypes find "Type PlayerRec"
now add under 'general
Now again in modTypes find "Sub ClearPlayer(ByVal Index As Long)"
now under "Player(Index).PK = NO"
add
Now at the VERY bottom of modTypes add these
Now in modGameLogic find "MENU_STATE_ADDCHAR"
now there will be a code like this
Change it to look like this
Now in modGameLogic again find "Sub BltPlayerName(ByVal Index As Long)"
Now change this to.
Or change it how it will work with your game.
Now find "If LCase(Parse(0)) = "playerdata" Then"
now under this "Call SetPlayerPK(i, Val(Parse(9)))"
PUT this
Now on the Form called newchar.frm or whatever. Add a listbox add 2 items to the list Kingdom 1 and Kingdom 2, they can be renamed later. Make sure the name of the listbox is "lstKingdom"
OK NOW FOR SERVER SIDE CODE
Find "Sub SavePlayer(ByVal Index As Long)"
underneath "Call PutVar(FileName, "CHAR" & i, "ShieldSlot", STR(Player(Index).Char(i).ShieldSlot))"
put
Now find "Sub LoadPlayer(ByVal Index As Long, ByVal Name As String)"
under "Player(Index).Char(i).ShieldSlot = Val(GetVar(FileName, "CHAR" & i, "ShieldSlot"))"
put
Now find "Sub AddChar"
and add "ByVal kingdom As Long" to the sub's title like you did in the client.
Now in the same Sub comment out
You don't need these anymore.
Now instead of that put this
Now find "Type PlayerRec"
and add this in
now find "Sub ClearPlayer(ByVal Index As Long)"
And add this in
now find "Sub ClearChar(ByVal Index As Long, ByVal CharNum As Long)"
and add this in
Now at the very bottom on modTypes add these
now find "Sub HandleData(ByVal Index As Long, ByVal Data As String)"
and add this in
now find "CharNum = Val(Parse(4))"
and add this in
find "Call AddChar(Index, Name, Sex, Class, CharNum)"
and change it too
now find "Sub SendJoinMap(ByVal Index As Long)"
add this
and on the one below add this
Now find "Sub SendLeaveMap(ByVal Index As Long, ByVal MapNum As Long)"
and add this
now find "Sub SendPlayerData(ByVal Index As Long)"
and add this
Alrite, That should be everything, I hope it works.
____________________________________________________________
I saw a request for guilds, and while I don't have a tutorial for full-working guilds, I do have this saved on my PC. It should be a decent starting point for anyone to work guilds into their game.
EDIT: Edited to make it look cleaner with italics, some bold, and code.
Client Side
Ok, Find "Sub SendAddChar"
now add "ByVal kingdom As Long" to the sub title,
should look like
Code:
Sub SendAddChar(ByVal Name As String, ByVal Sex As Long, ByVal ClassNum As Long, ByVal Slot As Long, ByVal kingdom As Long)
now in modTypes find "Type PlayerRec"
now add under 'general
Code:
"kingdom As Long"
Now again in modTypes find "Sub ClearPlayer(ByVal Index As Long)"
now under "Player(Index).PK = NO"
add
Code:
"Player(Index).kingdom = 0"
Now at the VERY bottom of modTypes add these
Code:
Function GetPlayerkingdom(ByVal Index As Long) As Long
GetPlayerkingdom = Player(Index).kingdom
End Function
Sub SetPlayerkingdom(ByVal Index As Long, ByVal kingdom As Long)
Player(Index).kingdom = kingdom
End Sub
Now in modGameLogic find "MENU_STATE_ADDCHAR"
now there will be a code like this
Code:
Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
Else
Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1)
Change it to look like this
Code:
Call SendAddChar(frmNewChar.txtName, 0, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1, frmNewChar.lstKingdom.ListIndex)
Else
Call SendAddChar(frmNewChar.txtName, 1, frmNewChar.cmbClass.ListIndex, frmChars.lstChars.ListIndex + 1, frmNewChar.lstKingdom.ListIndex)
Now in modGameLogic again find "Sub BltPlayerName(ByVal Index As Long)"
Now change this to.
Code:
' Check access level
If GetPlayerPK(Index) = NO Then
Select Case GetPlayerAccess(Index)
Case 0
Select Case GetPlayerkingdom(Index)
Case 1
Color = QBColor(BrightBlue)
Case 2
Color = QBColor(Yellow)
End Select
Case 1
Color = QBColor(DarkGrey)
Case 2
Color = QBColor(Cyan)
Case 3
Color = QBColor(Blue)
Case 4
Color = QBColor(Pink)
End Select
Else
Color = QBColor(BrightRed)
End If
Or change it how it will work with your game.
Now find "If LCase(Parse(0)) = "playerdata" Then"
now under this "Call SetPlayerPK(i, Val(Parse(9)))"
PUT this
Code:
Call SetPlayerkingdom(i, Val(Parse(10)))
Now on the Form called newchar.frm or whatever. Add a listbox add 2 items to the list Kingdom 1 and Kingdom 2, they can be renamed later. Make sure the name of the listbox is "lstKingdom"
OK NOW FOR SERVER SIDE CODE
Find "Sub SavePlayer(ByVal Index As Long)"
underneath "Call PutVar(FileName, "CHAR" & i, "ShieldSlot", STR(Player(Index).Char(i).ShieldSlot))"
put
Code:
'Players Kingdom
Call PutVar(FileName, "CHAR" & i, "kingdom", STR(Player(Index).Char(i).kingdom))
Now find "Sub LoadPlayer(ByVal Index As Long, ByVal Name As String)"
under "Player(Index).Char(i).ShieldSlot = Val(GetVar(FileName, "CHAR" & i, "ShieldSlot"))"
put
Code:
'Players Kingdom
Player(Index).Char(i).kingdom = Val(GetVar(FileName, "CHAR" & i, "kingdom"))
Now find "Sub AddChar"
and add "ByVal kingdom As Long" to the sub's title like you did in the client.
Now in the same Sub comment out
Code:
'Player(Index).Char(CharNum).Map = START_MAP
'Player(Index).Char(CharNum).x = START_X
'Player(Index).Char(CharNum).y = START_Y
You don't need these anymore.
Now instead of that put this
Code:
Select Case kingdom
Case 0
Player(Index).Char(CharNum).kingdom = 1
Player(Index).Char(CharNum).Map = 1
Player(Index).Char(CharNum).x = 1
Player(Index).Char(CharNum).y = 2
Case 1
Player(Index).Char(CharNum).kingdom = 2
Player(Index).Char(CharNum).Map = 2
Player(Index).Char(CharNum).x = 3
Player(Index).Char(CharNum).y = 3
End Select
Now find "Type PlayerRec"
and add this in
Code:
'Kingdom
kingdom As Long
now find "Sub ClearPlayer(ByVal Index As Long)"
And add this in
Code:
Player(Index).Char(i).kingdom = 0
now find "Sub ClearChar(ByVal Index As Long, ByVal CharNum As Long)"
and add this in
Code:
Player(Index).Char(CharNum).kingdom = 0
Now at the very bottom on modTypes add these
Code:
Function GetPlayerkingdom(ByVal Index As Long) As Long
GetPlayerkingdom = Player(Index).Char(Player(Index).CharNum).kingdom
End Function
Sub SetPlayerkingdom(ByVal Index As Long, InvNum As Long)
Player(Index).Char(Player(Index).CharNum).kingdom
End Sub
Function Getkingdom(ByVal Index As Long) As Long
GetPlayerkingdom = Player(Index).Char(Player(Index).CharNum).kingdom
End Function
now find "Sub HandleData(ByVal Index As Long, ByVal Data As String)"
and add this in
Code:
Dim kingdom As Long
now find "CharNum = Val(Parse(4))"
and add this in
Code:
kingdom = Val(Parse(5))
If kingdom >= 2 Then
Call AlertMsg(Index, "INVALID KINGDOM!")
Exit Sub
End If
find "Call AddChar(Index, Name, Sex, Class, CharNum)"
and change it too
Code:
Call AddChar(Index, Name, Sex, Class, CharNum, kingdom)
now find "Sub SendJoinMap(ByVal Index As Long)"
add this
Code:
& SEP_CHAR & GetPlayerkingdom(i)
and on the one below add this
Code:
& SEP_CHAR & GetPlayerkingdom(Index)
Now find "Sub SendLeaveMap(ByVal Index As Long, ByVal MapNum As Long)"
and add this
Code:
& SEP_CHAR & GetPlayerkingdom(Index)
now find "Sub SendPlayerData(ByVal Index As Long)"
and add this
Code:
& SEP_CHAR & GetPlayerkingdom(Index)
Alrite, That should be everything, I hope it works.
____________________________________________________________
I saw a request for guilds, and while I don't have a tutorial for full-working guilds, I do have this saved on my PC. It should be a decent starting point for anyone to work guilds into their game.
EDIT: Edited to make it look cleaner with italics, some bold, and code.