lcarens Posted October 29, 2012 Author Share Posted October 29, 2012 This allows you to use the same item on multiple genders, since the paperdoll will be dependent on the players gender.How it works is that you pick the paperdoll image that you wish to use for the male character, for example, I'll use '3'.The system will take that number, and if it's equipped on a male, it will use paperdoll image #3.HOWEVER, if it's equipped on a female, it will add +1 to that number, so it will use paperdoll image #4.How I'm using this is making all male paperdolls have odd image numbers, and female paperdolls have even image numbers.(Heavily based off bits of code written by blkcrow.)Client Side Edits:At the bottom of ModDatabase, add:```Function GetPlayerSex(ByVal Index As Long) As ByteIf Index > MAX_PLAYERS Then Exit FunctionGetPlayerSex = Player(Index).sexEnd FunctionSub SetPlayerSex(ByVal Index As Long, ByVal sex As Byte)If Index > MAX_PLAYERS Then Exit SubPlayer(Index).sex = sexEnd Sub```In modHandleData, in HandlePlayerData, add``` Call SetPlayerSex(i, buffer.ReadLong)```right below``` Call SetPlayerClass(i, buffer.ReadLong) ```In modTypes, in PlayerRec, add``` sex As Byte```right below``` PK As Byte```In modGraphics, in DrawPlayer, replace:```' check for paperdollingFor i = 1 To UBound(PaperdollOrder)If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 ThenIf Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, anim, spritetop)End IfEnd IfNext```with```' check for paperdollingFor i = 1 To UBound(PaperdollOrder)If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 ThenIf Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 ThenIf GetPlayerSex(Index) = 0 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, anim, spritetop)ElseIf GetPlayerSex(Index) = 1 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, anim, spritetop)End IfEnd IfEnd IfNext```Server Side Edits:At the bottom of ModPlayer, add:```Function GetPlayerSex(ByVal index As Long) As ByteIf index > MAX_PLAYERS Then Exit FunctionGetPlayerSex = Player(index).sexEnd Function```In modServerTCP, in PlayerData, add:``` Buffer.WriteByte GetPlayerSex(index)```right below``` buffer.WriteLong GetPlayerClass(index)```In modTypes, in PlayerRec, add:``` sex As Byte```right below``` PK As Byte``` Link to comment Share on other sites More sharing options...
lcarens Posted October 29, 2012 Author Share Posted October 29, 2012 For whatever reason, s e x is getting replaced with poontang. Could an admin look into this? Link to comment Share on other sites More sharing options...
Matt Posted October 30, 2012 Share Posted October 30, 2012 The reason it is being changed is because there's a filter. Same reason why the f word gets changed to duck.On Topic: Its a great and needed addition to most games. Good work! Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2012 Share Posted October 30, 2012 ```Buffer.WriteLong GetPlayerSex(index)```Why are you sending a long when the return value is a byte? Use WriteByte. Link to comment Share on other sites More sharing options...
Joyce Posted October 31, 2012 Share Posted October 31, 2012 Fixed the variables. Link to comment Share on other sites More sharing options...
lcarens Posted October 31, 2012 Author Share Posted October 31, 2012 > Its a great and needed addition to most games. Good work!Thank you!> Why are you sending a long when the return value is a byte? Use WriteByte.Derp. Thank you for catching that.> Fixed the variables.Thanks! Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 31, 2012 Share Posted October 31, 2012 nice job on this, keep up the good work ![^_^](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/happy.png) Link to comment Share on other sites More sharing options...
lcarens Posted November 3, 2012 Author Share Posted November 3, 2012 I just spent all morning trying to fix a glitch where all of the stats would show as 255.If anyone else is having that issue, the problem is because of this tutorial.In modHandleData, in HandlePlayerData, change:```Call SetPlayerSex(i, buffer.ReadByte)```to```Call SetPlayerSex(i, buffer.ReadLong)```Sorry for any issues this caused. >_<I was actually just about to open a topic to ask for help with this.The tutorial has been updated to reflect this. Link to comment Share on other sites More sharing options...
abhi2011 Posted November 4, 2012 Share Posted November 4, 2012 This doesn't allow usage of common paperdolls does it? Link to comment Share on other sites More sharing options...
Ertzel Posted November 4, 2012 Share Posted November 4, 2012 What do you mean by that? Like setting one paperdoll for both genders? if so, then you would just set both gender's paperdolls to the same image… Link to comment Share on other sites More sharing options...
abhi2011 Posted November 4, 2012 Share Posted November 4, 2012 Yea something like that.> if so, then you would just set both gender's paperdolls to the same image…> > Does that mean making 2 paperdolls just so that you can use it for 2 genders? (I mean common item paperdolls like swords, kinves and stuff that souldn't change even if a diff gender) Link to comment Share on other sites More sharing options...
or3o Posted November 4, 2012 Share Posted November 4, 2012 even swords and such arent going to line up across 2 paperdolls anyway, it would be better 2 have two seperate ones than 2 that dont match one of the sprites. if you wanna make common paperdolls just add a common paperdoll as boolean and put a check box in frmeditor item, then in where it says```' check for paperdollingFor i = 1 To UBound(PaperdollOrder)If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 ThenIf Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 ThenIf GetPlayerSex(Index) = 0 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, anim, spritetop)ElseIf GetPlayerSex(Index) = 1 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, anim, spritetop)End IfEnd IfEnd IfNext```add in a check like if item.common paperdoll = true then end if. just gimme a sec ill give ya a step by step. Link to comment Share on other sites More sharing options...
abhi2011 Posted November 4, 2012 Share Posted November 4, 2012 I didn't understand a word you said ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) Link to comment Share on other sites More sharing options...
Ertzel Posted November 4, 2012 Share Posted November 4, 2012 If you want to use the exact coding from this tutorial, then yes. Or modify it to fit your needs better. Link to comment Share on other sites More sharing options...
or3o Posted November 4, 2012 Share Posted November 4, 2012 it should be something like thisOK here is how to add common paperdolls to the items.in modtypes add```commonpdoll as boolean```then add a check box to frmeditor item named ChkCommondouble click that and add``` If Chkcommon.Value Then .Item(EditorIndex).commonpdoll = True Else Item(EditorIndex).commonpdoll = False End If```now go to modgameeditors and itemeditor initbelow```frmEditor_Item.scrlProjectileSpeed.Value = .speed```add``` If Item(EditorIndex).commonpdoll Then frmEditor_Item.chkTwoh.Value = 1 Else frmEditor_Item.chkTwoh.Value = 0 End If```lastly go to mod graphics draw player and replace```' check for paperdollingFor i = 1 To UBound(PaperdollOrder)If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 ThenIf Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 ThenIf GetPlayerSex(Index) = 0 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, anim, spritetop)ElseIf GetPlayerSex(Index) = 1 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, anim, spritetop)End IfEnd IfEnd IfNext```with this```' check for paperdollingFor i = 1 To UBound(PaperdollOrder)If GetPlayerEquipment(Index, PaperdollOrder(i)) > 0 ThenIf Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll > 0 ThenIf GetPlayerSex(Index) = 0 ThenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll, anim, spritetop)ElseIf GetPlayerSex(Index) = 1 Thenif getplayerequipment(index).commonpdoll < 1 thenCall DrawPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(i))).Paperdoll + 1, anim, spritetop)End IfEnd IfEnd Ifend ifNext```i havent actually tried this code yet but it should be about right. Link to comment Share on other sites More sharing options...
abhi2011 Posted November 4, 2012 Share Posted November 4, 2012 U can rip it from the one that I released for dx7. Link to comment Share on other sites More sharing options...
or3o Posted November 4, 2012 Share Posted November 4, 2012 my previous post pretty much explains exactly how to do it.woah Abhi2011 i hadnt realized you already made a tutorial for this, i knew there was an old tutorial that i first saw but it didnt have avy options, it just said if your gender is female paperdoll = paperdoll+1 and thats kinda what i thought you where refrencing lol. yea your tutorial wouldnt take much to get it to work with dx8 Link to comment Share on other sites More sharing options...
abhi2011 Posted November 4, 2012 Share Posted November 4, 2012 I thought of making one for DX8 2\. After dx7\. But saw this tut when I was going to post. So I thought not to. Link to comment Share on other sites More sharing options...
Eleyond Posted November 19, 2012 Share Posted November 19, 2012 oh geez. I had done this tut a long time ago before the EO 3.0, and i got the 255 stats glitch and I quit programming my game because I had NO idea what was causing it lmao. Oh well, at least now I know. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now