Help with Faces Plz

Hello Eclipse!

I have a trouble with Faces pictures; I will need to explain with screens…

My character class is Wizard (2nd class), and her face should be the Hylian one (1.bmp), but shows nothing

I need help with that, because I was trying to change it, but I failed, can someone help me?

The idea should be:

For 1st, 2nd & 3rd classes, the face = Hylian (1.bmp)

For 4th & 5th classes, the face = Goron (2.bmp)

For 6th & 7th classes, the face = Zora (3.bmp)

!

!

About the client code of faces

This is the code where it works:

! ```
Sub BltFace()
! Dim rec As RECT, rec_pos As RECT, faceNum As Long
! ’ If debug mode, handle error then exit out
! If Options.Debug = 1 Then On Error GoTo errorhandler
! If NumFaces = 0 Then Exit Sub
! frmMain.picFace.Cls
! faceNum = GetPlayerSprite(MyIndex)
! If faceNum <= 0 Or faceNum > NumFaces Then Exit Sub
! With rec
! .top = 0
! .Bottom = 100
! .Left = 0
! .Right = 100
! End With
! With rec_pos
! .top = 0
! .Bottom = 100
! .Left = 0
! .Right = 100
! End With
! ’ Load face if not loaded, and reset timer
! FaceTimer(faceNum) = GetTickCount + SurfaceTimerMax
! If DDS_Face(faceNum) Is Nothing Then
! Call InitDDSurf(“Faces” & faceNum, DDSD_Face(faceNum), DDS_Face(faceNum))
! End If
! Engine_BltToDC DDS_Face(faceNum), rec, rec_pos, frmMain.picFace, False
! ’ Error handler
! Exit Sub
! errorhandler:
! HandleError “BltFace”, “modDirectDraw7”, Err.Number, Err.Description, Err.Source, Err.HelpContext
! Err.Clear
! Exit Sub
! End Sub


So… depends in the sprite that I choose for the character and thats not ok for me, because for only one class I have differents sprites to choose (and dont forget male and female sprites)

Faces are directly related to the sprite. Meaning that if your sprite is 1 then the first face sprite is shown.

And make sure that the faces are .bmp`s

Faces are directly related to the sprite. Meaning that if your sprite is 1 then the first face sprite is shown.

And make sure that the faces are .bmp`s

yeah but thats not ok for me, because for only one class I have differents sprites to choose (and dont forget male and female sprites)

yeah but thats not ok for me, because for only one class I have differents sprites to choose (and dont forget male and female sprites)

You could go the easy way and make faces for each sprite, or you could add an option to the classes.ini file that sets the face for the class.

You could go the easy way and make faces for each sprite, or you could add an option to the classes.ini file that sets the face for the class.

Hello Eclipse!

I have a trouble with Faces pictures; I will need to explain with screens…

My character class is Wizard (2nd class), and her face should be the Hylian one (1.bmp), but shows nothing

I need help with that, because I was trying to change it, but I failed, can someone help me?

The idea should be:

For 1st, 2nd & 3rd classes, the face = Hylian (1.bmp)

For 4th & 5th classes, the face = Goron (2.bmp)

For 6th & 7th classes, the face = Zora (3.bmp)

!

!

About the client code of faces

This is the code where it works:

! ```
Sub BltFace()
! Dim rec As RECT, rec_pos As RECT, faceNum As Long
! ’ If debug mode, handle error then exit out
! If Options.Debug = 1 Then On Error GoTo errorhandler
! If NumFaces = 0 Then Exit Sub
! frmMain.picFace.Cls
! faceNum = GetPlayerSprite(MyIndex)
! If faceNum <= 0 Or faceNum > NumFaces Then Exit Sub
! With rec
! .top = 0
! .Bottom = 100
! .Left = 0
! .Right = 100
! End With
! With rec_pos
! .top = 0
! .Bottom = 100
! .Left = 0
! .Right = 100
! End With
! ’ Load face if not loaded, and reset timer
! FaceTimer(faceNum) = GetTickCount + SurfaceTimerMax
! If DDS_Face(faceNum) Is Nothing Then
! Call InitDDSurf(“Faces” & faceNum, DDSD_Face(faceNum), DDS_Face(faceNum))
! End If
! Engine_BltToDC DDS_Face(faceNum), rec, rec_pos, frmMain.picFace, False
! ’ Error handler
! Exit Sub
! errorhandler:
! HandleError “BltFace”, “modDirectDraw7”, Err.Number, Err.Description, Err.Source, Err.HelpContext
! Err.Clear
! Exit Sub
! End Sub


