Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 11:49 pm

All times are UTC




Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: tnl Bar & exp in .ini
PostPosted: Tue Feb 06, 2007 7:09 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Credits: GSD I think, for the .ini thingy. the rest is just a packet for the bar.

This will give your game a 'to next level' bar (exp) and also let you decide the different experience gaps between the levels:

Server Side
Add this at the bottom of modServerTCP:
Code:
Sub SendTNL(ByVal index As Long)
Dim Packet As String

    Packet = "PLAYERTNL" & SEP_CHAR & GetPlayerNextLevel(index) & SEP_CHAR & GetPlayerExp(index) & SEP_CHAR & END_CHAR
    Call SendDataTo(index, Packet)
End Sub


Now, on all places that you find:
Code:
Call SendHP(index)
        Call SendMP(index)

Add below:
Code:
        Call SendTNL(index)

Now, in modDatabase, add:
Code:
Sub LoadExps()
Dim FileName As String
Dim i As Long

    Call CheckExps
   
    FileName = App.Path & "\experience.ini"
   
    For i = 1 To MAX_EXP
        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 MAX_EXP
             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 MAX_EXP
        Experience(i) = 0
    Next i
End Sub

Now at the top of modTypes, add:
Code:
Public Experience(1 To MAX_EXP) As Long

Now, replace:
Code:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
    GetPlayerNextLevel = (GetPlayerLevel(Index) + 1) * (GetPlayerSTR(Index) + GetPlayerDEF(Index) + GetPlayerMAGI(Index) + GetPlayerSPEED(Index) + GetPlayerPOINTS(Index)) * 25
End Function

with:
Code:
Function GetPlayerNextLevel(ByVal index As Long) As Long
    GetPlayerNextLevel = Experience(GetPlayerLevel(index))
End Function

Client Side
Now in modHandleData: add this:
Code:
' Player tnl packet
    If LCase(Parse(0)) = "playertnl" Then
        Player(MyIndex).MaxExp = Val(Parse$(1))
        Player(MyIndex).Exp = Val(Parse$(2))
       
        If GetPlayerMaxExp(MyIndex) > 0 Then
            If GetPlayerExp(MyIndex) > 0 Then
                frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex)
               frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 2000) / (GetPlayerMaxExp(MyIndex) / 2000)) * 2000)
            End If
        End If
        Exit Sub

Now add a picture box in frmMirage:
Code:
width = 2000
Height = 135

And make the picture box's BackColor the color you want the exp bar, or load a image to it. Name it: shpTNL

Add a label in the picture box, name it: lblEXP

Below:
Code:
Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
    Player(Index).Exp = Exp
End Sub

Add:
Code:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
    Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
    GetPlayerMaxExp = Player(Index).MaxExp
End Function

Now below:
Code:
MaxSP As Long

in Type PlayerRec, add:
Code:
MaxExp As Long


Now add a ini filed name: experience.ini in the server folder, and add the following:
Code:
[EXPERIENCE]
Exp1=1500
Exp2=3000
Exp3=4500
Exp4=6000
Exp5=7500
etc. to your max level.

Now below:
Code:
Public Const MAX_SPELLS = 50

add:
Code:
Public Const MAX_EXP = 200

Now under:
Code:
Function GetPlayerExp(ByVal Index As Long) As Long
    GetPlayerExp = Player(Index).Exp
End Function

Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
    Player(Index).Exp = Exp
End Sub

Add:
Code:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
    Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
    GetPlayerMaxExp = Player(Index).MaxExp
End Function

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Last edited by William on Fri Mar 09, 2007 12:13 pm, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 7:49 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Pretty nice.

Good to see some more tut's coming out!

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 8:02 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
It might be here in split up topics, not the bar and the ini together. But I posted it since it was requested.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Last edited by William on Tue Feb 06, 2007 8:29 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 8:29 pm 
Offline
Regular

Joined: Thu Jan 04, 2007 8:52 pm
Posts: 30
u cant post my request thats like agenst the magnacarta.

_________________
ima ninja...?iono...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 8:30 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Whats magnacarta? And nothing stops me from sharing this since I didn't write it only for you.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:08 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
King John, Pope Innocent (the 3rd I think) and the English Barons had a disagreement about whats rights Kings should be allowed.

The document changed what the King could be able to do, and gave more rights to the people of the country.

It lead to constitutional law. Even more famous than The Bill of Rights and United States Constitution.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Last edited by Robin on Tue Feb 06, 2007 9:31 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:12 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
okay =/

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:32 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Hehehe.

Sorry, missed out the most-important bit from the middle xD

But this animé is addicting..

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:38 pm 
Offline
Pro

