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

[CS:DE] Paperdoll


Sheker
 Share

Recommended Posts

Hey guys! Sorry for bugging you once again. So, I want to have paperdoll in CS:DE and Robin said in the forums that "All you have to do is render it"

So I open up VB6 and scroll to the render sub of modDX8 and I am assuming I should call Draw Paperdoll if the player is obviously wearing something with the paperdoll property. But I do not know what to put at the start (the "if ____ then")

Could anybody help me? (and possibly even give me the code, if that was not much of a hassle)
Link to comment
Share on other sites

I am completely clueless at coding in VB6.
```
Public Sub BltPaperdoll(ByVal x2 As Long, ByVal y2 As Long, ByVal Sprite As Long, ByVal Anim As Long, ByVal spritetop As Long)
Dim x As Long, y As Long
Dim width As Long, height As Long
Dim rec As GeomRec

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Sprite < 1 Or Sprite > Count_Paperdoll Then Exit Sub

    With rec
        .top = spritetop * (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .height = (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .left = Anim * (D3DT_TEXTURE(Tex_Char(Sprite)).width / 4)
        .width = .left + (D3DT_TEXTURE(Tex_Char(Sprite)).width / 4)
    End With

    ' clipping
    x = ConvertMapX(x2)
    y = ConvertMapY(y2)
    width = (rec.width - rec.left)
    height = (rec.height - rec.top)

    ' Clip to screen
    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

    RenderTexture Tex_Paperdoll(Sprite), ConvertMapX(x), ConvertMapY(y), rec.left, rec.top, rec.width, rec.height, rec.height
End Sub
```Could anyone fix this code for me? Whenever I try to compile, it says that RenderTexture is not an optional argument.
Link to comment
Share on other sites

NOT an optional argument means you didn't pass all the arguments corectly

```
Sub DoSomethin ( x as long, y as long, z as long) ' right here every sub/function has a set number of arguments, and normally you must fill them all in when calling the sub.

DO STUFF

End Sub

```

```
Call DoSomthing (x, y, z) 'When calling you have to put something in for every argument.

```
Hope this helps.
Link to comment
Share on other sites

