DarkSpine Posted August 26, 2010 Author Share Posted August 26, 2010 All credits go to Ballie for the original code.TESTING STATUS: **Tested! Works!**>! @Ballie:>! > The older versions of Eclipse had experience tables that were editable through a .ini file in the server. It's a fairly simple edit to recreate this.> > **Please note: If you have access to the source code (which is pretty much assumed if you're here), and your experience table is based on a formula, it's much easier just to change the GetPlayerNextLevel function and MAX_LEVELS constant to suit your needs rather than having to implement a .ini system.**> > _All edits are server-side._> > The first thing that needs to be done is to get rid of the old experience system. It is very loosely integrated, so it's not too hard to do. Find and delete the following:> > ```> Function GetPlayerNextLevel(ByVal index As Long) As Long>   GetPlayerNextLevel = (GetPlayerLevel(index) + 1) * (GetPlayerStat(index, Stats.strength) + GetPlayerStat(index, Stats.endurance) + GetPlayerStat(index, Stats.intelligence) + GetPlayerStat(index, Stats.spirit) + GetPlayerPOINTS(index)) * 25> End Function> ```> ```> Public Const MAX_LEVELS As Byte = 100> ```> Now, we just need to add in our new system. We'll need to set up two variables to do this. Add the following to the source (preferably in modGlobals if you value organization):> > ```> Public MAX_LEVELS As Byte> Public Experience() As Long> ```> Now, a simple loading sub will set everything up. Add this, preferably in modDatabase:> > ```> Sub LoadExperience()>   Dim I As Byte> >   If Not FileExist("data\Experience.ini") Then>     Call SetStatus("Generating experience table...")>     MaxLevel = 100>     Call PutVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel", CStr(MaxLevel))>     >     ReDim Experience(1 To MaxLevel)>     For I = 1 To MaxLevel>       Experience(I) = I * 25>       Call PutVar(App.Path & "\data\Experience.ini", "Exp", CStr(I), CStr(Experience(I)))>     Next>   Else>     Call SetStatus("Loading experience...")>     MaxLevel = CByte(GetVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel"))>     ReDim Experience(1 To MaxLevel)>     For I = 1 To MaxLevel>       Experience(I) = CLng(GetVar(App.Path & "\data\Experience.ini", "Exp", CStr(I)))>     Next>   End If> End Sub> ```> Now, all that needs to be done is to make sure this is called. Find Sub LoadGameData and add this to it somewhere:> > ```> Call LoadExperience> ```> As a last touch, just make sure to replace the old GetPlayerNextLevel (located in modPlayer) with this new one that reflects the proper values:> > ```> Function GetPlayerNextLevel(ByVal Index As Long) As Long>   If GetPlayerLevel(Index) = MAX_LEVELS Then>     GetPlayerNextLevel = 9999999>   Else>     GetPlayerNextLevel = Experience(GetPlayerLevel(Index) + 1)>   End If> End Function> ```> To note, there's nothing in place yet to stop players from gaining experience once they've hit the level cap, so a slight change might be in order to the way SetPlayerExp works. Consider changing it to this:> > ```> Sub SetPlayerExp(ByVal Index As Long, ByVal EXP As Long)>   If GetPlayerLevel(Index) = MAX_LEVELS Then EXP = 0>   Player(Index).EXP = EXP> End Sub> ```> Either do that, or restrict experience from accruing at the max level somehow. How you do it really doesn't matter, though.> > That's that - a simple edit that allows a custom experience table. Just fire up the server and it will auto-create the .ini for you. All you need to do is alter it. Now comes my additional code, this will make the max level part possible:**SERVER SIDE**In **modEnumerations**Search for:```STradeStatus```And under it, add:```SMaxLevel```Now, go to **modDatabase** and replace:```Sub LoadExperience()  Dim I As Byte  If Not FileExist("data\Experience.ini") Then    Call SetStatus("Generating experience table...")    MaxLevel = 100    Call PutVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel", CStr(MaxLevel))    ReDim Experience(1 To MaxLevel)    For I = 1 To MaxLevel      Experience(I) = I * 25      Call PutVar(App.Path & "\data\Experience.ini", "Exp", CStr(I), CStr(Experience(I)))    Next  Else    Call SetStatus("Loading experience...")    MaxLevel = CByte(GetVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel"))    ReDim Experience(1 To MaxLevel)    For I = 1 To MaxLevel      Experience(I) = CLng(GetVar(App.Path & "\data\Experience.ini", "Exp", CStr(I)))    Next  End IfEnd Sub```With:```' .ini-Based EXP SystemSub LoadExperience(Optional Index As Long, Optional Skip As Long)Dim MaxLevel As Long  Dim I As Byte  If Skip <> 1 Then  If Not FileExist("data\Experience.ini") Then    Call SetStatus("Generating experience table...")    MaxLevel = 100    Call PutVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel", CStr(MaxLevel))    ReDim Experience(1 To MaxLevel)    For I = 1 To MaxLevel      Experience(I) = I * 25      Call PutVar(App.Path & "\data\Experience.ini", "Exp", CStr(I), CStr(Experience(I)))    Next  Else    Call SetStatus("Loading experience...")    MaxLevel = CByte(GetVar(App.Path & "\data\Experience.ini", "Max", "MaxLevel"))    ReDim Experience(1 To MaxLevel)    For I = 1 To MaxLevel      Experience(I) = CLng(GetVar(App.Path & "\data\Experience.ini", "Exp", CStr(I)))    Next    MAX_LEVELS = CByte(MaxLevel)  End If  ElseIf Skip = 1 Then    Call SendMaxLevel(Index, MaxLevel)  End IfEnd Sub```At the bottom of **modServerTCP** add:```Sub SendMaxLevel(ByVal Index As Long, ByVal MaxLevel As Long)  Dim Buffer As clsBuffer  Set Buffer = New clsBuffer  Buffer.WriteLong SMaxLevel  Buffer.WriteLong MaxLevel  SendDataTo Index, Buffer.ToArray()  Set Buffer = NothingEnd Sub```Now, in **modHandleData** Search for:```Call TextAdd(GetPlayerLogin(Index) & " has logged in from " & GetPlayerIP(Index) & ".")```and under it, add:```Call LoadExperience(Index, 1)```**FOLLOWING EDITS ARE CLIENT-SIDE!!!**In **modEnumerations** Search for:```STradeStatus```and under it, add:```SMaxLevel```Search and delete in **modConstants**:```Public Const MAX_LEVELS As Byte = 100```Now, in **modGlobals** add:```Public MAX_LEVELS As Byte```Go to **modHandleData** and under:```HandleDataSub(STradeStatus) = GetAddress(AddressOf HandleTradeStatus)```Add:```HandleDataSub(SMaxLevel) = GetAddress(AddressOf HandleMaxLevel)```At the bottom of **modHandleData** add:```Private Sub HandleMaxLevel(ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)  Dim Buffer As clsBuffer  Dim MaxLevel As Long  Set Buffer = New clsBuffer  Buffer.WriteBytes Data()  MaxLevel = Buffer.ReadLong  MAX_LEVELS = CByte(MaxLevel)  Set Buffer = NothingEnd Sub```That should do it, I'll be testing now, so wait until I've finished testing to add in =P~Urame Link to comment Share on other sites More sharing options...
Murdoc Posted September 13, 2010 Share Posted September 13, 2010 > That should do it, I'll be testing now, so wait until I've finished testing to add in =P> > ~UrameOk… So have you tested it yetÉ Link to comment Share on other sites More sharing options...
westin444 Posted September 13, 2010 Share Posted September 13, 2010 @Urame:> Search and delete in **modConstants**:> ```> Public Const MAX_LEVELS As Byte = 100> ```> Now, in **modGlobals** add:> > > Public MAX_LEVELS As **Byte**Byte, not bye ;) Link to comment Share on other sites More sharing options...
DarkSpine Posted September 14, 2010 Author Share Posted September 14, 2010 @smokeythebear:> > That should do it, I'll be testing now, so wait until I've finished testing to add in =P> > > > ~Urame> > Ok… So have you tested it yetÉSaid so at the top of the post, this all works.@314piwm:> @Urame:> > > Search and delete in **modConstants**:> > ```> > Public Const MAX_LEVELS As Byte = 100> > ```> > Now, in **modGlobals** add:> > > > > Public MAX_LEVELS As **Byte**> > Byte, not bye ;)Thanks for pointing that out, fixed, I prolly never would've noticed xD (I believe I wrote a lot of the code here, and then inserted it in VB6, so it was a simple quick-typing error)~Urame Link to comment Share on other sites More sharing options...
viciousdead Posted November 11, 2010 Share Posted November 11, 2010 I get an error..Server:>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/071733cb57045fa460f5022afd6b772a.png)Client:>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/8ee5426834d3dc48f875567a0728a517.png) Link to comment Share on other sites More sharing options...
Robin Posted November 11, 2010 Share Posted November 11, 2010 Dude, the fucking fix is in the post above you. Link to comment Share on other sites More sharing options...
viciousdead Posted November 11, 2010 Share Posted November 11, 2010 @Robin:> Dude, the fucking fix is in the post above you.Robin, damn it, don't you think I tried that.It says "Compile error:Ambiguous name detected: MAX_LEVELS"EDIT: I got it to compile, but when I run the server everything is ok, but when I try to login, the server gets runtime error 9, after the client says "Loading Game Data…". Link to comment Share on other sites More sharing options...
Robin Posted November 11, 2010 Share Posted November 11, 2010 Does it look like I care what you've tried? You're obviously blind.> **Search and delete in modConstants:**> ```> Public Const MAX_LEVELS As Byte = 100> ``` Link to comment Share on other sites More sharing options...
viciousdead Posted November 12, 2010 Share Posted November 12, 2010 @Robin:> Does it look like I care what you've tried? You're obviously blind.> > > **Search and delete in modConstants:**> > ```> > Public Const MAX_LEVELS As Byte = 100> > ```I don't care, that you don't care I have tried, I was just stating that I have tried the method above my post.Solved. Link to comment Share on other sites More sharing options...
Scythe Posted November 28, 2010 Share Posted November 28, 2010 i can get in game but it still does not let me lvl up :/ Link to comment Share on other sites More sharing options...
Domino_ Posted December 28, 2010 Share Posted December 28, 2010 It's not working for Xmas edition, or I just made a mistake in codes? :rolleyes: :azn: Link to comment Share on other sites More sharing options...
Azebu Posted December 28, 2010 Share Posted December 28, 2010 it works for meh. Link to comment Share on other sites More sharing options...
Markz88 Posted January 3, 2011 Share Posted January 3, 2011 I have EO Xmas Edition and I've installed this tut, the server runs without problems but when I run the client, and I try to register a new account, I get the runtime error 91: "Object Variable or With Block variable not set"… how to fix it? Link to comment Share on other sites More sharing options...
erkro1 Posted January 5, 2011 Share Posted January 5, 2011 Everything works in server, but when I open client and log in, he says :RTE 91Object variable or With block variable not setPlease help me Link to comment Share on other sites More sharing options...
chuchoide Posted January 5, 2011 Share Posted January 5, 2011 Reboot your PC, or reopen your Server. It has happened to me. Just keep opening the Server until the Error is gone, or reboot. Link to comment Share on other sites More sharing options...
erkro1 Posted January 5, 2011 Share Posted January 5, 2011 The error is on client, not on server.But i'll gonna try it tomorrow ;) Link to comment Share on other sites More sharing options...
chuchoide Posted January 5, 2011 Share Posted January 5, 2011 Then you need to update your DirectX version. Link to comment Share on other sites More sharing options...
Robin Posted January 6, 2011 Share Posted January 6, 2011 @Chuchoide:> Then you need to update your DirectX version.You never need to do this. Ever. Link to comment Share on other sites More sharing options...
erkro1 Posted January 6, 2011 Share Posted January 6, 2011 @Robin:> You never need to do this. Ever.Ok, what do i need to do then? Link to comment Share on other sites More sharing options...
Robin Posted January 6, 2011 Share Posted January 6, 2011 @erkro1:> Ok, what do I need to do then?Stop using outdated tutorials if you don't know how to change them to work with the latest version. Link to comment Share on other sites More sharing options...
erkro1 Posted January 6, 2011 Share Posted January 6, 2011 @Robin:> Stop using outdated tutorials if you don't know how to change them to work with the latest version.Ok, would someone make tut for eo xmas? Link to comment Share on other sites More sharing options...
farrel24 Posted June 3, 2012 Share Posted June 3, 2012 why when I open his client, and login, suddenly came out by itself?does anyone know the solution? Link to comment Share on other sites More sharing options...
JohnPony Posted June 3, 2012 Share Posted June 3, 2012 @farrel24:> why when I open his client, and login, suddenly came out by itself?> > does anyone know the solution?Erm explain a little better…. 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