Joined: Mon May 29, 2006 2:15 am
Posts: 368
Hahaha, that was great, Kite. I was actually about to post something close to that.

But it really didn't grant the people more freedom... it granted the Nobility more power over their people (power that was stricken from the King)...

[On Topic]
Anyways, why are you looking to add this to a game?

_________________
Image
Image
The quality of a man is not measured by how well he treats the knowledgeable and competent, but rather how he treats those less fortunate than himself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 6:05 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
zocheyado wrote:
u cant post my request thats like agenst the magnacarta.


Please tell me that's some strange ass sarcasm of some sort. Most people here a fully capable of adding TNL and a TNL bar.

So, if you wanna be greedy about features you want in your game, the best option is to add them yourself. People that request tutorials and expected them to be Private Messaged to them in a password secured zip folder are retarded. If you request a tutorial, you're either not gonna see it at all, or everyone in the community will see it in the Tutorials section.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 6:13 am 
Offline
Regular
User avatar

Joined: Mon May 29, 2006 7:01 pm
Posts: 45
Location: Canada, BC
Sonire wrote:
zocheyado wrote:
u cant post my request thats like agenst the magnacarta.


Please tell me that's some strange ass sarcasm of some sort. Most people here a fully capable of adding TNL and a TNL bar.

So, if you wanna be greedy about features you want in your game, the best option is to add them yourself. People that request tutorials and expected them to be Private Messaged to them in a password secured zip folder are retarded. If you request a tutorial, you're either not gonna see it at all, or everyone in the community will see it in the Tutorials section.


You freakin said it! Right on. :wink: I fear the people today are pampered a little too much. Gotta let em figure things out on their own as we once did. Trial and freakin error!

_________________
http://www.MMOReqs.com
http://www.ImageCookie.com
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 8:44 am 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
zocheyado wrote:
u cant post my request thats like agenst the magnacarta.


Then you shouldn't request :evil:

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 10, 2007 1:38 am 
You do know that you can just parse the next level information to the client and use that, right? That's how I did it. Works great.

(Sorry if that's what this does, I didn't read it. Since I'm on dial up now, I'm VERY impatient.)


Top
  
 
 Post subject:
PostPosted: Sat Feb 10, 2007 2:31 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Thats what this does :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: hmm
PostPosted: Tue Mar 27, 2007 2:29 am 
Offline
Regular

Joined: Wed Dec 20, 2006 8:31 pm
Posts: 50
Location: Smyrna, Delaware
Ya...kind of a necropost...but I was skimming through random things on the forum and noticed something. For this part...

Quote:
' Player tnl packet
If LCase(Parse(0)) = "playertnl" Then
Player(MyIndex).MaxExp = Val(Parse$(1))
Player(MyIndex).Exp = Val(Parse$(2))

If GetPlayerMaxExp(MyIndex) > 0 Then
If GetPlayerExp(MyIndex) > 0 Then
frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex)
frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 2000) / (GetPlayerMaxExp(MyIndex) / 2000)) * 2000)
End If
End If
Exit Sub


Shouldn't there be another End If after Exit Sub? Otherwise wouldn't there be an error within "modHandleData"?

sorry :oops: was really bored and needed something to do. lol


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 2:48 am 
no, never place end if's after Exit Subs, only before :)


Top
  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 3:03 am 
Well, since there are 3 If statements, and only 2 end ifs, I would say yes. If you look at all the other packets in there, they have an end if AFTER the exit sub. So I truly hope you were joking when saying that Boo.


Top
  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 3:42 am 
Offline
Regular

Joined: Wed Dec 20, 2006 8:31 pm
Posts: 50
Location: Smyrna, Delaware
Well if I am wrong then please correct me. :o Though I am just saying what looks correct to me.

*edit* also forgot to mention that, i believe there is only 1 of this line in the client side...

Quote:
Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub


which means you would end up putting in this...

Quote:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
GetPlayerMaxExp = Player(Index).MaxExp
End Function


twice in the same module...which cant be a good thing. :? Or maybe it was just a typo by william. Though good night, going to sleep now :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 6:22 am 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
I think you can't read, tuder.

Quote:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
GetPlayerMaxExp = Player(Index).MaxExp
End Function

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 8:28 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
theres nothing wrong with it?

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 10:43 am 
Offline
Regular

Joined: Wed Dec 20, 2006 8:31 pm
Posts: 50
Location: Smyrna, Delaware
hmm ill go a little further in depth with what i mean...maybe i am wrong...probably am but im just making my statement

Quote:
Server Side
Add this at the bottom of modServerTCP:
Code:
Sub SendTNL(ByVal index As Long)
Dim Packet As String

