| Mirage Source http://web.miragesource.net/forums/ |
|
| Kingdom Tutorial http://web.miragesource.net/forums/viewtopic.php?f=210&t=2437 |
Page 1 of 1 |
| Author: | Kousaten [ Sat Aug 11, 2007 1:56 am ] |
| Post subject: | Kingdom Tutorial |
Credit to: Asrrin 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. |
|
| Author: | Hellrise [ Sat Aug 11, 2007 4:27 am ] |
| Post subject: | Re: Kingdom Tutorial |
What does this do? |
|
| Author: | Lea [ Sat Aug 11, 2007 4:29 am ] |
| Post subject: | Re: Kingdom Tutorial |
it's a very basic and general guild system. |
|
| Author: | Kousaten [ Sat Aug 11, 2007 5:37 am ] |
| Post subject: | Re: Kingdom Tutorial |
Also sets the player's spawn point depending on the kingdom. The "tutorial" itself is copy/paste, but you can use it to learn a few things and go from there. That's what I did with my first MS project. |
|
| Author: | Rezeyu [ Sat Aug 11, 2007 6:27 am ] |
| Post subject: | Re: Kingdom Tutorial |
Is this different from the Kingdom Tutorial on that "25 Tutorials" list/site? |
|
| Author: | Robin [ Sat Aug 11, 2007 8:03 am ] |
| Post subject: | Re: Kingdom Tutorial |
Wow, this is old. This was old when I first joined MS. Nice find. |
|
| Author: | Rezeyu [ Sat Aug 11, 2007 8:05 am ] |
| Post subject: | Re: Kingdom Tutorial |
http://www.freewebs.com/centurymm/tutorials.txt ? |
|
| Author: | Robin [ Sat Aug 11, 2007 8:52 am ] |
| Post subject: | Re: Kingdom Tutorial |
Yes it is. |
|
| Author: | Kousaten [ Sat Aug 11, 2007 9:43 pm ] |
| Post subject: | Re: Kingdom Tutorial |
I remember Asrrin made it for his own MS game, which was supposed to be this vastly different project from the standard medieval stuff. He was using a space-age theme with all sorts of ships and everything. Really original ideas, but he never had the time to complete the game so he quit the project. |
|
| Author: | Asrrin29 [ Mon Jan 07, 2008 8:40 pm ] |
| Post subject: | Re: Kingdom Tutorial |
I didn't quit my project, just put it on indefinite hiatus, kinda like Duke Nukem: Forever |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|