or3o Posted October 9, 2015 Author Share Posted October 9, 2015 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 Castspellfind``` 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 Else 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.CLIENT SIDEmake 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 FraItemson that frame make 4 scroll bars and 4 labelsscroll bar 1 is named```scrlitem1```scrollbar 2```scrlreq1```scrollbar 3```scrlitem2```scrollbar 4```scrlreq2```Nows you need to name your labels lbl1 is named```lblitem1```lbl2```lblamount1```lbl3```lblitem2```lbl 4```lblamount2 ```Now make your checkbox on the main form , (i put mine under the stun duration scrollbar.)name it ```chkitem```double click the chk box and add this code```If chkitem.value = 1 ThenSpell(EditorIndex).item = TrueFraItems.Visible = TrueElseSpell(EditorIndex).item = FalseFraItems.Visible = False```now go back to the forms and double click on the first scroll bar you just added.``` scrlitem1```paste this```Spell(EditorIndex).itemreq1 = scrlItem1.valuelblItem1.Caption = "Item: " & Trim$(item(scrlItem1.value).name)```then go to the second scrollbar you made```scrlreq1```paste this```Spell(EditorIndex).amountreq1 = scrlreq1.valuelblamount1.Caption = "amount: " & scrlreq1.value```Ok guys dont worry we are getting close to being done. go to the 3rd scroll bar your just added```scrlitem2```paste this```Spell(EditorIndex).itemreq2 = scrlitem2.valuelblitem2.Caption = "Item: " & Trim$(item(scrlitem2.value).name)```Now go to the last scrollbar```scrlreq2```paste this```Spell(EditorIndex).amountreq2 = scrlreq2.valuelblamount2.Caption = "amount: " & scrlreq2.value```Go back to the rame you added fra items and make the visibility set to false.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 Else .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. 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