So someone wanted a way to make spells cost items, sorta like runescape. This is a basic tutorial. With this tutorial you will be able to select the cost and have up to 2 different requirements per spell, (this means you can make a spell cost 3 of one rune and 2 of another or whatever value you decide to go with.) Its can be upgraded to 3 different items fairly easily.

So here we go.

SERVER and Client!

First go to mod types spell rec 
at the bottom before end type add.

    item As Boolean

    itemreq1 As Long
    amountreq1 As Byte
    itemreq2 As Long
    amountreq2 As Byte

Ok now Serverside go to ModCombat Sub Castspell

        Call PlayerMsg(index, "You must be an administrator to cast this spell.", BrightRed)

        Exit Sub
    End If

right below it post this

        If Spell(SpellNum).item = True Then

         itemval = (Spell(SpellNum).amountreq1)
         itemnum = HasItem(index, (Spell(SpellNum).itemreq1))
                If itemval >= itemnum Then
                        Call PlayerMsg(index, "you dont have enough runes!", BrightRed)
                        Exit Sub
                    If (Spell(SpellNum).itemreq2) > 0 Then
            itemval2 = (Spell(SpellNum).amountreq2)
            itemnum2 = HasItem(index, (Spell(SpellNum).itemreq2))
                         If itemval2 >= itemnum2 Then
                            Call PlayerMsg(index, "you dont have enough runes2!", BrightRed)
                               Exit Sub
                             End If
                        Call TakeInvItem(index, (Spell(SpellNum).itemreq2), itemval2)
                        Call TakeInvItem(index, (Spell(SpellNum).itemreq1), itemval)
                        Call PlayerMsg(index, "casting!", BrightRed)
                End If
                        If itemval2 = 0 Then
                        Call TakeInvItem(index, (Spell(SpellNum).itemreq1), itemval)
                        Call PlayerMsg(index, "casting!", BrightRed)
                    End If
            End If
        End If

Thats takes care of the serverside of things, Lets move over to the client.


make sure you added the stuff from the top of this page into the client side modtypes spell rec.

you are going to need to make 4 scroll bars, 4 labels and 1 checkbox.
I made a frams to make a bit more space and make the options invisible if you arent using them.

Ok so make a frame, name it FraItems
on that frame make 4 scroll bars and 4 labels

scroll bar 1 is namedscrlitem1scrollbar 2scrlreq1scrollbar 3scrlitem2scrollbar 4```

Nows you need to name your labels 

lbl1 is named```
```lbl 4```

Now make your checkbox on the main form , (i put mine under the stun duration scrollbar.)
name it


double click the chk box and add this code

If chkitem.value = 1 Then

Spell(EditorIndex).item = True
FraItems.Visible = True
Spell(EditorIndex).item = False
FraItems.Visible = False

now go back to the forms and double click on the first scroll bar you just added.scrlitem1paste this```
Spell(EditorIndex).itemreq1 = scrlItem1.value

lblItem1.Caption = "Item: " & Trim$(item(scrlItem1.value).name)

then go to the second scrollbar you made```
```paste this

Spell(EditorIndex).amountreq1 = scrlreq1.value

lblamount1.Caption = "amount: " & scrlreq1.value

Ok guys dont worry we are getting close to being done. go to the 3rd scroll bar your just added```
```paste this```
Spell(EditorIndex).itemreq2 = scrlitem2.value

lblitem2.Caption = "Item: " & Trim$(item(scrlitem2.value).name)

Now go to the last scrollbarscrlreq2paste this```
Spell(EditorIndex).amountreq2 = scrlreq2.value

lblamount2.Caption = "amount: " & scrlreq2.value

now head over to modgameeditors and look for spelleditorinit

(this is what loads when you open your spell editor)
before this```
        ' find the sound we have set
```paste this```
        .scrlreq2.value = Spell(EditorIndex).amountreq2

        .scrlitem2.value = Spell(EditorIndex).itemreq2
        .scrlreq1.value = Spell(EditorIndex).amountreq1
        .scrlItem1.value = Spell(EditorIndex).itemreq1
        If Spell(EditorIndex).item Then
            .chkitem.value = 1
            .chkitem.value = 0
        End If

And that wrapps up this tutorial, if you run into any errors or need help figuring out how to modify the code to fit your particular application feel free to ask me.
Anyone can use this no credits required.