Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Problem with setting PlayerRec


donovanvaught
 Share

Recommended Posts

Hello all! Coming to you with a problem that I can't seem to find a solution for. I have a Data type for players that is set when you attack someone. Let me break it down, Weapon has affect (let's say Stun), when attacking a player, if the conditions are right, the victim has his Player.Status.type set to Stun, and the Player.status.time set to gettickcount plus a duration. all this info is being set properly (most of the time), and the packet is set up properly (same packet that sets the value in the first place), but it isn't resetting after the time runs out. Here is my server loop code

```
' check if need to turn off Affect
                    For s = 1 To 25
                        If GetTickCount > TempPlayer(i).Status(s).Time Then
                            TempPlayer(i).Status(s).Type = 0
                            TempPlayer(i).Status(s).Time = 0
                            TempPlayer(i).Status(s).Value = 0
                            SendAffect i, s, 0, 0, 0
                        End If
                    Next
```
I've been getting intermittent problems while setting up the Affect system in my game, so any help with this is appreciated. Any other info needed just ask. :)
Link to comment
Share on other sites

Well, the stun was just an example, but if you must know I changed the stun mechanics. I have a total of 25 special affects (including stun) so I needed them to all be in the same place for more concise code. So now, instead of stunduration I have the PlayerRec.Status  and the status data has .Type (stun, etc.) .Time (Gettickcount + Duration) and .value (like damage for poison). You can see in the code that it's not too different from what was there, it's just flexible to handle multiple affects.
Link to comment
Share on other sites

Thanks for the reply Soul, funny story, was just coming back to say that I solved the problem when I saw your post. Anywho, I checked client side and it finally clicked that there was a check to make sure it fills an empty status slot, this same check was running when trying to turn off an affect (therefore the slot wasn't empty, so it didn't get set to 0). So long to short, I fixed it. Thanks again for the replies!
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...