damian666
-
Posts
1632 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Calendar
Posts posted by damian666
-
-
yep, ill add it ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
-
did'nt touch NewCharacterBltSprite either?
those things go in bltplayer man. -
its there mate o.o
find BltPlayer and at the top add
Dim Hair As Byte
Dim recHair As DxVBLib.RECT
i didnt touch bltsprite. -
should be checkhair xd
edited it ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) -
nope ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png)
-
thanx mate, hope it works right away, else ask me, i proberly forgot something then xd
and if you know a way to draw the hair ontop of the sprite, do let me know ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) -
SERVER SIDE:
First go to modTypes, and in PlayerRec add
```
Hair As byte
```
at the bottom.
At the bottom of modPlayer, add
```
Function GetPlayerHair(ByVal Index As Long) As byte
If Index <= 0 Or Index > MAX_PLAYERS Then Exit Function
GetPlayerHair = Player(Index).Hair
End Function
Sub SetPlayerHair(ByVal Index As Long, ByVal Hair As byte)
If Index <= 0 Or Index > MAX_PLAYERS Then Exit Sub
Player(Index).Hair = Hair
End Sub
```
in modDatabase find
```
Sub AddChar(ByVal Index As Long, ByVal Name As String, ByVal Sex As Byte, ByVal ClassNum As Long, ByVal Sprite As Long)
```
and replace it with
```
Sub AddChar(ByVal Index As Long, ByVal Name As String, ByVal Sex As Byte, ByVal ClassNum As Long, ByVal Sprite As Long, ByVal Hair As byte)
```
then, inside the sub, change
```
If Player(Index).Sex = SEX_MALE Then
Player(Index).Sprite = Class(ClassNum).MaleSprite(Sprite)
Else
Player(Index).Sprite = Class(ClassNum).FemaleSprite(Sprite)
End If
```
to
```
If Player(Index).Sex = SEX_MALE Then
Player(Index).Sprite = Sprite
Else
Player(Index).Sprite = Sprite
End If
```
under
```
Player(Index).Level = Level
```
Add
```
Player(Index).Hair = Hair
```
Now, in modHandleData, find
```
HandleAddChar
```
and under
```
Dim n As Long
```
Add
```
Dim Hair As byte
```
, under
```
Sprite = Buffer.ReadLong
```
add
```
Hair = Buffer.Readbyte
```
then find
```
Call AddChar(Index, Name, Sex, Class, Sprite)
```
and replace with
```
Call AddChar(Index, Name, Sex, Class, Sprite, Hair)
```
Next, in modServerTCP, find
```
Function PlayerData
```
and under
```
Buffer.WriteLong GetPlayerLevel(Index)
```
Add
```
Buffer.Writebyte GetPlayerHair(Index)
```
And that's the server work. Now comes the client work.
CLIENT SIDE:
Like with the server, first go to modTypes, and in PlayerRec add
```
Hair As byte
```
at the bottom.
Then in modClientTCP find
```
Public Sub SendAddChar(ByVal Name As String, ByVal Sex As Long, ByVal ClassNum As Long, ByVal Sprite As Long)
```
and replace with
```
Public Sub SendAddChar(ByVal Name As String, ByVal Sex As Long, ByVal ClassNum As Long, ByVal Sprite As Long, ByVal Hair As byte)
```
and under
```
Buffer.WriteLong Sprite
```
Add
```
Buffer.Writebyte Hair
```
In modDatabase add, at the bottom or somewhere:
```
Public Sub CheckHair()
Dim i As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
i = 1
While FileExist(GFX_PATH & "Characters\hair\" & i & GFX_EXT)
NumHair = NumHair + 1
i = i + 1
Wend
If NumHair = 0 Then Exit Sub
ReDim DDS_Hair(1 To NumHair)
ReDim DDSD_Hair(1 To NumHair)
ReDim HairTimer(1 To NumHair)
frmMenu.scrlHair.Max = NumHair
' Error handler
Exit Sub
errorhandler:
HandleError "CheckHair", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
Function GetPlayerHair(ByVal Index As Long) As byte
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If Index > MAX_PLAYERS Then Exit Function
GetPlayerHair = Player(Index).Hair
' Error handler
Exit Function
errorhandler:
HandleError "GetPlayerSprite", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Function
End Function
Sub SetPlayerHair(ByVal Index As Long, ByVal Hair As byte)
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If Index > MAX_PLAYERS Then Exit Sub
Player(Index).Hair = Hair
' Error handler
Exit Sub
errorhandler:
HandleError "SetPlayerSprite", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
in modGlobals, under
```
Public newCharClass As Long
```
Add
```
Public newCharHair As byte
```
now, in modGeneral you have to find
```
Call SendAddChar
```
it will look somewhat like this:
```
If frmMenu.optMale.Value Then
Call SendAddChar(frmMenu.txtCName, SEX_MALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
Else
Call SendAddChar(frmMenu.txtCName, SEX_FEMALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite)
End If
```
replace it with this:
```
If frmMenu.optMale.Value Then
Call SendAddChar(frmMenu.txtCName, SEX_MALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite, newCharHair)
Else
Call SendAddChar(frmMenu.txtCName, SEX_FEMALE, frmMenu.cmbClass.ListIndex + 1, newCharSprite, newCharHair)
End If
```
go to modHandleData and find
```
Call SetPlayerLevel(i, Buffer.ReadLong)
```
and add under it
```
Call SetPlayerHair(i, Buffer.Readbyte)
```
in modDirectDraw7, somewhere along or under
```
Public DDS_Face() As DirectDrawSurface7
```
Add
```
Public DDS_Hair() As DirectDrawSurface7
```
Under
```
Public DDSD_Face() As DDSURFACEDESC2
```
Add
```
Public DDSD_Hair() As DDSURFACEDESC2
```
, under
```
Public FaceTimer() As Long
```
Add
```
Public HairTimer() As Long
```
Under
```
Public NumFaces As Long
```
Add
```
Public NumHair As Long
```
under
```
Call CheckFaces
```
in Sub main, modgeneral, add
```
Call CheckHair
```
find BltPlayer and at the top add
```
Dim Hair As Byte
Dim recHair As DxVBLib.RECT
```
Then under```
Sprite = GetPlayerSprite(Index)
```
Add
```
Hair = GetPlayerHair(Index)
```
Then Under
```
If Sprite < 1 Or Sprite > NumCharacters Then Exit Sub
```
Add
```
If Hair < 1 Or Hair > NumHair Then Exit Sub
```
Then Under
```
CharacterTimer(Sprite) = GetTickCount + SurfaceTimerMax
```
Add
```
HairTimer(Hair) = GetTickCount + SurfaceTimerMax
```
Under
```
If DDS_Character(Sprite) Is Nothing Then
Call InitDDSurf("characters\" & Sprite, DDSD_Character(Sprite), DDS_Character(Sprite))
End If
```
Add
```
If DDS_Hair(Hair) Is Nothing Then
Call InitDDSurf("characters\hair\" & Hair, DDSD_Hair(Hair), DDS_Hair(Hair))
End If
```
Under
```
' Set the left
Select Case GetPlayerDir(Index)
Case DIR_UP
spritetop = 3
Case DIR_RIGHT
spritetop = 2
Case DIR_DOWN
spritetop = 0
Case DIR_LEFT
spritetop = 1
End Select
```
Add
```
With recHair
.Top = spritetop * (DDSD_Hair(Hair).lHeight / 4)
.Bottom = .Top + (DDSD_Hair(Hair).lHeight / 4)
.Left = Anim * (DDSD_Hair(Hair).lWidth / 4)
.Right = .Left + (DDSD_Hair(Hair).lWidth / 4)
End With
```
Under
```
' render the actual sprite
Call BltSprite(Sprite, x, y, recSprite)
```
Add
```
Call BltHair(Hair, x, y, recHair)
```
and at the bottom or somewhere in the module add
```
Public Sub BltHair(ByVal Hair As Byte, ByVal x2 As Long, ByVal y2 As Long, rec As DxVBLib.RECT)
Dim x As Long
Dim y As Long
Dim Width As Long
Dim Height As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If Hair < 1 Or Hair > NumHair Then Exit Sub
x = ConvertMapX(x2)
y = ConvertMapY(y2)
Width = (rec.Right - rec.Left)
Height = (rec.Bottom - rec.Top)
' clipping
If y < 0 Then
With rec
.Top = .Top - y
End With
y = 0
End If
If x < 0 Then
With rec
.Left = .Left - x
End With
x = 0
End If
If y + Height > DDSD_BackBuffer.lHeight Then
rec.Bottom = rec.Bottom - (y + Height - DDSD_BackBuffer.lHeight)
End If
If x + Width > DDSD_BackBuffer.lWidth Then
rec.Right = rec.Right - (x + Width - DDSD_BackBuffer.lWidth)
End If
' /clipping
Call Engine_BltFast(x, y, DDS_Hair(Hair), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
' Error handler
Exit Sub
errorhandler:
HandleError "BltHair", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
Public Sub NewCharacterBltHair()
Dim sRECT As DxVBLib.RECT
Dim dRECT As DxVBLib.RECT
Dim Width As Long, Height As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If newCharHair < 1 Or newCharHair > NumHair Then
frmMenu.picHair.Cls
Exit Sub
End If
HairTimer(newCharHair) = GetTickCount + SurfaceTimerMax
If newCharHair > 0 Then
If DDS_Hair(newCharHair) Is Nothing Then
Call InitDDSurf("characters\hair\" & newCharHair, DDSD_Hair(newCharHair), DDS_Hair(newCharHair))
End If
End If
Width = DDSD_Hair(newCharHair).lWidth / 4
Height = DDSD_Hair(newCharHair).lHeight / 4
frmMenu.picHair.Width = Width
frmMenu.picHair.Height = Height
sRECT.Top = 0
sRECT.Bottom = sRECT.Top + Height
sRECT.Left = 0
sRECT.Right = sRECT.Left + Width
dRECT.Top = 0
dRECT.Bottom = Height
dRECT.Left = 0
dRECT.Right = Width
Call Engine_BltToDC(DDS_Hair(newCharHair), sRECT, dRECT, frmMenu.picHair)
' Error handler
Exit Sub
errorhandler:
HandleError "NewCharacterBltHair", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
in sub NewCharacterBltSprite, change
```
If frmMenu.optMale.Value = True Then
Sprite = Class(frmMenu.cmbClass.ListIndex + 1).MaleSprite(newCharSprite)
Else
Sprite = Class(frmMenu.cmbClass.ListIndex + 1).FemaleSprite(newCharSprite)
End If
```
to
```
If frmMenu.optMale.Value = True Then
Sprite = newCharSprite
Else
Sprite = newCharSprite
End If
```
Now open up frmMenu and make sure you've got picCharacter in front (make sure you can see the "new character" menu box), then add:
> A hscrollbar that will act as a button to change the sprite, named scrlSprite
> A hscrollbar that will act as a button to change the hair named scrlHair
> A picturebox called picHair, same size as picSprite
Now, inside frmMenu's code, add…
```
Private Sub scrlHair_Change()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If newCharHair >= scrlHair.Max Then
newCharHair = 0
Else
newCharHair = scrlHair.Value
End If
NewCharacterBltHair
' Error handler
Exit Sub
errorhandler:
HandleError "scrlShirt_Change", "frmMenu", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
Private Sub scrlSprite_Change()
Dim spritecount As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If optMale.Value Then
spritecount = UBound(Class(cmbClass.ListIndex + 1).MaleSprite)
Else
spritecount = UBound(Class(cmbClass.ListIndex + 1).FemaleSprite)
End If
If newCharSprite >= scrlSprite.Max Then
newCharSprite = 0
Else
newCharSprite = scrlSprite.Value
End If
NewCharacterBltSprite
' Error handler
Exit Sub
errorhandler:
HandleError "scrlSprite_Change", "frmMenu", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
```
Add
```
newCharHair = 1
```
under
```
' Load the username + pass
txtLUser.text = Trim$(Options.Username)
If Options.SavePass = 1 Then
txtLPass.text = Trim$(Options.Password)
chkPass.Value = Options.SavePass
End If
```
EDIT
forgot to put in the cleanup code xd
in ModGameLogic, somewhere beneath "' * Check surface timers *"
add
```
If NumHair > 0 Then
For i = 1 To NumHair 'Check to unload surfaces
If HairTimer(i) > 0 Then 'Only update surfaces in use
If HairTimer(i) < Tick Then 'Unload the surface
Call ZeroMemory(ByVal VarPtr(DDSD_Hair(i)), LenB(DDSD_Hair(i)))
Set DDS_Hair(i) = Nothing
HairTimer(i) = 0
End If
End If
Next
End If
```
then in modDirectDraw7, in sub DestroyDirectDraw add
```
For i = 1 To NumHair
Set DDS_Hair(i) = Nothing
ZeroMemory ByVal VarPtr(DDSD_Hair(i)), LenB(DDSD_Hair(i))
Next
```
that's all the code! Now, for the non-code stuff.
Inside the client folder, in "data files\graphics\characters", create a new folder called hair
Add your numbered hair files.
You will also have to replace the classes sprites with hairless/bald sprites so the hair isn't drawn over more hair
please note this is untested, since i ripped it from my heavily modded source, could be i forgot something xd
this is based on > [http://www.touchofde…air-hair-color/](http://www.touchofdeathforums.com/community/index.php?/topic/132296-eo-30-character-customization-hair-hair-color/)
premade clean Eo > http://freemmorpgmaker.com/uploadfiles/ba78e7f84aca93d16bf72291ae559c55.zip -
just 1 thing, the coloring is not gonna happen, i use premade hair images.
-
i got it working in dx7, ill release a tut when i clean it up ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
-
lol… this again? xd
-
win8 sucks, wait for 9, 8 is the new windows ME ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
-
trust me, the only source floating around of cyrus's his game is crap.
make it yourself, it not that hard… -
hmm, perhaps its me, but it errors on loading screen, rte 9, unrecoverable dx8 error
highlighting>
```
Set gTexture(TextureNum).Texture = Direct3DX8.CreateTextureFromFileInMemoryEx(D3DDevice8, _
ImageData(0), _
UBound(ImageData) + 1, _
newWidth, _
newHeight, _
D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_NONE, ByVal (0), ByVal 0, ByVal 0)
```
nvm, i got it, the picture was the fault, i re-saved it in paint.net and it works ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) -
well, thanx for trying man :-)
guess its to much for dx7 ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) -
hope you figure that out, because i have a whole system ready, eyes, shirt, base sprite, hair and pants.
![](http://freemmorpgmaker.com/uploadfiles/ee92aa5892cb75555d79840e908cc5d5.png)
but that looks awfull xd -
i dunno whats to understand , its just so we can modify our characters, while creating a new one.
so you select a hairtype, and it shows on the sprite preview on char create screen.
select different clothes, and the clothes on the preview change etc.
like here > http://www.touchofdeathforums.com/community/index.php?/topic/123485-csde-character-customization-gender-hair/
but then in a dx7 EO -
errr… any code to show what you mean?
-
thanx for trying man, thats as far as i came too ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
Y U NO GO TRANSPARENT??!! -
its dx7 mate ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
-
so… i been trying to get some modifications in a normal 2.0 eo.
things like hair etc, which works wonderfull ingame, because we can draw ontop of things ingame, but that wont work in the create character screen on the main menu, so my question is, does anybody know a way to get that to work?
thanx in advance ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) -
i would'nt do that, maps get bigger with more layers.
client are just copies. -
![](http://freemmorpgmaker.com/uploadfiles/4c3a6d4b59bd2c8e32a8bd709d9239c8.png)
fine on my end… -
delete your client side maps ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
it still has old ones ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
![](http://freemmorpgmaker.com/uploadfiles/b7c2edac17da0ff1f3e0d8515047cfb9.png) -
and done, i send it in pm ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
Hair Customization for EO DX7
in Source
Posted