Mirage Source http://web.miragesource.net/forums/ |
|
[Feature] Custom Experience http://web.miragesource.net/forums/viewtopic.php?f=183&t=6076 |
Page 1 of 78 |
Author: | JokeofWeek [ Fri Jul 31, 2009 7:52 pm ] |
Post subject: | [Feature] Custom Experience |
Custom Experience Values Difficulty: 1/5 - This is a fairly easy tutorial, and is entirely Copy and Paste! Alright, so there used to be a tutorial for this on the old forums, but I beleive it is gone, so I decided to write my own. What this does is let's you set the experience required for every level. Alright so first things first, create a file called experience.ini and place it in the Data folder of the server side. The format of the .ini file should be like so : Code: [EXP] MaxLevel=100 Exp1=1500 Exp2=2000 Exp3=2500 .... Exp99=1000000 Exp100=100500 It is basically saying that to level up at level 1, you need 1500 experience points. Note however that once you have reached the last level, even if you get the required ammount of experience points, you will not level up. Attachment: Now for the code itself! Server Side modTypes
Code: Public Spell(1 To MAX_SPELLS) As SpellRec and under it add : Code: Public ExpReq() As Long modGeneral
Code: Call SetStatus("Loading spells...") Call LoadSpells Add the following : Code: Call SetStatus("Loading experience values...") Call LoadExperience modDatabase
Code: Public Sub LoadExperience() Dim FileName As String Dim I As Long FileName = App.Path & "\data\experience.ini" ReDim ExpReq(1 To (Val(GetVar(FileName, "EXP", "MaxLevel")) - 1)) As Long For I = 1 To UBound(ExpReq) ExpReq(I) = Val(GetVar(FileName, "EXP", "EXP" & I)) Next I End Sub Next up, look for the GetPlayerNextLevel function and replace it with the following : Code: Public Function GetPlayerNextLevel(ByVal Index As Long) As Long GetPlayerNextLevel = ExpReq(GetPlayerLevel(Index)) End Function modGameLogic
Code: If GetPlayerExp(Index) >= GetPlayerNextLevel(Index) Then Add the following code snippet, this will prevent players from leveling over the max level: Code: If GetPlayerLevel(Index) = UBound(ExpReq) Then Call SetPlayerExp(Index, GetPlayerNextLevel(Index)) Exit Sub End If And there you go! You can now place your own custom experience values! Another simple way to do this is through the GetPlayerNextLevel function, if you replace it with your own formula, thus eliminating the need for a file . Enjoy! Try it out, and if you have any questions or need any help, feel free to ask! |
Author: | Rian [ Sat Aug 01, 2009 4:13 pm ] |
Post subject: | Re: [Feature] Custom Experience |
+5 Rating for this old-school-style tutorial. Fool proof. Thanks, Joke. |
Author: | ShadowMaster [ Sun Aug 09, 2009 1:56 pm ] |
Post subject: | Re: [Feature] Custom Experience |
What next is the Exp Share for parties. |
Author: | wanai [ Fri Jan 07, 2022 6:52 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Econ |
Author: | wanai [ Fri Jan 07, 2022 6:53 pm ] |
Post subject: | Re: [Feature] Custom Experience |
116.7 |
Author: | wanai [ Fri Jan 07, 2022 6:54 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Bett |
Author: | wanai [ Fri Jan 07, 2022 6:55 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Bett |
Author: | wanai [ Fri Jan 07, 2022 6:56 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Thom |
Author: | wanai [ Fri Jan 07, 2022 6:57 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Fern |
Author: | wanai [ Fri Jan 07, 2022 6:59 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Shel |
Author: | wanai [ Fri Jan 07, 2022 7:00 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Davi |
Author: | wanai [ Fri Jan 07, 2022 7:01 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Will |
Author: | wanai [ Fri Jan 07, 2022 7:02 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Bizz |
Author: | wanai [ Fri Jan 07, 2022 7:03 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Cold |
Author: | wanai [ Fri Jan 07, 2022 7:04 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Fisk |
Author: | wanai [ Fri Jan 07, 2022 7:05 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Snoo |
Author: | wanai [ Fri Jan 07, 2022 7:06 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Orie |
Author: | wanai [ Fri Jan 07, 2022 7:08 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Hele |
Author: | wanai [ Fri Jan 07, 2022 7:09 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Neve |
Author: | wanai [ Fri Jan 07, 2022 7:10 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Cafe |
Author: | wanai [ Fri Jan 07, 2022 7:11 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Jenn |
Author: | wanai [ Fri Jan 07, 2022 7:12 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Gues |
Author: | wanai [ Fri Jan 07, 2022 7:13 pm ] |
Post subject: | Re: [Feature] Custom Experience |
Puis |
Author: | wanai [ Fri Jan 07, 2022 7:14 pm ] |
Post subject: | Re: [Feature] Custom Experience |
XVII |
Page 1 of 78 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |