Larias Posted February 1, 2013 Author Share Posted February 1, 2013 Sorry for posting twice in a day, but this has got me riled up because I can't figure out what is going on. Whenever I try to compile, I get an "Argument is not Optional" error, which, from what I understand, means that the If statement will always pick one option. But I don't know why, since I didn't touch this section.Here is the code that is getting error'd:```' in party?If TempPlayer(attacker).inParty > 0 Then' pass through party sharing functionParty_ShareExp TempPlayer(attacker).inParty, exp, attackerElse' no party - keep exp for selfGivePlayerEXP attacker, expEnd If```Specifically, Party_ShareExp TempPlayer(attacker).inParty, exp, attacker.I added in EXP sharing which is working just fine. However, I wanted only players in party on the map to get experience. Here's my Party_ShareExp:```Public Sub Party_ShareExp(ByVal partyNum As Long, ByVal exp As Long, ByVal Index As Long, ByVal mapnum As Long)Dim expShare As Long, i As Long, tmpIndex As Long, LoseMemberCount As Byte' check if it's worth sharingIf Not exp >= Party(partyNum).MemberCount Then' no party - keep exp for selfGivePlayerEXP Index, expExit SubEnd If' check members in others mapsFor i = 1 To MAX_PARTY_MEMBERStmpIndex = Party(partyNum).Member(i)If tmpIndex > 0 ThenIf IsConnected(tmpIndex) And IsPlaying(tmpIndex) ThenIf GetPlayerMap(tmpIndex) <> mapnum ThenLoseMemberCount = LoseMemberCount + 1End IfEnd IfEnd IfNext i' find out the equal shareIf (Party(partyNum).MemberCount - LoseMemberCount) = 1 ThenexpShare = expShareEnd IfIf (Party(partyNum).MemberCount - LoseMemberCount) = 2 ThenexpShare = Round(exp * 0.8)End IfIf (Party(partyNum).MemberCount - LoseMemberCount) = 3 ThenexpShare = Round(exp * 0.65)End IfIf (Party(partyNum).MemberCount - LoseMemberCount) > 3 And Party(partyNum).MemberCount < 8 ThenexpShare = Round(exp * 0.5)End IfIf (Party(partyNum).MemberCount - LoseMemberCount) > 7 And Party(partyNum).MemberCount < 11 ThenexpShare = Round(exp * 0.25)End IfIf (Party(partyNum).MemberCount - LoseMemberCount) > 10 ThenexpShare = Round(exp * 0.2)End If' loop through and give everyone expFor i = 1 To MAX_PARTY_MEMBERStmpIndex = Party(partyNum).Member(i)' existing member?KnIf tmpIndex > 0 Then' playing?If IsConnected(tmpIndex) And IsPlaying(tmpIndex) And GetPlayerMap(tmpIndex) = mapnum Then' give them their shareGivePlayerEXP tmpIndex, expShareEnd IfEnd IfNextEnd Sub```wtf!??!?! Link to comment Share on other sites More sharing options...
Guest Posted February 1, 2013 Share Posted February 1, 2013 Argument not optional means you're ignoring a parameter required by the sub/function to run.You're calling it like this:```Party_ShareExp TempPlayer(attacker).inParty, exp, attacker```When Party_ShareExp takes the parameters:```ByVal partyNum As Long, ByVal exp As Long, ByVal Index As Long, ByVal mapnum As Long```So you're missing the MapNum. Link to comment Share on other sites More sharing options...
Exception Posted February 1, 2013 Share Posted February 1, 2013 Argument not optional simply means you aren't passing enough values into a procedure, as well, you don't have an optional "fallback", if you like."Party_ShareExp TempPlayer(attacker).inParty, exp, attacker""Public Sub Party_ShareExp(ByVal partyNum As Long, ByVal exp As Long, ByVal Index As Long, ByVal mapnum As Long)"As you can see from Party_ShareExp, you need to pass PartyNum, Exp, Index, and the MapNum. Guess which one you're missing. ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) Link to comment Share on other sites More sharing options...
Larias Posted February 1, 2013 Author Share Posted February 1, 2013 You guys are awesome. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now