|
-
Apr 10th, 2011, 01:06 PM
#1
Thread Starter
Junior Member
Party System coding problem...
Hi, I have a Problem with my party system for my Game. When Players are in a Party and they attack a Enemy, the enemy wont die. It's HP will be stuck at 0 and the players will not earn EXP. Heres the Code Where they Earn EXP.
Code:
' Check if in party, if so divide the exp up by 2
If Player(Attacker).InParty = False Or Player(Attacker).Party.ShareExp = False Then
If GetPlayerLevel(Attacker) = MAX_LEVEL Then
Call SetPlayerExp(Attacker, Experience(MAX_LEVEL))
Call BattleMsg(Attacker, "You can't gain anymore Star Points!", BRIGHTBLUE, 0)
Else
Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp)
Call BattleMsg(Attacker, "You gained " & Exp & " Star Points.", BRIGHTBLUE, 0)
End If
Else
q = 0
' The following code will tell us how many party members we have active
For X = 1 To MAX_PARTY_MEMBERS
If Player(Attacker).Party.Member(X) > 0 Then
q = q + 1
End If
Next X
' MsgBox "in party" & q
If q = 2 Then 'Remember, if they aren't in a party they'll only get one person, so this has to be at least two
Exp = Exp * 0.75 ' 3/4 experience
' MsgBox Exp
For X = 1 To MAX_PARTY_MEMBERS
If Player(Attacker).Party.Member(X) > 0 Then
If Player(Player(Attacker).Party.Member(X)).Party.ShareExp = True Then
If GetPlayerLevel(Player(Attacker).Party.Member(X)) = MAX_LEVEL Then
Call SetPlayerExp(Player(Attacker).Party.Member(X), Experience(MAX_LEVEL))
Call BattleMsg(Player(Attacker).Party.Member(X), "You can't gain anymore Star Points!", BRIGHTBLUE, 0)
Else
Call SetPlayerExp(Player(Attacker).Party.Member(X), GetPlayerExp(Player(Attacker).Party.Member(X)) + Exp)
Call BattleMsg(Player(Attacker).Party.Member(X), "You gained " & Exp & " Star Points.", BRIGHTBLUE, 0)
End If
Call SendEXP(X)
End If
End If
Next X
Else 'if there are 3 or more party members..
Exp = Exp * 0.5 ' 1/2 experience
For X = 1 To MAX_PARTY_MEMBERS
If Player(Attacker).Party.Member(X) > 0 Then
If Player(Player(Attacker).Party.Member(X)).Party.ShareExp = True Then
If GetPlayerLevel(Player(Attacker).Party.Member(X)) = MAX_LEVEL Then
Call SetPlayerExp(Player(Attacker).Party.Member(X), Experience(MAX_LEVEL))
Call BattleMsg(Player(Attacker).Party.Member(X), "You can't gain anymore Star Points!", BRIGHTBLUE, 0)
Else
Call SetPlayerExp(Player(Attacker).Party.Member(X), GetPlayerExp(Player(Attacker).Party.Member(X)) + Exp)
Call BattleMsg(Player(Attacker).Party.Member(X), "You gained " & Exp & " Star Points.", BRIGHTBLUE, 0)
End If
Call SendEXP(X)
End If
End If
Next X
End If
End If
I can't find out why the enemy doesn't die and they dont earn EXP. There's more code for the Party System but its just the Join Party and Leave party commands. Could anybody help?
-
Apr 11th, 2011, 03:42 AM
#2
Fanatic Member
Re: Party System coding problem...
Without seeing the code in the routines that you are calling it's hard to tell where the error might be as it could be in one of those.
1 thing I have noticed though, is that in all your for loops, you start with X=1, unless you have set option Base (which we cannot see), by default VB6 starts at 0 so in this instance you will always miss the first party member and start at the 2nd.
Also where this code exists:
Code:
If GetPlayerLevel(Attacker) = MAX_LEVEL Then
Call SetPlayerExp(Attacker, Experience(MAX_LEVEL))
Do you really need to Call SetPlayerExp? since surely by the test above the the attacker has already reached max_level for the code to drop down this leg, so is there any point setting it again?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|