Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 11:28 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  [ 1380 posts ]  Go to page 1, 2, 3, 4, 5 ... 56  Next
Author Message
 Post subject: Display stats on screen
PostPosted: Tue Sep 16, 2008 7:28 am 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 09, 2007 3:16 am
Posts: 276
I'm going to give you two ways of setting this up so that you don't need the stat labels. The first way is going to have your stats under your character just like your character's name is above The second way will put your stats in the lower left corner.

1st Way
Image
Difficulty: 1/5

::Client Side::

Find:
Code:
For i = 1 To MAX_PLAYERS
                    If IsPlaying(i) Then
                        If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                            'If CurX = GetPlayerX(i) Then
                                'If CurY = GetPlayerY(i) Then
                                    Call DrawPlayerName(i)
                                'End If
                            'End If
                        End If
                    End If
                Next i

Replace with:
Code:
For i = 1 To MAX_PLAYERS
                    If IsPlaying(i) Then
                        If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                            'If CurX = GetPlayerX(i) Then
                                'If CurY = GetPlayerY(i) Then
                                    Call DrawPlayerName(i)
                                    Call DrawPlayerHP(i)
                                    Call DrawPlayerMP(i)
                                    Call DrawPlayerSP(i)
                                'End If
                            'End If
                        End If
                    End If
                Next i

At the bottom of modText, add:
Code:
Sub DrawPlayerHP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim HP As String

HP = "HP: " & (GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 44
   
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, HP, Color)
End Sub

Sub DrawPlayerMP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim MP As String

MP = "MP: " & (GetPlayerVital(MyIndex, Vitals.MP) / GetPlayerMaxVital(MyIndex, Vitals.MP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 54
   
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, MP, Color)
End Sub

Sub DrawPlayerSP(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
Dim SP As String

SP = "SP: " & (GetPlayerVital(MyIndex, Vitals.SP) / GetPlayerMaxVital(MyIndex, Vitals.SP) * 100) & "%"

    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - 30
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) + 64
   
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, SP, Color)
End Sub

Done


2nd Way

Image
Difficulty: 1/5

::Client Side::

Search for:
Code:
' Checking fps

Under:
Code:
' Checking fps
        If Mid$(MyText, 1, 4) = "/fps" Then
       
            BFPS = Not BFPS
            MyText = vbNullString
            frmMirage.txtMyChat.Text = vbNullString
            Exit Sub
        End If

Add:
Code:
' Show stats
        If Mid$(MyText, 1, 5) = "/Show" Then
       
            Show = Not Show
            MyText = vbNullString
            frmMirage.txtMyChat.Text = vbNullString
            Exit Sub
        End If

Search for:
Code:
Public BFPS As Boolean

Under:
Code:
Public BFPS As Boolean
Public BLoc As Boolean

Add:
Code:
' Puts your stats on screen
Public Show As Boolean

Search for:
Code:
Dim rec_pos As DXVBLib.RECT

Under add:
Code:
Dim HP As String, MP As String, SP As String

Search for:
Code:
' draw FPS

Under add:
Code:
' draw FPS
                If BFPS Then
                    Call DrawText(TexthDC, (MAX_MAPX - 1) * PIC_X, 1, Trim$("FPS: " & GameFPS), QBColor(Yellow))
                End If

Add:
Code:
' draw Stats
                If Show Then
                    HP = (GetPlayerVital(MyIndex, Vitals.HP) / GetPlayerMaxVital(MyIndex, Vitals.HP) * 100) & "%"
                    MP = (GetPlayerVital(MyIndex, Vitals.MP) / GetPlayerMaxVital(MyIndex, Vitals.MP) * 100) & "%"
                    SP = (GetPlayerVital(MyIndex, Vitals.SP) / GetPlayerMaxVital(MyIndex, Vitals.SP) * 100) & "%"
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 350, Trim$("HP: " & HP), QBColor(Yellow))
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 360, Trim$("MP: " & MP), QBColor(Yellow))
                    Call DrawText(TexthDC, (MAX_MAPY - 11) * PIC_Y, 370, Trim$("SP: " & SP), QBColor(Yellow))
                End If

Done

_________________
Image
Island of Lost Souls wrote:
Dr. Moreau: Mr. Parker, do you know what it means to feel like God?


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 7:29 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.ruсайтsemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoningtechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.ruhttp://temperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:38 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Obse


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:39 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
32.3


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:40 am 
Online
Mirage Source Lover

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


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:41 am 
Online
Mirage Source Lover

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


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:42 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Troi


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:43 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Ashl


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:44 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Like


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:45 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Jerz


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:47 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Busi


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:48 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Erns


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:49 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Acid


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:50 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Drin


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:51 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
colo


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:52 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Ever


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:53 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Oxyg


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:54 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Inte


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:55 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Orie


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:57 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Geis


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:58 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Cisc


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 5:59 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Opti


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 6:00 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Carn


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 6:01 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Show


Top
 Profile  
 
PostPosted: Sun Dec 26, 2021 6:02 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 489222
Walt


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

All times are UTC


Who is online

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