Mirage Source
http://miragesource.net/forums/

Display Sprites on Character Create
http://miragesource.net/forums/viewtopic.php?f=210&t=32
Page 1 of 4

Author:  Tutorial Bot [ Thu Jun 01, 2006 8:31 pm ]
Post subject:  Display Sprites on Character Create

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

Author:  Hikaru [ Sat Apr 12, 2008 1:49 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Lea [ Sat Apr 12, 2008 2:54 pm ]
Post subject:  Re: Display Sprites on Character Create

does it work?

Author:  Hikaru [ Sat Apr 12, 2008 3:07 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Robin [ Sat Apr 12, 2008 3:11 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Stomach Pulser [ Sat Apr 12, 2008 7:25 pm ]
Post subject:  Re: Display Sprites on Character Create

or a + (3 * PIC_X)

Author:  Joost [ Sun Apr 13, 2008 2:14 pm ]
Post subject:  Re: Display Sprites on Character Create

Or (35*2+26)

Author:  Lea [ Sun Apr 13, 2008 2:16 pm ]
Post subject:  Re: Display Sprites on Character Create

or CInt(97/5 + 76.6)

Author:  Hikaru [ Mon Apr 14, 2008 6:04 am ]
Post subject:  Re: Display Sprites on Character Create

I get the point.. thanks everyone! :shock:

Author:  Poyzin [ Fri Aug 15, 2008 3:18 pm ]
Post subject:  Re: Display Sprites on Character Create

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?

Author:  Jacob [ Fri Aug 15, 2008 3:53 pm ]
Post subject:  Re: Display Sprites on Character Create

Does it give you an error?

Author:  Poyzin [ Fri Aug 15, 2008 4:05 pm ]
Post subject:  Re: Display Sprites on Character Create

oh yes forgot that.

It gives me:

Quote:
Compile Error:

Method or data member not found

Author:  Jacob [ Fri Aug 15, 2008 5:01 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Have you edited the ClassRec?

Author:  Poyzin [ Fri Aug 15, 2008 6:50 pm ]
Post subject:  Re: Display Sprites on Character Create

I don't think so :-/..I'll so see what's wrong with ClassRec

Author:  Poyzin [ Fri Aug 15, 2008 11:06 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Jack [ Sat Aug 16, 2008 11:11 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Jacob [ Sun Aug 17, 2008 2:33 am ]
Post subject:  Re: Display Sprites on Character Create

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)

Author:  Junkyoner [ Tue Sep 02, 2008 2:59 am ]
Post subject:  Re: Display Sprites on Character Create

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

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

Author:  Robin [ Tue Sep 02, 2008 1:12 pm ]
Post subject:  Re: Display Sprites on Character Create

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.

Author:  Kousaten [ Tue Sep 02, 2008 8:16 pm ]
Post subject:  Re: Display Sprites on Character Create

Common sense isn't common. :)

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

Author:  Anthony [ Fri Sep 05, 2008 11:47 pm ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Kousaten [ Sat Sep 06, 2008 12:43 am ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Doomy [ Sat Sep 06, 2008 12:50 am ]
Post subject:  Re: Display Sprites on Character Create

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

Author:  Robin [ Sat Sep 06, 2008 10:35 am ]
Post subject:  Re: Display Sprites on Character Create

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

Just switch it around to use BltToDC.

Author:  Matt [ Sat Sep 06, 2008 1:58 pm ]
Post subject:  Re: Display Sprites on Character Create

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.

:P

The way DFA is saying to do it.

Page 1 of 4 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/