Mirage Source
Display Sprites on Character Create - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Display Sprites on Character Create (/showthread.php?tid=22)

Pages: 1 2 3


Display Sprites on Character Create - Tutorial Bot - 01-06-2006

[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!


Re: Display Sprites on Character Create - Hikaru - 12-04-2008

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..


Re: Display Sprites on Character Create - Hikaru - 12-04-2008

It works, but the sprite is backwards.. like the character is facing up so you cant see the sprite's face...


Re: Display Sprites on Character Create - Robin - 12-04-2008

add a "+ 96" to the left + right rec.


Re: Display Sprites on Character Create - Stomach Pulser - 12-04-2008

or a + (3 * PIC_X)


Re: Display Sprites on Character Create - Joost - 13-04-2008

Or (35*2+26)


Re: Display Sprites on Character Create - Hikaru - 14-04-2008

I get the point.. thanks everyone! Confusedhock:


Re: Display Sprites on Character Create - Poyzin - 15-08-2008

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?


Re: Display Sprites on Character Create - Jacob - 15-08-2008

Does it give you an error?


Re: Display Sprites on Character Create - Poyzin - 15-08-2008

oh yes forgot that.

It gives me:

Quote:Compile Error:

Method or data member not found



Re: Display Sprites on Character Create - Jacob - 15-08-2008

That error means it can't find Class(i).Str .

Have you edited the ClassRec?


Re: Display Sprites on Character Create - Poyzin - 15-08-2008

I don't think so Undecided..I'll so see what's wrong with ClassRec


Re: Display Sprites on Character Create - Poyzin - 15-08-2008

Yep Fixed. thanks. I accidentally did another tut wrong XD.


Re: Display Sprites on Character Create - Jack - 16-08-2008

I got the same error what was causing it because i am using a fresh MS3.


Re: Display Sprites on Character Create - Jacob - 17-08-2008

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)


Re: Display Sprites on Character Create - Junkyoner - 02-09-2008

"Error #9, Subscript Out of Range."
:?

By the way, sorry for necro-ing,(now that I noticed.)


Re: Display Sprites on Character Create - Robin - 02-09-2008

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.


Re: Display Sprites on Character Create - Kousaten - 02-09-2008

Common sense isn't common. Smile

If it was, the Internet wouldn't be such a fun-to-flame place. ;D


Re: Display Sprites on Character Create - Anthony - 05-09-2008

I was thinking of posting a new tutorial for this when I do the character creation for Merrimint.


Re: Display Sprites on Character Create - Kousaten - 06-09-2008

This was made back in the day when most of us were pretty gimp. ;D


Re: Display Sprites on Character Create - Doomy - 06-09-2008

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


Re: Display Sprites on Character Create - Robin - 06-09-2008

This tutorial is useful for people too... slow... to use timers.

Just switch it around to use BltToDC.


Re: Display Sprites on Character Create - Matt - 06-09-2008

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.


Re: Display Sprites on Character Create - Anthony - 06-09-2008

You still used a picture box and a timer though.

I want to do it without either Smile.


Re: Display Sprites on Character Create - Matt - 06-09-2008

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.