Mirage Source http://www.miragesource.net/forums/ |
|
Race Sprites Tut http://www.miragesource.net/forums/viewtopic.php?f=183&t=6161 |
Page 1 of 57 |
Author: | ShadowMaster [ Sat Aug 22, 2009 8:13 pm ] |
Post subject: | Race Sprites Tut |
So what this tutorial will basically do is let you choose a sprite for the male version of a race and the female version of a race! This is all server side too. I use MS 3.07 for this tut. 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 remove the Sprite as Integer. Next I add a new Rec called RaceRec Type RaceRec Name As String * NAME_LENGTH MSprite as Integer FSprite as Integer Stat(1 To Stats.Stat_Count - 1) As Byte End Type Next I copy the LoadClasses(modDatabase) as a new sub and renamed it to LoadRaces. I also change all Class() to Race(). Now, in the LoadClasses (modDatabase), look for the line : Code: Class(i).Sprite = Val(GetVar(FileName, "CLASS" & i, "Sprite")) and remove it. Now, in the LoadRaces (modDatabase), look for the line : Code: Race(i).Sprite = Val(GetVar(FileName, "Race" & i, "Sprite")) and replace it with: Code: Race(i).MSprite = Val(GetVar(FileName, "RACE" & i, "MSprite")) Race(i).FSprite = Val(GetVar(FileName, "RACE" & i, "FSprite")) Next I copy the SaveClasses(modDatabase) to make a new sub called SaveRaces. I rename the Class() to Race(). In sub SaveClasses (modDatabase), look for : Code: Call PutVar(FileName, "CLASS" & i, "Sprite", CStr(Class(i).Sprite)) and remove it In sub SaveRaces (modDatabase), look for : Code: Call PutVar(FileName, "RACE" & i, "Sprite", CStr(Race(i).Sprite)) and replace it with : Code: Call PutVar(FileName, "RACE" & i, "MSprite", CStr(Race(i).MSprite)) Call PutVar(FileName, "RACE" & i, "FSprite", CStr(Race(i).FSprite)) So far so good. 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 Make sure you remove (in your classes.ini) : Quote: Sprite=### And that you make a new ini file called races.ini that basically have same stuff as classes.ini before the remove, but that the follow change: 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. But you need to add "RaceNum" after ClassNum in AddChar. 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 = Race(RaceNum).MSprite Else Player(Index).Char(CharNum).Sprite = Race(RaceNum).FSprite End If And there you go! You now have a female and male sprite for each race and that you basically create a Race System! |
Author: | Matt [ Sat Aug 22, 2009 8:33 pm ] |
Post subject: | Re: Race Sprites Tut |
Use code tags please. |
Author: | Nean [ Sun Aug 23, 2009 3:45 am ] |
Post subject: | Re: Race Sprites Tut |
Not sure if it's like this because you didn't use code tags, but make sure you format your code properly, otherwise it's too much trouble to actually go through and read. |
Author: | GIAKEN [ Sun Aug 23, 2009 4:08 am ] |
Post subject: | Re: Race Sprites Tut |
It's formatted. You can see the spaces when you quote it. |
Author: | KruSuPhy [ Sun Aug 23, 2009 4:20 am ] |
Post subject: | Re: Race Sprites Tut |
It feels like copy and paste Dx |
Author: | Labmonkey [ Sun Aug 23, 2009 7:01 pm ] |
Post subject: | Re: Race Sprites Tut |
yea, thats how a tutorial will look if you copy and paste the exact text from another forum (not the bbcode). |
Author: | wanai [ Sat Jan 08, 2022 3:45 pm ] |
Post subject: | Re: Race Sprites Tut |
Econ |
Author: | wanai [ Sat Jan 08, 2022 3:46 pm ] |
Post subject: | Re: Race Sprites Tut |
122.29 |
Author: | wanai [ Sat Jan 08, 2022 3:47 pm ] |
Post subject: | Re: Race Sprites Tut |
Bett |
Author: | wanai [ Sat Jan 08, 2022 3:49 pm ] |
Post subject: | Re: Race Sprites Tut |
Bett |
Author: | wanai [ Sat Jan 08, 2022 3:50 pm ] |
Post subject: | Re: Race Sprites Tut |
Dark |
Author: | wanai [ Sat Jan 08, 2022 3:51 pm ] |
Post subject: | Re: Race Sprites Tut |
Fann |
Author: | wanai [ Sat Jan 08, 2022 3:52 pm ] |
Post subject: | Re: Race Sprites Tut |
Jewe |
Author: | wanai [ Sat Jan 08, 2022 3:53 pm ] |
Post subject: | Re: Race Sprites Tut |
Jean |
Author: | wanai [ Sat Jan 08, 2022 3:54 pm ] |
Post subject: | Re: Race Sprites Tut |
Herv |
Author: | wanai [ Sat Jan 08, 2022 3:55 pm ] |
Post subject: | Re: Race Sprites Tut |
Krem |
Author: | wanai [ Sat Jan 08, 2022 3:56 pm ] |
Post subject: | Re: Race Sprites Tut |
Gran |
Author: | wanai [ Sat Jan 08, 2022 3:57 pm ] |
Post subject: | Re: Race Sprites Tut |
Dhab |
Author: | wanai [ Sat Jan 08, 2022 3:59 pm ] |
Post subject: | Re: Race Sprites Tut |
BOOK |
Author: | wanai [ Sat Jan 08, 2022 4:00 pm ] |
Post subject: | Re: Race Sprites Tut |
Orie |
Author: | wanai [ Sat Jan 08, 2022 4:01 pm ] |
Post subject: | Re: Race Sprites Tut |
Bris |
Author: | wanai [ Sat Jan 08, 2022 4:02 pm ] |
Post subject: | Re: Race Sprites Tut |
Tefa |
Author: | wanai [ Sat Jan 08, 2022 4:03 pm ] |
Post subject: | Re: Race Sprites Tut |
Jame |
Author: | wanai [ Sat Jan 08, 2022 4:04 pm ] |
Post subject: | Re: Race Sprites Tut |
Fisk |
Page 1 of 57 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |