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

How to add more item types


unnown
 Share

Recommended Posts

alright this is an tutorial how to make more item types as asked ,

server and client side:

in modconstants find

> ' Item Constants.

you'll see a list of item types, add the new type you'd like to make
(i used teleport)

> Public Const ITEM_TYPE_TELEPORT = 19

*look good at what number should be used next

client side:

open up the item editor form and open the cmpType properties

now click on list and add the new name of the type (in my case Teleport)

in modgameeditor find Public Sub ItemEditorOk()

and above

> Call SendSaveItem(EditorIndex)

add
```
    If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_TELEPORT) Then
        Item(EditorIndex).Data1 = 0
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).StrReq = 0
        Item(EditorIndex).DefReq = 0
        Item(EditorIndex).SpeedReq = 0
        Item(EditorIndex).MagicReq = 0
        Item(EditorIndex).ClassReq = -1
        Item(EditorIndex).AccessReq = 0

        Item(EditorIndex).AddHP = 0
        Item(EditorIndex).AddMP = 0
        Item(EditorIndex).AddSP = 0
        Item(EditorIndex).AddSTR = 0
        Item(EditorIndex).AddDEF = 0
        Item(EditorIndex).AddMAGI = 0
        Item(EditorIndex).AddSpeed = 0
        Item(EditorIndex).AddEXP = 0
        Item(EditorIndex).AttackSpeed = 0
        Item(EditorIndex).Stackable = 0
    End If

```
(note this is still using my item type) :P

server side

in modhandledata find

> Public Sub Packet_UseItem(ByVal Index As Long, ByVal InvNum As Long)

if you look at it you find a

> Select Case Item(GetPlayerInvItemNum(Index, InvNum)).Type

in that case add:
(note this is done with my example)

```
        Case ITEM_TYPE_TELEPORT
            If Player(Index).TargetType = TARGET_TYPE_PLAYER And Player(Index).Target > 0 Then
                Call PlayerWarp(Player(Index).Target, 1, 1, 1)
            Else
                Call PlayerWarp(Index, 1, 1, 1)
            End If
            Call TakeItem(Index, Player(Index).Char(CharNum).Inv(InvNum).num, 1)

```
Link to comment
Share on other sites

Holy wow, unnown! This is easier than I thought. I'll just edit the details that I need. I'm creating separate weapon types (bow, axe, sword), and I will be making a separate damage formula for each. so I'll just figure out how to make a weapon from reading the source a bit more. Any suggestions before I start? (I got classes today)
Link to comment
Share on other sites

I had an idea during calculus:

Can I make an if statement in the Gamelogic's Sub GetPlayerDamage that goes something like this:

Function GetPlayerDamage(ByVal Index As Long) As Long
    Dim WeaponSlot As Long, RingSlot As Long, NecklaceSlot As Long
    GetPlayerDamage = 0

' Check for subscript out of range
    If IsPlaying(Index) = False Or Index <= 0 Or Index > MAX_PLAYERS Then
        Exit Function
    End If

If ITEM_TYPE_SWORD Then
    GetPlayerDamage = Rand(Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 3) * 0.25, Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 2) * 2.5)

If ITEM_TYPE_AXE Then
    GetPlayerDamage = Rand(Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 3) * 0.25, Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 2) * 2.5)

If ITEM_TYPE_BOW Then
    GetPlayerDamage = Rand(Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 3) * 0.25, Int(GetPlayerSTR(Index) / 4) + Int(GetPlayerDEF(Index) / 2) * 2.5)
Else GetPlayerDamage = Rand(Int(GetPlayerStr(index) /4) * 0.50, etc?

I know the formulas were the same, but can the concept still work?
Link to comment
Share on other sites

I'll drink to that  :occasion14:

Ok, drinking's over. I get an RTE 380 every time I try and re-edit the new item type I created (I made a separate Weapon type for Bows.)
Any thoughts on what causes this? If anything, can I send you my source and you can take a look at it?
Link to comment
Share on other sites

  • 2 months later...
And if you were to add a boots or other pd slots it wouldnt show within the equiping menu and wouldnt display PD… This would have to be a huge Tut to do those though... I just recommend searching a already made item type and adding the new item type under it, with slightly altered code...
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...