Mirage Source

Free ORPG making software.
It is currently Mon May 20, 2024 12:28 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [BUG]Carry Over Exp
PostPosted: Tue Nov 25, 2008 3:34 pm 
Offline
Newbie

Joined: Mon Mar 17, 2008 6:45 pm
Posts: 23
Hi there, didn't see it mentioned so here I go. In version 3.59 Roll over exp was added, but I beileve its nots working correctly as it does its calculation after player has a new (and higher) NextLevelExp. This gave me atleast, a negative exp number when leveling up.

Here is the Code:
Code:
Sub CheckPlayerLevelUp(ByVal Index As Long)
Dim i As Long

    ' Check if attacker got a level up
    If GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then
        Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)
                   
        ' Get the ammount of skill points to add
        i = Int(GetPlayerStat(Index, Stats.Speed) / 10)
        If i < 1 Then i = 1
        If i > 3 Then i = 3
           
        Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + i)
        Call SetPlayerExp(Index, CLng(GetPlayerExp(Index) - GetPlayerNextLevel(Index)))
        Call GlobalMsg(GetPlayerName(Index) & " has gained a level!", Brown)
        Call PlayerMsg(Index, "You have gained a level!  You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)
    End If
   
End Sub


To fix it, simply add a variable "expRollover" and have the calculation give this variable the value right after the Exp >= NextLevel check. Then obviously use this new variable as the setExp parameter.

Example:
Code:
Sub CheckPlayerLevelUp(ByVal Index As Long)
Dim i As Long
Dim expRollover As Long

    ' Check if attacker got a level up
    If GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then
        expRollover = CLng(GetPlayerExp(Index) - GetPlayerNextLevel(Index))
        Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)
                   
        ' Get the ammount of skill points to add
        i = Int(GetPlayerStat(Index, Stats.Speed) / 10)
        If i < 1 Then i = 1
        If i > 3 Then i = 3
           
        Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + i)
        Call SetPlayerExp(Index, expRollover)
        Call GlobalMsg(GetPlayerName(Index) & " has gained a level!", Brown)
        Call PlayerMsg(Index, "You have gained a level!  You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)
    End If
   
End Sub


and there you go, I'm very much a VB6 noob so sorry if I missed something.

_________________
Image
Image


Top
 Profile  
 
 Post subject: Re: [BUG]Carry Over Exp
PostPosted: Tue Nov 25, 2008 3:43 pm 
Offline
Knowledgeable
User avatar

Joined: Fri Feb 02, 2007 4:50 am
Posts: 263
Location: usa michigan centriville
has anyone else noticed this?

_________________
Fuck? I really joined in 2006.
Spirea, Chat Rooms, Discussions, Help. everything you need in one spot.
http://spirean.com
I love my computer, you never ask for more, you can be my princess or be my whore


Top
 Profile  
 
 Post subject: Re: [BUG]Carry Over Exp
PostPosted: Tue Nov 25, 2008 4:33 pm 
Offline
Knowledgeable
User avatar

Joined: Fri Feb 02, 2007 4:50 am
Posts: 263
Location: usa michigan centriville
yep i think he is right looks like it would negative out ^^. <will look into it farther thank you for your support.>

_________________
Fuck? I really joined in 2006.
Spirea, Chat Rooms, Discussions, Help. everything you need in one spot.
http://spirean.com
I love my computer, you never ask for more, you can be my princess or be my whore


Top
 Profile  
 
 Post subject: Re: [BUG]Carry Over Exp
PostPosted: Tue Nov 25, 2008 4:52 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
yes good fix

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group