Mirage Source

Free ORPG making software.
It is currently Fri Mar 29, 2024 1:54 am

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1272 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next
Author Message
PostPosted: Fri Apr 10, 2009 11:23 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
[SERVERSIDE]
change the SendVital sub to this

Code:
Public Sub SendVital(ByVal Index As Long, ByVal Vital As Vitals)
Dim Packet As String
   
    Select Case Vital
        Case HP
            Packet = SPlayerHp & SEP_CHAR & Index & SEP_CHAR & GetPlayerMaxVital(Index, Vitals.HP) & SEP_CHAR & GetPlayerVital(Index, Vitals.HP) & END_CHAR
        Case MP
            Packet = SPlayerMp & SEP_CHAR & Index & SEP_CHAR & GetPlayerMaxVital(Index, Vitals.MP) & SEP_CHAR & GetPlayerVital(Index, Vitals.MP) & END_CHAR
        Case SP
            Packet = SPlayerSp & SEP_CHAR & Index & SEP_CHAR & GetPlayerMaxVital(Index, Vitals.SP) & SEP_CHAR & GetPlayerVital(Index, Vitals.SP) & END_CHAR
    End Select
   
    Call SendDataToMap(GetPlayerMap(Index), Index, Packet)
End Sub

This sends the vitals to everyone, and also says who they are for.

[CLIENTSIDE]
change sub HandlePlayerHp to
Code:
Private Sub HandlePlayerHp(ByRef Parse() As String)
     Dim Index As Long
     Index = CLng(Parse(1))
     Player(Index).MaxHP = CLng(Parse(2))
     Call SetPlayerVital(Index, Vitals.HP, CLng(Parse(3)))
     If Index = MyIndex Then
        If GetPlayerMaxVital(Index, Vitals.HP) > 0 Then
            frmMirage.lblHP.Caption = Int(GetPlayerVital(Index, Vitals.HP) / GetPlayerMaxVital(Index, Vitals.HP) * 100) & "%"
        End If
     End If
End Sub


change sub HandlePlayerMp to
Code:
Private Sub HandlePlayerMp(ByRef Parse() As String)
     Dim Index As Long
     Index = CLng(Parse(1))
     Player(Index).MaxMP = CLng(Parse(2))
     Call SetPlayerVital(Index, Vitals.MP, CLng(Parse(3)))
     If Index = MyIndex Then
        If GetPlayerMaxVital(Index, Vitals.MP) > 0 Then
            frmMirage.lblMP.Caption = Int(GetPlayerVital(Index, Vitals.MP) / GetPlayerMaxVital(Index, Vitals.MP) * 100) & "%"
        End If
     End If
End Sub


change sub HandlePlayerSp to
Code:
Private Sub HandlePlayerSp(ByRef Parse() As String)
     Dim Index As Long
     Index = CLng(Parse(1))
     Player(Index).MaxSP = CLng(Parse(2))
     Call SetPlayerVital(Index, Vitals.SP, CLng(Parse(3)))
     If Index = MyIndex Then
        If GetPlayerMaxVital(Index, Vitals.SP) > 0 Then
            frmMirage.lblSP.Caption = Int(GetPlayerVital(Index, Vitals.SP) / GetPlayerMaxVital(Index, Vitals.SP) * 100) & "%"
        End If
     End If
End Sub



Now to actually draw out the bars for everyone :D.

in sub BltPlayer, right before end sub put
Code:
        If Player(Index).Vital(HP) = 0 Then Exit Sub
       
        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + 32, Y + 36)
       
        Call DDS_BackBuffer.SetFillColor(RGB(0, 255, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + ((Player(Index).Vital(HP) / 100) / (Player(Index).MaxHP / 100) * 32), Y + 36)
       
        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 35, X + 32, Y + 39)
       
        Call DDS_BackBuffer.SetFillColor(RGB(0, 0, 255))
        Call DDS_BackBuffer.DrawBox(X, Y + 35, X + ((Player(MyIndex).Vital(MP) / 100) / (Player(MyIndex).MaxMP / 100) * 32), Y + 39)


