Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Sex-Based Requirements for Equips


Repercussionist
 Share

Recommended Posts

A pretty simple feature, and my first solo edit. Any words of wisdom would be warmly welcomed.

0-Male
1-Female
2-Both

CLIENT SIDE/////

Open frmEditor_Item and add a HScrlBar just below the Level Req. scroll bar.
Name this scrlSexReq and set the Max to 2.

Create a label to the left of this scrollbar.
Name it lblSexReq and set the caption to "Sex req: 0" .

Next, double click your new scrollbar and add this in the selected sub:
```
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub
    lblSexReq.Caption = "Sex req: " & scrlSexReq.Value
    Item(EditorIndex).SexReq = scrlSexReq.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlSexReq_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
```

Then in modDatabase, add this function somewhere:
```
Function GetPlayerSex(ByVal Index As Long) As Long
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Index > MAX_PLAYERS Then Exit Function
    GetPlayerSex = Player(Index).Sex

    ' Error handler
    Exit Function
errorhandler:
    HandleError "GetPlayerSex", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Function
End Function
```
In modGameEditors, add this to ItemEditorInit (under ' Basic requirements)
```
frmEditor_Item.scrlSexReq.Value = .SexReq
```

In modTypes add this at the bottom of Private Type ItemRec
```
SexReq As Byte
```
And this under Player Rec
```
Sex As Byte
```

SERVER SIDE//////

In modPlayer add this function somewhere
```
Function GetPlayerSex(ByVal index As Long) As Long

    If index > MAX_PLAYERS Then Exit Function
    GetPlayerSex = Player(index).Sex
End Function
```
and also in modPlayer, find the Public Sub UseItem. You should see```
Select Case Item(itemnum).Type
```just a few lines down.

Now put this code under the cases that you want the sex requirement attribute to be active on. In any case where you don't put this, the SexReq will be arbitrary.
```
' sex requirement
                If Item(itemnum).SexReq < 2 And GetPlayerSex(index) <> Item(itemnum).SexReq Then
                    PlayerMsg index, "You are not the right sex to equip this item.", BrightRed
                    Exit Sub
                End If
```
And finally, in modTypes, at the bottom of Private Type ItemRec add:
```
SexReq As Byte
```
Link to comment
Share on other sites

@crzyone9584:

> Just so you know, when you add something to the UDTs you will have to delete the files. So with this edit you will have to delete all your items. But very nicely done.

Only if you add them in to the existing order. Add them to the end of the UDT and it'll load them just fine.
Link to comment
Share on other sites

Personally I think this would be a bit of an annoying system. I.e. a monster would drop a female piece of armour and a male wouldn't be able to use it, etc.
Link to comment
Share on other sites

Its just like any other drop. You kill a monster and he drops a level 1 weapon when your level 10 with a level 8 weapon. So what do you do with that level 1? you sell it. This will just make it so that people can make more money along with the ability to have specific armor paper dolls so they will always look like a women.
Link to comment
Share on other sites

From the tone of your post, it sounds like you're planning on it being a consistently identical drop for each kill. If it randomly drops something you can't use, then sell it. It's the same way for class requirements.

Besides, my idea for this was character customization (hair, clothes, etc.) that was separate from armor.
Link to comment
Share on other sites

Mmm, yeah in-game customization would be nice, once or twice. I don't know, I just don't think having gender based items is such a good idea, but that's just my opinion.
Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • 2 weeks later...
@Repercussionist:

> Is the visibility set to false? Did you compile the client/server?

I think I might have found the problem :P Will test when I back home. And yes I recently found out that you need to compile lol I have been saving the project only.

*Edit. How weird.. When I compile it I can see it, but when I run the client, I can't see it? :huh:
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...