Kingdom Tutorial
Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=234
Printed Date: 20 December 2006 at 5:53pm Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com
Topic: Kingdom Tutorial
Posted By: Sync
Subject: Kingdom Tutorial
Date Posted: 11 February 2006 at 3:42pm
Difficulty: Hard 5/5
Originaly Posted By: Asrrin29
*special thanks to Romeo for this one.
Client Side
Ok, Find "Sub SendAddChar"
now add "ByVal kingdom As Long" to the sub title, should look like
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 "kingdom As Long"
Now again in modTypes find "Sub ClearPlayer(ByVal Index As Long)"
now under "Player(Index).PK = NO"
add
"Player(Index).kingdom = 0"
Now at the VERY bottom of modTypes add these
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
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
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.
' 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
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
'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
'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
'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
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
'Kingdom kingdom As Long
now find "Sub ClearPlayer(ByVal Index As Long)"
And add this in
Player(Index).Char(i).kingdom = 0
now find "Sub ClearChar(ByVal Index As Long, ByVal CharNum As Long)"
and add this in
Player(Index).Char(CharNum).kingdom = 0
Now at the very bottom on modTypes add these
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
Dim kingdom As Long
now find "CharNum = Val(Parse(4))"
and add this in
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
Call AddChar(Index, Name, Sex, Class, CharNum, kingdom)
now find "Sub SendJoinMap(ByVal Index As Long)"
add this
& SEP_CHAR & GetPlayerkingdom(i)
and on the one below add this
& SEP_CHAR & GetPlayerkingdom(Index)
Now find "Sub SendLeaveMap(ByVal Index As Long, ByVal MapNum As Long)"
and add this
& SEP_CHAR & GetPlayerkingdom(Index)
now find "Sub SendPlayerData(ByVal Index As Long)"
and add this
& SEP_CHAR & GetPlayerkingdom(Index)
Alrite, That should be everything, I hope it works.
|
|