Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Sprite for Male and Female
#1
Alright, so what this tutorial will basically do is let you choose a sprite for the male version of a class and the female version of a class! Smile This is all server side too Big Grin

Go look for the following lines, in modTypes :
Code:
Type ClassRec
    Name As String * NAME_LENGTH
    
    Sprite As Integer
    
    Stat(1 To Stats.Stat_Count - 1) As Byte
End Type

and replace the Sprite as Integer with :

Code:
MSprite as Integer
FSprite as Integer

Now, in sub LoadClasses (modDatabase), look for the line :
Code:
Class(i).Sprite = Val(GetVar(FileName, "CLASS" & i, "Sprite"))

and replace it with :

Code:
Class(i).MSprite = Val(GetVar(FileName, "CLASS" & i, "MSprite"))
Class(i).FSprite = Val(GetVar(FileName, "CLASS" & i, "FSprite"))
.

In sub SaveClasses (modDatabase), look for :

Code:
Call PutVar(FileName, "CLASS" & i, "Sprite", CStr(Class(i).Sprite))

and replace it with :

Code:
Call PutVar(FileName, "CLASS" & i, "MSprite", CStr(Class(i).MSprite))
Call PutVar(FileName, "CLASS" & i, "FSprite", CStr(Class(i).FSprite))

So far so good Smile It's all pretty self explanatory, you're just changing the single sprite variable to two variables, one that holds the female sprite and one that holds the male sprite, and you're properly loading/saving it Smile Make sure you change (in your classes.ini) :

Quote:Sprite=###


to :

Quote:MSprite=Male Sprite ###
FSprite=Female Sprite ###
.

Now, we have to make sure the code in the part where the player is actually assigned the proper sprite. This is done in sub AddChar. Now, MS already has a system like this, but the problem with it is it assigns the player the same sprite, whether the player chooses Male or Female. This is represented by these lines :

Code:
If Player(Index).Char(CharNum).Sex = SEX_MALE Then
            Player(Index).Char(CharNum).Sprite = Class(ClassNum).Sprite
        Else
            Player(Index).Char(CharNum).Sprite = Class(ClassNum).Sprite
        End If

Just replace those lines with :

Code:
If Player(Index).Char(CharNum).Sex = SEX_MALE Then
            Player(Index).Char(CharNum).Sprite = Class(ClassNum).MSprite
        Else
            Player(Index).Char(CharNum).Sprite = Class(ClassNum).FSprite
        End If

And there you go! You now have a female and male sprite for each class! Smile
Reply
#2
How would I make it so when you create a new char you select which sprite you want to be?
Reply
#3
timster0 Wrote:How would I make it so when you create a new char you select which sprite you want to be?
There's a tutorial for that. Search for it
Reply
#4
timster0 Wrote:How would I make it so when you create a new char you select which sprite you want to be?

The very last part of the tutorial tells you exactly how to do this.

Read please.
Reply
#5
Fox, I may be wrong but I thought me meant it as the way MRPGE did it, with 2 arrows so you can select from a list of sprites to choose from
Reply
#6
Oh, thats easy then. You code it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)