//////////////////// /// Party Extras /// ////////////////////
(just did the code in the party extras to make it look neat) Orig. Posted by: Cookie Recovered from old forums By: Cookie
This tutorial makes it so parties have unlimited members, an admin can join, and all members recieve 50% exp.
Ok not much of tut but here -
Make old ones of these look like this :
' Party request If LCase(Mid(MyText, 1, 6)) = "/party" Then ' Make sure they are actually sending something If Len(MyText) > 7 Then ChatText = Mid(MyText, 8, Len(MyText) - 7) Call SendPartyRequest(ChatText) Else Call AddText("Usage: /party playernamehere", AlertColor) End If MyText = "" Exit Sub End If
' Join party If LCase(Mid(MyText, 1, 5)) = "/join" Then Call SendJoinParty MyText = "" Exit Sub End If
' Leave party If LCase(Mid(MyText, 1, 6)) = "/leave" Then Call SendLeaveParty MyText = "" Exit Sub End If
Replace old subs with these:
Sub SendPartyRequest(ByVal name As String) Dim Packet As String
Packet = "PARTY" & SEP_CHAR & name & SEP_CHAR & END_CHAR Call SendData(Packet) End Sub
Sub SendJoinParty() Dim Packet As String
Packet = "JOINPARTY" & SEP_CHAR & END_CHAR Call SendData(Packet) End Sub
Sub SendLeaveParty() Dim Packet As String
Packet = "LEAVEPARTY" & SEP_CHAR & END_CHAR Call SendData(Packet) End Sub
SERVER SIDE
' Check if in party, if so divide the exp up by 2 If Player(Attacker).InParty = NO Then Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp) Call PlayerMsg(Attacker, "You have gained " & Exp & " experience points.", BrightBlue) Else Exp = Exp / 2
If Exp < 0 Then Exp = 1 End If
Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp) Call PlayerMsg(Attacker, "You have gained " & Exp & " party experience points.", BrightBlue)
N = Player(Attacker).PartyPlayer If N > 0 Then Call SetPlayerExp(N, GetPlayerExp(N) + Exp) Call PlayerMsg(N, "You have gained " & Exp & " party experience points.", BrightBlue) End If End If
' Drop the goods if they get it N = Int(Rnd * Npc(NpcNum).DropChance) + 1 If N = 1 Then Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum, MapNpcNum).X, MapNpc(MapNum, MapNpcNum).Y) End If
' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range) MapNpc(MapNum, MapNpcNum).Num = 0 MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount MapNpc(MapNum, MapNpcNum).HP = 0 Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR)
' Check for level up Call CheckPlayerLevelUp(Attacker)
' Check for level up party member If Player(Attacker).InParty = YES Then Call CheckPlayerLevelUp(Player(Attacker).PartyPlayer) End If
make the old stuff look like that
Personal Review (acfrazier2): Not Very Noob Friendly.. I'd give it a 6/10 total rating. Hope this helps I'm tryin to bring stuff back from old forums.
|