Print Page | Close Window

Custom Experience

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=153
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Custom Experience
Posted By: Sync
Subject: Custom Experience
Date Posted: 11 February 2006 at 3:08pm
Difficulty: Medium 3/5

Ok I know this is simple but whatever. What this basically does is instead of using the weird formula that MS provides us with, this will pull whatever you set in the experience.ini and use that... It will basically look like:

[EXPERIENCE]
Exp1=1500
Exp2=3000
Exp3=4500
Exp4=6000
Exp5=7500
...


Ok its all server side.

Here it goes, in modTypes add in:
Public Const ExpMax = 99
Public Experience(1 To ExpMax) As Long

Ok this is where it will store all the experience values.
If you dont have a max level value set the 99 to 300 or sumthing *whatever you like*

Now in the same module find:
Function GetPlayerNextLevel(ByVal Index As Long) As Long


Replace it with:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
    GetPlayerNextLevel = Experience(GetPlayerLevel(Index))
End Function

This will just find the players level and find what experience value to give.

Now in modDatabase add the following anywhere:
Sub LoadExps()
Dim FileName As String
Dim i As Long

    Call CheckExps
    
    FileName = App.Path & "\experience.ini"
   
    For i = 1 To ExpMax
        Experience(i) = GetVar(FileName, "EXPERIENCE", "Exp" & i)
       
        DoEvents
    Next i
End Sub

Sub CheckExps()
    If Not FileExist("experience.ini") Then
        Dim i As Long
   
        For i = 1 To ExpMax
             Call PutVar(App.Path & "\experience.ini", "EXPERIENCE", "Exp" & i, i * 1500)
        Next i
    End If
End Sub

Sub ClearExps()
Dim i As Long

    For i = 1 To ExpMax
        Experience(i) = 0
    Next i
End Sub


What all this basically does is Check to see if experience.ini exists, if not create it and set the default value, otherwise load it. The sub ClearExps will just clear the variables.

Now in modGeneral find: Sub InitServer() under Call ClearSpells add:
Call SetStatus("Clearing exp...")
    Call ClearExps
    Call SetStatus("Loading exp...")
    Call LoadExps


These will just call the subs to load the exp.

Hope some people find this usefull ;)



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info