So… depends in the sprite that I choose for the character and thats not ok for me, because for only one class I have differents sprites to choose (and dont forget male and female sprites)

Mind taking a screen shot of your classes.ini? According to matt’s way you have to set the face value individually for each sprite in the class/ini with picture correlation. Of course have the source grab that code. If you want, paste a screen shot of your ini. and I can help from there.

Edit: You could also make face folder for each class itself and keep the main folder for the sprites over all, either way you have a bunch of choices.

You could go the easy way and make faces for each sprite, or you could add an option to the classes.ini file that sets the face for the class.

Thats a NICE idea, but I need some help, because I tried&failed in the past :wacko:

Mind taking a screen shot of your classes.ini? According to matt’s way you have to set the face value individually for each sprite in the class/ini with picture correlation. Of course have the source grab that code. If you want, paste a screen shot of your ini. and I can help from there.

Edit: You could also make face folder for each class itself and keep the main folder for the sprites over all, either way you have a bunch of choices.

Classes.ini :)

! [INIT]
! MaxClasses=7
! [CLASS1]
! Name=Guerrero
! MaleSprite=1,2,3
! FemaleSprite=4,5,6
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartItemCount=2
! StartItem1=15
! StartValue1=1
! StartItem2=144
! StartValue2=1
! StartMap=1
! StartMapX=11
! StartMapY=3
! [CLASS2]
! Name=Mago
! MaleSprite=1,2,3
! FemaleSprite=4,5,6
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartMap=1
! StartMapX=11
! StartMapY=3
! StartItemCount=2
! StartItem1=66
! StartValue1=1
! StartItem2=144
! StartValue2=1
! [CLASS3]
! Name=Nigromante
! MaleSprite=1,2,3
! FemaleSprite=4,5,6
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartMap=1
! StartMapX=11
! StartMapY=3
! StartItemCount=2
! StartItem1=192
! StartValue1=1
! StartItem2=144
! StartValue2=1
! [CLASS4]
! Name=Destructor
! MaleSprite=7,8,9
! FemaleSprite=7,8,9
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartMap=73
! StartMapX=6
! StartMapY=5
! StartItemCount=2
! StartItem1=145
! StartValue1=1
! StartItem2=228
! StartValue2=1
! [CLASS5]
! Name=Defensor
! MaleSprite=7,8,9
! FemaleSprite=7,8,9
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartMap=73
! StartMapX=6
! StartMapY=5
! StartItemCount=2
! StartItem1=145
! StartValue1=1
! StartItem2=229
! StartValue2=1
! [CLASS6]
! Name=Marino
! MaleSprite=13,14,15
! FemaleSprite=16,17,18
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartItemCount=2
! StartItem1=146
! StartValue1=1
! StartItem2=230
! StartValue2=1
! StartMap=90
! StartMapX=14
! StartMapY=9
! [CLASS7]
! Name=Tormentoso
! MaleSprite=13,14,15
! FemaleSprite=16,17,18
! Strength=5
! Endurance=5
! Intelligence=5
! Agility=5
! Willpower=5
! StartItemCount=2
! StartItem1=146
! StartValue1=1
! StartItem2=231
! StartValue2=1
! StartMap=90
! StartMapX=14
! StartMapY=9

you should just add a seperate setting to store the face number in.

that would be easy, and the simplest way to do it.

just add it to the classes rec


Private Type ClassRec

    Name As String * NAME_LENGTH

    Stat(1 To Stats.Stat_Count - 1) As Byte

    MaleSprite() As Long

    FemaleSprite() As Long

    MaleFace() as long

    FemaleFace() as long

End Type

then just add some way to the npc editor to add the face number.

you should just add a seperate setting to store the face number in.

that would be easy, and the simplest way to do it.

just add it to the classes rec


Private Type ClassRec

Name As String * NAME_LENGTH

Stat(1 To Stats.Stat_Count - 1) As Byte

MaleSprite() As Long

FemaleSprite() As Long

MaleFace() as long

FemaleFace() as long

End Type

then just add some way to the npc editor to add the face number.

Its not as easy as that.

yes it is… O.o

sure, there are some things i didnt mention ,but all code is allready in the engine, just a small copy/paste adjust job.

yes it is… O.o

sure, there are some things i didnt mention ,but all code is allready in the engine, just a small copy/paste adjust job.

Then mention that next time. It may seem obvious to you, but to someone else reading this thread, they might think that that’s all that need to be done.

Client Side