If you happen to also be using sp, you could put this.
Code:

        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 38, X + 32, Y +42)

        Call DDS_BackBuffer.SetFillColor(RGB(255, 255, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 38, X + ((Player(MyIndex).Vital(MP) / 100) / (Player(MyIndex).MaxMP / 100) * 32), Y + 42)


And you are done :D.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Sun Apr 12, 2009 4:25 am 
Offline
Newbie

Joined: Sat Apr 11, 2009 7:09 am
Posts: 20
is this the HP MP SP bars for below/above the player or...... off to the side were the the current hp #%'s are


Top
 Profile  
 
PostPosted: Sun Apr 12, 2009 4:32 am 
Offline
Persistant Poster
User avatar

Joined: Fri Aug 15, 2008 3:11 pm
Posts: 633
if im right its above

_________________
╔╗╔═╦═╦══╦═══╗
║║║║║║║╔╗║╔═╗║
║║║║║║║╚╝║║║║║
║╚╣║║║║╔╗║╚═╝║
╚═╩╩═╩╩╝╚╩═══╝


╔╦═╦╦════╦═══╗
║║║║╠═╗╔═╣╔══╝
║║║║║║║║╚═╗
║║║║║║║║╔═╝
╚═╩═╝╚╝╚╝ ?


Top
 Profile  
 
PostPosted: Sun Apr 12, 2009 1:29 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
No its below.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Sun Jun 28, 2009 7:32 pm 
Offline
Regular

Joined: Fri Jul 28, 2006 9:20 pm
Posts: 39
Location: <--soemwhere in that general direction
If you want a player HP/MP bar just for your own player, you can solely put this in, inside your bltplayer sub

Code:
        If Player(Index).Vital(HP) = 0 Then Exit Sub
       
        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + 32, Y + 36)
       
        Call DDS_BackBuffer.SetFillColor(RGB(0, 255, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + ((Player(Index).Vital(HP) / 100) / (Player(Index).MaxHP / 100) * 32), Y + 36)
       
        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 35, X + 32, Y + 39)
       
        Call DDS_BackBuffer.SetFillColor(RGB(0, 0, 255))
        Call DDS_BackBuffer.DrawBox(X, Y + 35, X + ((Player(MyIndex).Vital(MP) / 100) / (Player(MyIndex).MaxMP / 100) * 32), Y + 39)


It still works perfectly fine in MS4 the latest version I as just using it.


Top
 Profile  
 
PostPosted: Tue Aug 11, 2009 8:30 pm 
Offline
Newbie
User avatar

Joined: Thu Mar 05, 2009 2:45 am
Posts: 20
I tried to do this, it seems to work for a few people but I am new and I did everything correctly and I got a shit load of errors that I tried to fix myself but all I got was more errors, I get Compile Error ' Variable Not Defined' and I don't know what to do because there's only one Sub SendVital and usually Variable Not defined errors mean I am putting the code in the wrong section.


Top
 Profile  
 
PostPosted: Tue Aug 11, 2009 9:25 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
Ciao wrote:
I tried to do this, it seems to work for a few people but I am new and I did everything correctly and I got a shit load of errors that I tried to fix myself but all I got was more errors, I get Compile Error ' Variable Not Defined' and I don't know what to do because there's only one Sub SendVital and usually Variable Not defined errors mean I am putting the code in the wrong section.


All these tutorials need to be converted to work with the byte array packets system. You might wanna learn the difference between the two systems. These tutorials use string packets, but the source has byte array packets now.


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 4:58 am 
Offline
Newbie
User avatar

Joined: Thu Mar 05, 2009 2:45 am
Posts: 20
Thank you for letting me know, is there going to be a whole fix by the way ?


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 12:19 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
Ciao wrote:
Thank you for letting me know, is there going to be a whole fix by the way ?


No, but sooner or later, prolly this weekend, I will post a few examples of how to convert the packets and what not.


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 5:09 pm 
Offline
Newbie

Joined: Tue Aug 11, 2009 11:35 pm
Posts: 4
I'll be waiiting 4 it, i 've seen many tutorials and things that i wnna to Add but never colud do it because allways give error in SEP_CHAR and END_CHAR.(Supose that they are Strings packets rigth?)


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 5:51 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
The newest version of mirage uses byte packets, this uses string packets.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 6:44 pm 
Offline
Newbie

Joined: Tue Aug 11, 2009 11:35 pm
Posts: 4
I Thougt so, so Why they changed? are better byte than String Packets?
Cold anyone tell me the diference?

Well anyways i think i will find out later how to make the bars ^^ i hve other problems first ^^...


Top
 Profile  
 
PostPosted: Fri Aug 14, 2009 2:27 pm 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
Byte array packets are much smaller.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Fri Aug 14, 2009 6:08 pm 
Offline
Newbie
User avatar

Joined: Sun Feb 11, 2007 4:08 am
Posts: 10
Labmonkey wrote:
Byte array packets are much smaller.

What? I fail to understand why a byte array would help make the packets smaller. The byte array is equatable to a string if the array contents correspond to a character set like ASCII.

_________________
Quote:
You never finish a program, you just stop working on it.


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 8:49 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 10:55 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Econ


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 10:56 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
92.67


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 10:57 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 10:58 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 10:59 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Carl


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 11:00 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Caba


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 11:01 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Isaa


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 11:03 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Anto


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 11:04 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Erle


Top
 Profile  
 
PostPosted: Mon Jan 03, 2022 11:05 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Whit


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1272 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 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:  
cron
Powered by phpBB® Forum Software © phpBB Group