Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Sprite based paperdoll (or gender based)


Fragment
 Share

Recommended Posts

This is by no means the best way to add this feature, however, this is quite useful to several members of the forum and it is better than nothing.

[CLIENT SIDE ONLY]
In modDirectDraw7 > BltPlayer replace the code

```
Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
```
with this

```
                If Sprite = 1 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
                ElseIf Sprite = 2 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, Anim, spritetop)
                End If
```

You can have as many ElseIfs as you like with as many sprite checks as you want.

This code will simply check the players sprite, if they are using sprite 1 (male in my case) it will paperdoll as normal. If they are using sprite 2 (female in my case) it will add one on to the paperdoll.

This means that if your male paperdoll is called 1.bmp, then you must make the female paperdoll called 2.bmp.

The downside to this is that every paperdoll now has to have 2 images as a minimum (even if they are the same).

I have added this tutorial with the hope that someone more advance than me can explain how to allow the player to set the paperdoll images using the item editor.
Link to comment
Share on other sites

with your code if sprite = 3 or more it wont blit any paperdoll
try this instead

**SERVER SIDE**
in modPlayer add anywhere this function
```
Function GetPlayerSex(ByVal index As Long) As Byte
    If index > MAX_PLAYERS Then Exit Function
    GetPlayerSex = Player(index).Sex
End Function

```
in modServerTCP find the function PlayerData
under
```
Buffer.WriteLong GetPlayerPK(index)
```
add
```
Buffer.WriteLong GetPlayerSex(index)
```
**CLIENT SIDE**
at modTypes in the PlayerRec type add
```
Sex as byte
```
then in modDatabase add this sub
```
Function GetPlayerSex(ByVal index As Long) As Byte
    If index > MAX_PLAYERS Then Exit Function
    GetPlayerSex = Player(index).Sex
End Function

Sub SetPlayerSex(ByVal index As Long, ByVal Sex As Byte)
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If index > MAX_PLAYERS Then Exit Sub
    Player(index).Sex = Sex

    Exit Sub
errorhandler:
    HandleError "SetPlayerSex", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
the in modHandleData in the sub HandlePlayerData
under
```
Call SetPlayerPK(i, Buffer.ReadLong)
```
add
```
Call SetPlayerSex(i, Buffer.Readbyte)
```
now go to modDirectDraw7 in the BltPlayer sub
replace
```
Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
```
with
```
If GetPlayerSex(index) = 1 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
ElseIf GetPlayerSex(index)  = 2 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, Anim, spritetop)
                End If

```

dont know if this works havent tested it
Link to comment
Share on other sites

Yea, the idea was if you have more sprits you would add a switch and have a case for each sprite or just add more else statements.
For me i only have 2 'naked' sprites so thats all i needed, either way, your method still just adds one onto it except it is now dependant on sex (which means more data being sent).
Your way might be useful for most people, however, i personally find that mine is just as good.
Link to comment
Share on other sites

i never said yours isn't good i just think its a bit limited. you will have to edit the source every time you add a sprite. anyway i posted because you wrote that you wanted someone (skipping more advanced XP) to show you how to do it. i meant no offense =)
Link to comment
Share on other sites

Dont worry, none taken i was just saying that although yours is better, for those who use a system like me with only 2 sprites (one male one female) they are better off just using the original method as it uses less bandwidth to send information than the second.

Edit: i might actually use your way just out of lazyness for the exact reason you stated, just incase i decide to add skin colours to the naked sprites
Link to comment
Share on other sites

  • 1 month later...
Just like to add that this is the correct code fixed for the post above:

                If GetPlayerSex(index) = 0 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
                ElseIf GetPlayerSex(index) = 1 Then
                    Call BltPaperdoll(x, y, Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll + 1, Anim, spritetop)
                End If
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...