Thank you! Now the error doesn't come up for that sub, but now it appears for drawplayer!
Here's both subs code:
```
Public Sub BltPaperdoll(ByVal x2 As Long, ByVal y2 As Long, ByVal Sprite As Long, ByVal Anim As Long, ByVal spritetop As Long, ByVal index As Long)
Dim x As Long, y As Long
Dim Width As Long, height As Long
Dim rec As GeomRec

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Sprite < 1 Or Sprite > Count_Paperdoll Then Exit Sub

    With rec
        .top = spritetop * (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .height = (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .left = Anim * (D3DT_TEXTURE(Tex_Char(Sprite)).Width / 4)
        .Width = .left + (D3DT_TEXTURE(Tex_Char(Sprite)).Width / 4)
    End With

    ' clipping
    x = ConvertMapX(x2)
    y = ConvertMapY(y2)
    Width = (rec.Width - rec.left)
    height = (rec.height - rec.top)

    ' Clip to screen
    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

    RenderTexture Tex_Paperdoll(Sprite), ConvertMapX(x), ConvertMapY(y), rec.left, rec.top, rec.Width, rec.height
End Sub
```
```
Public Sub DrawPlayer(ByVal index As Long)
    Dim Anim As Byte
    Dim i As Long
    Dim x As Long
    Dim y As Long
    Dim Sprite As Long, spritetop As Long
    Dim rec As GeomRec
    Dim attackspeed As Long

    ' pre-load sprite for calculations
    Sprite = GetPlayerSprite(index)
    'SetTexture Tex_Char(Sprite)

    If Sprite < 1 Or Sprite > Count_Char Then Exit Sub

    ' speed from weapon
    If GetPlayerEquipment(index, Weapon) > 0 Then
        attackspeed = Item(GetPlayerEquipment(index, Weapon)).speed
    Else
        attackspeed = 1000
    End If

    If Not isConstAnimated(GetPlayerSprite(index)) Then
        ' Reset frame
        Anim = 1
        ' Check for attacking animation
        If Player(index).AttackTimer + (attackspeed / 2) > GetTickCount Then
            If Player(index).Attacking = 1 Then
                Anim = 2
            End If
        Else
            ' If not attacking, walk normally
            Select Case GetPlayerDir(index)
                Case DIR_UP
                    If (Player(index).yOffset > 8) Then Anim = Player(index).Step
                Case DIR_DOWN
                    If (Player(index).yOffset < -8) Then Anim = Player(index).Step
                Case DIR_LEFT
                    If (Player(index).xOffset > 8) Then Anim = Player(index).Step
                Case DIR_RIGHT
                    If (Player(index).xOffset < -8) Then Anim = Player(index).Step
            End Select
        End If
    Else
        If Player(index).AnimTimer + 100 <= GetTickCount Then
            Player(index).Anim = Player(index).Anim + 1
            If Player(index).Anim >= 3 Then Player(index).Anim = 0
            Player(index).AnimTimer = GetTickCount
        End If
        Anim = Player(index).Anim
    End If

    ' Check to see if we want to stop making him attack
    With Player(index)
        If .AttackTimer + attackspeed < GetTickCount Then
            .Attacking = 0
            .AttackTimer = 0
        End If
    End With

    ' 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

    With rec
        .top = spritetop * (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .height = (D3DT_TEXTURE(Tex_Char(Sprite)).height / 4)
        .left = Anim * (D3DT_TEXTURE(Tex_Char(Sprite)).Width / 4)
        .Width = (D3DT_TEXTURE(Tex_Char(Sprite)).Width / 4)
    End With

    ' Calculate the X
    x = GetPlayerX(index) * PIC_X + Player(index).xOffset - ((D3DT_TEXTURE(Tex_Char(Sprite)).Width / 4 - 32) / 2)

    ' Is the player's height more than 32..?
    If (D3DT_TEXTURE(Tex_Char(Sprite)).height) > 32 Then
        ' Create a 32 pixel offset for larger sprites
        y = GetPlayerY(index) * PIC_Y + Player(index).yOffset - ((D3DT_TEXTURE(Tex_Char(Sprite)).height / 4) - 32) - 4
    Else
        ' Proceed as normal
        y = GetPlayerY(index) * PIC_Y + Player(index).yOffset - 4
    End If

    For i = 1 To UBound(PaperdollOrder)
        If GetPlayerEquipment(index, PaperdollOrder(i)) > 0 Then
            If Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll > 0 Then
                Call BltPaperdoll(x, y, Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
            End If
        End If
    Next

    RenderTexture Tex_Char(Sprite), ConvertMapX(x), ConvertMapY(y), rec.left, rec.top, rec.Width, rec.height, rec.Width, rec.height
End Sub
```
EDIT: Whoops. Forgot to mention that Call BltPaperdoll was highlighted as "Argument not optional" after I fixed the first sub.
Link to comment
Share on other sites

@Ryoku:

> NOT an optional argument means you didn't pass all the arguments corectly
>
> ```
> Sub DoSomethin ( x as long, y as long, z as long) ' right here every sub/function has a set number of arguments, and normally you must fill them all in when calling the sub.
>
> DO STUFF
>
> End Sub
>
> ```
>
> ```
> Call DoSomthing (x, y, z) 'When calling you have to put something in for every argument.
>
> ```
> Hope this helps.

DID THIS NOT REALLY HELP!?!?! >.<

when you add arguments to ANYTHING you have to also when you call you must enter DATA FOR THEM ALL!!!

If you have 4 arguments you call with 4 variables or constants.

if you have 3 you call with 3

if you have 10 you call with 10…

ECT.

when it says argument not optional you are missing

Call DoSomthing (x, y, z)  <=== SOME OF THESE
Link to comment
Share on other sites

So sorry! I didn't understand the first time.. I finally got that fixed! But now it has an error in here:

```
For i = 0 To UBound(PaperdollOrder)
        If GetPlayerEquipment(index, PaperdollOrder(i)) > 0 Then
            If Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll > 0 Then
                Call BltPaperdoll(x, y, Item(GetPlayerEquipment(index, PaperdollOrder(i))).Paperdoll, Anim, spritetop)
            End If
        End If
    Next
```
highlighting UBound saying "Compile Error - Expected Array"
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...