Packet = "PLAYERTNL" & SEP_CHAR & GetPlayerNextLevel(index) & SEP_CHAR & GetPlayerExp(index) & SEP_CHAR & END_CHAR
Call SendDataTo(index, Packet)
End Sub


Now, on all places that you find:
Code:
Call SendHP(index)
Call SendMP(index)

Add below:
Code:
Call SendTNL(index)

Now, in modDatabase, add:
Code:
Sub LoadExps()
Dim FileName As String
Dim i As Long

Call CheckExps

FileName = App.Path & "\experience.ini"

For i = 1 To MAX_EXP
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 MAX_EXP
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 MAX_EXP
Experience(i) = 0
Next i
End Sub

Now at the top of modTypes, add:
Code:
Public Experience(1 To MAX_EXP) As Long

Now, replace:
Code:
Function GetPlayerNextLevel(ByVal Index As Long) As Long
GetPlayerNextLevel = (GetPlayerLevel(Index) + 1) * (GetPlayerSTR(Index) + GetPlayerDEF(Index) + GetPlayerMAGI(Index) + GetPlayerSPEED(Index) + GetPlayerPOINTS(Index)) * 25
End Function

with:
Code:
Function GetPlayerNextLevel(ByVal index As Long) As Long
GetPlayerNextLevel = Experience(GetPlayerLevel(index))
End Function

Client Side
Now in modHandleData: add this:
Code:
' Player tnl packet
If LCase(Parse(0)) = "playertnl" Then
Player(MyIndex).MaxExp = Val(Parse$(1))
Player(MyIndex).Exp = Val(Parse$(2))

If GetPlayerMaxExp(MyIndex) > 0 Then
If GetPlayerExp(MyIndex) > 0 Then
frmMirage.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & GetPlayerMaxExp(MyIndex)
frmMirage.shpTNL.Width = (((GetPlayerExp(MyIndex) / 2000) / (GetPlayerMaxExp(MyIndex) / 2000)) * 2000)
End If
End If
Exit Sub

Now add a picture box in frmMirage:
Code:
width = 2000
Height = 135

And make the picture box's BackColor the color you want the exp bar, or load a image to it. Name it: shpTNL

Add a label in the picture box, name it: lblEXP

Below:
Code:
Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub

Add:
Code:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
GetPlayerMaxExp = Player(Index).MaxExp
End Function

Now below:
Code:
MaxSP As Long

in Type PlayerRec, add:
Code:
MaxExp As Long


Now add a ini filed name: experience.ini in the server folder, and add the following:
Code:
[EXPERIENCE]
Exp1=1500
Exp2=3000
Exp3=4500
Exp4=6000
Exp5=7500
etc. to your max level.

Now below:
Code:
Public Const MAX_SPELLS = 50

add:
Code:
Public Const MAX_EXP = 200

Now under:
Code:
Function GetPlayerExp(ByVal Index As Long) As Long
GetPlayerExp = Player(Index).Exp
End Function

Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub


Code:
Sub SetPlayerMaxExp(ByVal Index As Long, ByVal MaxExp As Long)
Player(Index).MaxExp = MaxExp
End Sub

Function GetPlayerMaxExp(ByVal Index As Long) As Long
GetPlayerMaxExp = Player(Index).MaxExp
End Function


unless i cant read...then i think those lines are exactly the same and added withing the exact same area. Because this line of code,

Quote:
Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub


is a part of this line of code

Quote:
Function GetPlayerExp(ByVal Index As Long) As Long
GetPlayerExp = Player(Index).Exp
End Function

Sub SetPlayerExp(ByVal Index As Long, ByVal Exp As Long)
Player(Index).Exp = Exp
End Sub


or maybe im just seeing things :o


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 11:16 am 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Ohh, one of those should be located server side.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 7:07 pm 
Offline
Regular

Joined: Wed Dec 20, 2006 8:31 pm
Posts: 50
Location: Smyrna, Delaware
ahh ok :o my mistake then lol.


Top
 Profile  
 
PostPosted: Tue Jul 31, 2007 12:31 am 
Offline
Regular

Joined: Fri Jul 28, 2006 9:28 pm
Posts: 36
After adding every single line of code and gone through it multiple times,
I still haven't developped my skill far enough to know how to define a variable. xD

I feel like if someone tells me I know what it is, but I can't find it out though =.=

Image

Can someone help me? Lol


Top
 Profile  
 
PostPosted: Tue Jul 31, 2007 12:33 am 
Offline
Knowledgeable
User avatar

Joined: Tue Feb 06, 2007 9:50 pm
Posts: 180
Location: Bergenfield, New Jersey, US
You did not add the MAX_EXP variable.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 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