I put this in BltFace:

faceNum = Face

And add this:


Private Type ClassRec

Name As String * NAME_LENGTH

Stat(1 To Stats.Stat_Count - 1) As Byte

MaleSprite() As Long

FemaleSprite() As Long

Face As Long

' For client use

Vital(1 To Vitals.Vital_Count - 1) As Long

End Type

Server Side

In LoadClasses I add:


	 Class(i).Face = Val(GetVar(filename, "CLASS" & i, "Face"))

In SaveClasses I add:


	 Call PutVar(filename, "CLASS" & i, "Face", STR(Class(i).Face))

I want to do what Mathew mentioned :)

add an option to the classes.ini file that sets the face for the class

Wich is the next pass??

not bad, i presume you send the data to the client too?

not bad, i presume you send the data to the client too?

I presume no, this is all I did, but dont know what to do now

Need a bit of help :P

check how server sends class data to client, make sure your new option is send too.

How :( ?

edit: It is about there?

! ! ' Packets sent by server to client ! Public Enum ServerPackets ! SAlertMsg = 1 ! SLoginOk ! SNewCharClasses ! SClassesData ! SInGame ! SPlayerInv ! SPlayerInvUpdate ! SPlayerWornEq ! SPlayerHp ! SPlayerMp ! SPlayerStats ! SPlayerData ! SPlayerMove ! SNpcMove ! SPlayerDir ! SNpcDir ! SPlayerXY ! SPlayerXYMap ! SAttack ! SNpcAttack ! SCheckForMap ! SMapData ! SMapItemData ! SMapNpcData ! SMapDone ! SGlobalMsg ! SAdminMsg ! SPlayerMsg ! SMapMsg ! SSpawnItem ! SItemEditor ! SUpdateItem ! SREditor ! SSpawnNpc ! SNpcDead ! SNpcEditor ! SUpdateNpc ! SMapKey ! SEditMap ! SShopEditor ! SUpdateShop ! SSpellEditor ! SUpdateSpell ! SSpells ! SLeft ! SResourceCache ! SResourceEditor ! SUpdateResource ! SSendPing ! SDoorAnimation ! SActionMsg ! SPlayerEXP ! SBlood ! SAnimationEditor ! SUpdateAnimation ! SAnimation ! SMapNpcVitals ! SCooldown ! SClearSpellBuffer ! SSayMsg ! SOpenShop ! SResetShopAction ! SStunned ! SMapWornEq ! SBank ! STrade ! SCloseTrade ! STradeUpdate ! STradeStatus ! STarget ! SHotbar ! SHighIndex ! SSound ! STradeRequest ! SPartyInvite ! SPartyUpdate ! SPartyVitals ! SHandleProjectile ! 'ALATAR ! SQuestEditor ! SUpdateQuest ! SPlayerQuest ! SQuestMessage ! '/ALATAR ! ' Make sure SMSG_COUNT is below everything else ! SMSG_COUNT ! ! SSpawnEvent ! SEventMove ! SEventDir ! SEventChat ! SEventStart ! SEventEnd ! SPlayBGM ! SPlaySound ! SFadeoutBGM ! SStopSound ! SSwitchesAndVariables ! SMapEventData ! ! End Enum ! ' Packets sent by client to server ! Public Enum ClientPackets ! CNewAccount = 1 ! CDelAccount ! CLogin ! CAddChar ! CUseChar ! CSayMsg ! CEmoteMsg ! CBroadcastMsg ! CPlayerMsg ! CPlayerMove ! CPlayerDir ! CUseItem ! CAttack ! CUseStatPoint ! CPlayerInfoRequest ! CWarpMeTo ! CWarpToMe ! CWarpTo ! CSetSprite ! CGetStats ! CRequestNewMap ! CMapData ! CNeedMap ! CMapGetItem ! CMapDropItem ! CMapRespawn ! CMapReport ! CKickPlayer ! CBanList ! CBanDestroy ! CBanPlayer ! CRequestEditMap ! CRequestEditItem ! CSaveItem ! CRequestEditNpc ! CSaveNpc ! CRequestEditShop ! CSaveShop ! CRequestEditSpell ! CSaveSpell ! CSetAccess ! CWhosOnline ! CSetMotd ! CSearch ! CSpells ! CCast ! CQuit ! CSwapInvSlots ! CRequestEditResource ! CSaveResource ! CCheckPing ! CUnequip ! CRequestPlayerData ! CRequestItems ! CRequestNPCS ! CRequestResources ! CSpawnItem ! CRequestEditAnimation ! CSaveAnimation ! CRequestAnimations ! CRequestSpells ! CRequestShops ! CRequestLevelUp ! CForgetSpell ! CCloseShop ! CBuyItem ! CSellItem ! CChangeBankSlots ! CDepositItem ! CWithdrawItem ! CCloseBank ! CAdminWarp ! CTradeRequest ! CAcceptTrade ! CDeclineTrade ! CTradeItem ! CUntradeItem ! CHotbarChange ! CHotbarUse ! CSwapSpellSlots ! CAcceptTradeRequest ! CDeclineTradeRequest ! CPartyRequest ! CAcceptParty ! CDeclineParty ! CPartyLeave ! CProjecTileAttack ! 'ALATAR ! CRequestEditQuest ! CSaveQuest ! CRequestQuests ! CPlayerHandleQuest ! CQuestLogUpdate ! '/ALATAR ! ' Make sure CMSG_COUNT is below everything else ! CMSG_COUNT ! ! CEventChatReply ! CEvent ! CSwitchesAndVariables ! CRequestSwitchesAndVariables ! ! End Enum !


Sub SendClasses(ByVal index As Long)

    Dim packet As String

    Dim i As Long, n As Long, q As Long

    Dim Buffer As clsBuffer

    Set Buffer = New clsBuffer

    Buffer.WriteLong SClassesData

    Buffer.WriteLong Max_Classes

    For i = 1 To Max_Classes

        Buffer.WriteString GetClassName(i)

        Buffer.WriteLong GetClassMaxVital(i, Vitals.HP)

        Buffer.WriteLong GetClassMaxVital(i, Vitals.MP)

        ' set sprite array size

        n = UBound(Class(i).MaleSprite)

        ' send array size

        Buffer.WriteLong n

        ' loop around sending each sprite

        For q = 0 To n

            Buffer.WriteLong Class(i).MaleSprite(q)

        Next

        ' set sprite array size

        n = UBound(Class(i).FemaleSprite)

        ' send array size

        Buffer.WriteLong n

        ' loop around sending each sprite

        For q = 0 To n

            Buffer.WriteLong Class(i).FemaleSprite(q)

        Next

        For q = 1 To Stats.Stat_Count - 1

            Buffer.WriteLong Class(i).stat(q)

        Next

    Next

    SendDataTo index, Buffer.ToArray()

    Set Buffer = Nothing

End Sub

check that sub serverside. and


Sub HandleClassesData(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim n As Long

Dim i As Long

Dim Z As Long, x As Long

Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out

    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer

    Buffer.WriteBytes Data()

    n = 1

    ' Max classes

    Max_Classes = Buffer.ReadLong 'CByte(Parse(n))

    ReDim Class(1 To Max_Classes)

    n = n + 1

    For i = 1 To Max_Classes

        With Class(i)

            .Name = Buffer.ReadString 'Trim$(Parse(n))

            .Vital(Vitals.HP) = Buffer.ReadLong 'CLng(Parse(n + 1))

            .Vital(Vitals.MP) = Buffer.ReadLong 'CLng(Parse(n + 2))

            ' get array size

            Z = Buffer.ReadLong

            ' redim array

            ReDim .MaleSprite(0 To Z)

            ' loop-receive data

            For x = 0 To Z

                .MaleSprite(x) = Buffer.ReadLong

            Next

            ' get array size

            Z = Buffer.ReadLong

            ' redim array

            ReDim .FemaleSprite(0 To Z)

            ' loop-receive data

            For x = 0 To Z

                .FemaleSprite(x) = Buffer.ReadLong

            Next

            For x = 1 To Stats.Stat_Count - 1

                .Stat(x) = Buffer.ReadLong

            Next

        End With

        n = n + 10

    Next

    Set Buffer = Nothing

    ' Error handler

    Exit Sub

errorhandler:

    HandleError "HandleClassesData", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

    Err.Clear

    Exit Sub

End Sub

that clientside

I´m lost in the shadows :blink:

oh come on, your doing good.

send Class(i).Face in server, sendclasses, then in client set Class(i).Face with the recieved data from server in HandleClassesData.

How I send?

The “For” things?

server


' loop around sending each sprite

        For q = 0 To n

            Buffer.WriteLong Class(i).FemaleSprite(q)

        Next

        Buffer.WriteLong Class(i).Face

        For q = 1 To Stats.Stat_Count - 1

            Buffer.WriteLong Class(i).stat(q)

        Next

client


.Face Buffer.ReadLong

Log in to reply