Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display Sprites on Character Create
#1
[edit by Lea] This tutorial works in MSE2 and below. If using a newer version, please view the updated tutorial at the link below. On page three of this thread, the discussion switches! Thanks!
http://www.valkoria.com/CharCreateSprit ... SE3_50.pdf


Author: grimsk8ter11
Difficulty: 2/5

:: SERVER SIDE ::
In modServerTCP, replace all of SendNewCharClasses with:
Code:
Sub SendNewCharClasses(ByVal Index As Long)
Dim Packet As String
Dim i As Long

    Packet = "NEWCHARCLASSES" & SEP_CHAR & Max_Classes & SEP_CHAR
    For i = 0 To Max_Classes
        Packet = Packet & GetClassName(i) & SEP_CHAR & GetClassMaxHP(i) & SEP_CHAR & GetClassMaxMP(i) & SEP_CHAR & GetClassMaxSP(i) & SEP_CHAR & Class(i).STR & SEP_CHAR & Class(i).DEF & SEP_CHAR & Class(i).SPEED & SEP_CHAR & Class(i).MAGI & SEP_CHAR & Class(i).Sprite & SEP_CHAR
    Next i
    Packet = Packet & END_CHAR
    
    Call SendDataTo(Index, Packet)
End Sub

:: CLIENT SIDE ::
In frmNewChar, make 2 picture boxes, name them: picpic and picSprite.
picpic Properties:
Code:
Size 32x32
border style = none
appearance = flat

picSprites Properties:
Code:
Size 32x32
border style = none
appearance = flat
visible = false
auto redraw = true
auto resize = true
Make a timer named Timer. Give it the properties:
Code:
enabled = true
interval = 50

Timer Code:
Code:
On Error Resume Next
If optMale.Value = True Then
    Call BitBlt(picpic.hDC, 0, 0, PIC_X, PIC_Y, picSprites.hDC, 0, Int(Class(cmbClass.ListIndex).Sprite) * PIC_Y, SRCCOPY)
Else
    Call BitBlt(picpic.hDC, 0, 0, PIC_X, PIC_Y, picSprites.hDC, 0, Int(Class(cmbClass.ListIndex).Sprite) * PIC_Y, SRCCOPY)
End If

Finally, add a Form_Load sub for the form and put the following inside of it:
Code:
picSprites.Picture = LoadPicture(App.Path & "\sprites.bmp")


In modHandleData, find:
Code:
"newcharclasses"

Replace from:
Code:
n = n + 1
Down to:
Code:
Next i
With:
Code:
n = n + 1

For i = 0 To Max_Classes
    Class(i).Name = Parse(n)
    
    Class(i).HP = Val(Parse(n + 1))
    Class(i).MP = Val(Parse(n + 2))
    Class(i).SP = Val(Parse(n + 3))
    
    Class(i).Str = Val(Parse(n + 4))
    Class(i).DEF = Val(Parse(n + 5))
    Class(i).SPEED = Val(Parse(n + 6))
    Class(i).MAGI = Val(Parse(n + 7))
    Class(i).Sprite = Val(Parse(n + 8))
n = n + 9
Next i
That's all!
Reply
#2
Tutorial Bot Wrote:Finally, add a Form_Load sub for the form and put the following inside of it:
Code:
picSprites.Picture = LoadPicture(App.Path & "\sprites.bmp")


Hmm, this is my first time every coding, scripting, or even looking at a source.... I tried doing this and it gave me an error.. should it be:

Code:
picSprites.Picture = LoadPicture(App.Path & "\Gfx\sprites.bmp")

Sorry I'm still a noob, but I really want to learn! Just wanted to know if this was the right way..
Reply
#3
It works, but the sprite is backwards.. like the character is facing up so you cant see the sprite's face...
Reply
#4
add a "+ 96" to the left + right rec.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
or a + (3 * PIC_X)
Reply
#6
Or (35*2+26)
Reply
#7
I get the point.. thanks everyone! Confusedhock:
Reply
#8
Sry to Necro XD


I have a problem
WHen I go to create a new char, it hi-lites:
Quote:Sub SendNewCharClasses(ByVal Index As Long)
Dim Packet As String
Dim i As Long

Packet = "NEWCHARCLASSES" & SEP_CHAR & Max_Classes & SEP_CHAR
For i = 0 To Max_Classes
Packet = Packet & GetClassName(i) & SEP_CHAR & GetClassMaxHP(i) & SEP_CHAR & GetClassMaxMP(i) & SEP_CHAR & GetClassMaxSP(i) & SEP_CHAR & Class(i).STR & SEP_CHAR & Class(i).DEF & SEP_CHAR & Class(i).SPEED & SEP_CHAR & Class(i).MAGI & SEP_CHAR & Class(i).Sprite & SEP_CHAR
Next i
Packet = Packet & END_CHAR

Call SendDataTo(Index, Packet)
End Sub

Any ideas?
Reply
#9
Does it give you an error?
Reply
#10
oh yes forgot that.

It gives me:

Quote:Compile Error:

Method or data member not found
Reply
#11
That error means it can't find Class(i).Str .

Have you edited the ClassRec?
Reply
#12
I don't think so Undecided..I'll so see what's wrong with ClassRec
Reply
#13
Yep Fixed. thanks. I accidentally did another tut wrong XD.
Reply
#14
I got the same error what was causing it because i am using a fresh MS3.
Reply
#15
Dugor Wrote:That error means it can't find Class(i).Str .

Have you edited the ClassRec?

In MSE3 there is no Class(i).Str. I changed the structure for stats.

Class(i).Stat(Stats.Strength)
Reply
#16
"Error #9, Subscript Out of Range."
:?

By the way, sorry for necro-ing,(now that I noticed.)
Reply
#17
Jesus christ people, use your common sense xD

This tutorial is for a blank MS.

If you've changed it, or us the new MS3.20 + then you'll have to change it to work with your source.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#18
Common sense isn't common. Smile

If it was, the Internet wouldn't be such a fun-to-flame place. ;D
Reply
#19
I was thinking of posting a new tutorial for this when I do the character creation for Merrimint.
Reply
#20
This was made back in the day when most of us were pretty gimp. ;D
Reply
#21
DFA Wrote:ban bitblt =(

FFS, why are you guys using MS3.0.3 still? I did everything you guys asked for, even got the license dropped...

For these tutorials...i think someone, either robin or me, needs to validate the quality of the tutorials. This should definitely be disapproved for usage of BitBlt when DirectDraw is capable.

that was for me wasnt it XD
Reply
#22
This tutorial is useful for people too... slow... to use timers.

Just switch it around to use BltToDC.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#23
Anthony Wrote:I was thinking of posting a new tutorial for this when I do the character creation for Merrimint.

I already did this in Merrimint.

Tongue

The way DFA is saying to do it.
Reply
#24
You still used a picture box and a timer though.

I want to do it without either Smile.
Reply
#25
There's really no need for a loop on that part of the game as it's rarely used and only used for the person creating a character.
Reply


Forum Jump:


Users browsing this thread: