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

(EO) How to Add Equipment Slots


Murdoc
 Share

Recommended Posts

Add Additional Equipment in Eclipse Origins
===============================

This tutorial will demonstrate how to add an additional equipment slot (more may be added).

Client Side
–---------

In modConstants add a constant BEFORE the shield constant, like so:

```
' Item constants
Public Const ITEM_TYPE_NONE As Byte = 0
Public Const ITEM_TYPE_WEAPON As Byte = 1
Public Const ITEM_TYPE_ARMOR As Byte = 2
Public Const ITEM_TYPE_HELMET As Byte = 3
Public Const ITEM_TYPE_LEGWEAR As Byte = 4
Public Const ITEM_TYPE_SHIELD As Byte = 5
Public Const ITEM_TYPE_POTIONADDHP As Byte = 6
Public Const ITEM_TYPE_POTIONADDMP As Byte = 7
Public Const ITEM_TYPE_POTIONADDSP As Byte = 8
Public Const ITEM_TYPE_POTIONSUBHP As Byte = 9
Public Const ITEM_TYPE_POTIONSUBMP As Byte = 10
Public Const ITEM_TYPE_POTIONSUBSP As Byte = 11
Public Const ITEM_TYPE_KEY As Byte = 12
Public Const ITEM_TYPE_CURRENCY As Byte = 13
Public Const ITEM_TYPE_SPELL As Byte = 14
```
I used LEGWEAR as an example, but you can add anything you want.

You'll notice the constant value for shields is up by one, as are the rest. (this needs to be the same on server side)

In modGameLogic under ' For the stats label .. add a case:

```
Case ITEM_TYPE_LEGWEAR
.lblItemDescStats.Caption = "Defence: " & Item(itemnum).Data2

```

In modEnumerations under 'Equipment used by Players: Add before Shield:

```
Legwear
```
In modHandleData under Sub HandlePlayerWornEq AND Sub HandleMapWornEq add:

```
Call SetPlayerEquipment(MyIndex, Buffer.ReadLong, Legwear)
```

Server Side:
–----------

In modPlayer under Sub CheckEquippedItems add:

```
Case Equipment.Neckwear

                    If Item(itemNum).Type <> ITEM_TYPE_LEGWEAR Then SetPlayerEquipment Index, 0, I

```

Under Function GetPlayerProtection add:

```
Dim Legwear As Long
```
After "Helm = GetPlayerEquipment.." add:

```
Legwear = GetPlayerEquipment(Index, Legwear)
```
and near bottom add:

```
If Neckwear > 0 Then
        GetPlayerProtection = GetPlayerProtection + Item(Legwearwear).Data2
    End If
```

Under the Sub HandleUseItem:

Add:

```
Case ITEM_TYPE_LEGWEAR

                For I = 1 To Stats.Stat_Count - 1
                    If GetPlayerStat(Index, I) < Item(GetPlayerInvItemNum(Index, InvNum)).Stat_Req(I) Then
                        PlayerMsg Index, "You do not meet the stat requirements to equip this item.", BrightRed
                        Exit Sub
                    End If
                Next

                If GetPlayerEquipment(Index, Legwear) > 0 Then
                    TempItem = GetPlayerEquipment(Index, Legwear)
                End If

                SetPlayerEquipment Index, GetPlayerInvItemNum(Index, InvNum), Legwear
                PlayerMsg Index, "You equip " & CheckGrammar(Item(GetPlayerInvItemNum(Index, InvNum)).Name), BrightGreen
                TakeInvItem Index, GetPlayerInvItemNum(Index, InvNum), 0

                If TempItem > 0 Then
                    GiveInvItem Index, TempItem, 0 ' give back the stored item
                    TempItem = 0
                End If

                Call SendWornEquipment(Index)
                Call SendMapEquipment(Index)

```
Under Sub SendWornEquipment add:

```
Buffer.WriteLong GetPlayerEquipment(Index, Legwear)
```
**Do same for SendMapEquipment and SendMapEquipmentTo**

In modEnumerations under 'Equipment used by Player add "Legwear" (again, before Shield)

Add to ' Item constants:

```
Public const ITEM_TYPE_LEGWEAR As Byte = 4
```(same as client side)

Lastly, go into properties for cmbType in frmEditor_Item, select Categorized tab, and add "Legwear" to the list there.

And that should just bout do it.

If you want to create more slots, simply repeat the above procedure. :)
Link to comment
Share on other sites

  • Replies 83
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...
Very good but a few mistakes i would like to point out:

```
Case Equipment.Neckwear

                    If Item(itemNum).Type <> ITEM_TYPE_LEGWEAR Then SetPlayerEquipment Index, 0, I

```
just to avoid errors while compling change "Neckwear" to "Legwear" same with the other codes like that.

ALSO- i may want to point out I just a error code '9' doing this therefore i had to delete my admin account for my game to work again. Apart from that I think it was good help.
Link to comment
Share on other sites

@-sigh-:

> I tried to add this to my game but when I compiled the server it said:
>
> > Compile error:
> >
> > Variable not defined.
>
> and it highlighted "ITEM_TYPE_LEGS" (I changed legwear to legs)
> Under "Sub HandleUseItem"
> Do you know how this went wrong?

Do ctrl-f and find something like helm and repeat what it does everywhere e.g. if a line said IF Helm = Helm (idk :P) then you would put IF Legs = Legs, etc.
Link to comment
Share on other sites

  • 2 months later...
dunno what you mean changing it to 12 item slots.
if i make column size 4 i end up with 3 items on same place.

I made it myself (BTW, my first code ^^)
All Client based
Find in modDD7 and replace
```
.Top = EqTop
``````
.Top = EqTop + ((EqOffsetY + 32) * ((i - 1) \ EqColumns))
```do the same thing in frmMainGame.
At the end find```
Public Const EqOffsetX As Byte =
```and below add```
Public Const EqOffsetY As Byte = X
```at place of X you enter the distance.

BTW, Robin, what about adding Boots, Gloves, Ring and whateva slots in EO 1.2.1?
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...