RyokuHasu Posted March 24, 2012 Author Share Posted March 24, 2012 This was a simple request over in Q&A. I worked on it and decided to share it.This can easily be modded to work in different ways if you wish.**BOTH client and server**in modTypesIn Private Type SpellRecadd at the bottom```WepReq As Long```**Server side**In modCombatin Public Sub BufferSpellBellow```' Make sure player has the spell If Not HasSpell(index, spellnum) Then Exit Sub```add``` If Spell(spellnum).WepReq <> 0 Then If Item(Spell(spellnum).WepReq).Type = ITEM_TYPE_WEAPON Then If Not Spell(spellnum).WepReq = Player(index).Equipment(1) Then PlayerMsg index, "You dont have the right Equipment! (" + Trim$(Item(Spell(spellnum).WepReq).Name) + ")", BrightRed Exit Sub End If End If End If```**Client Side**On frmEditor_Spellsadd a label and a scroll bar as shown![](http://www.mediafire.com/convkey/7388/gati49ijw5pa6sd5g.jpg)name the scroll bar "scrlWepReq"name the label "lblWepReq"2x click on the scroll bar and add```If scrlWepReq.Value > 0 Then lblWepReq.Caption = "Weapon: " + Item(scrlWepReq.Value).NameElse lblWepReq.Caption = "Weapon: None"End IfSpell(EditorIndex).WepReq = scrlWepReq.Value```then anywhere in the same form code add```Private Sub Form_Load() scrlWepReq.Max = MAX_ITEMSEnd Sub```In modGameEditorsin Public Sub SpellEditorInit()under```.scrlStun.Value = Spell(EditorIndex).StunDuration```add```.scrlWepReq.Value = Spell(EditorIndex).WepReq```**DONE** Link to comment Share on other sites More sharing options...
QNicolya Posted March 24, 2012 Share Posted March 24, 2012 Wow, thank you. Its really good. Link to comment Share on other sites More sharing options...
QNicolya Posted March 24, 2012 Share Posted March 24, 2012 But, if I open spell editor, I'm have a:Run time error 380Invalid property value.Please, help me. Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 24, 2012 Author Share Posted March 24, 2012 open in VB and try it again, then if it fails, post the line it points to. Link to comment Share on other sites More sharing options...
Wortel Angels Posted March 24, 2012 Share Posted March 24, 2012 Request by me :D haha works perfect and is exactli that what i want Ryouku you ar the best :D Link to comment Share on other sites More sharing options...
Matt Posted April 27, 2012 Share Posted April 27, 2012 Im trying to make a shield requirement as well. I added the same things except adding ShieldReq instead of WepReq. I compiled on client and all was good. I compiled on server, and it showed me this error "Compile error: Method or data member not found"over>! ' Make sure player has the spell If Not HasSpell(index, spellnum) Then Exit Sub If Spell(spellnum).WepReq <> 0 Then If Item(Spell(spellnum).WepReq).Type = ITEM_TYPE_WEAPON Then If Not Spell(spellnum).WepReq = Player(index).Equipment(1) Then PlayerMsg index, "You dont have the right Equipment! (" + Trim$(Item(Spell(spellnum).WepReq).Name) + ")", BrightRed Exit Sub End If End If End If If Spell(spellnum).**ShieldReq** <> 0 Then If Item(Spell(spellnum).ShieldReq).Type = ITEM_TYPE_SHIELD Then If Not Spell(spellnum).ShieldReq = Player(index).Equipment(1) Then PlayerMsg index, "You dont have the right Equipment! (" + Trim$(Item(Spell(spellnum).ShieldReq).Name) + ")", BrightRed Exit Sub End If End If End If ' see if cooldown has finishedWhat am i doing wrong? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 27, 2012 Share Posted April 27, 2012 Check that you have ShieldReq in the server's SpellRec. Link to comment Share on other sites More sharing options...
Matt Posted April 27, 2012 Share Posted April 27, 2012 Ahhh i'm a moron. Thank you for pointing out my obvious mistake Soul! Link to comment Share on other sites More sharing options...
Dawntide Posted August 5, 2012 Share Posted August 5, 2012 It is bugged, please fix this bug:If you do not have the required weapon, the spell starts to cast anyway, but has no effect. So you are stunned for the duration of the casting time of the spell! Link to comment Share on other sites More sharing options...
Wortel Angels Posted August 5, 2012 Share Posted August 5, 2012 Yeah >.>Thats bad i requestet it with an weapon without castin time >.< Link to comment Share on other sites More sharing options...
Triple_X Posted September 9, 2012 Share Posted September 9, 2012 Hi, i need modify this code such it can to spell use to different type weapons e.g. two-handed weapons.I'm sorry for my English, because this language is not my strong side. Link to comment Share on other sites More sharing options...
or3o Posted September 10, 2012 Share Posted September 10, 2012 triple_X a tutorial for 2 handed weapons already exist, although ill admit im not exactly 100% sure of what you mean. check out the advanced weapons tutorial if you just want a 2 handed weapons tutorial. Link to comment Share on other sites More sharing options...
Triple_X Posted September 10, 2012 Share Posted September 10, 2012 > triple_X a tutorial for 2 handed weapons already exist, although ill admit im not exactly 100% sure of what you mean. check out the advanced weapons tutorial if you just want a 2 handed weapons tutorial.I have advenced weapons in my engine. I need change it so that players can use spell when they have equip one-hand weapon or two-hand weapon or shield. Link to comment Share on other sites More sharing options...
or3o Posted September 10, 2012 Share Posted September 10, 2012 oh I get it now im not sure why a 2 handed weapon doesnt already work if you have added the tutorial but to make it do sheilds are required just read the tutorial and replace where it says Item_type_weapon replace it with ITEM_TYPE_SHIELD and change wherever it says wepreq with ShieldReq Link to comment Share on other sites More sharing options...
Triple_X Posted September 10, 2012 Share Posted September 10, 2012 You don't understand me. I have now so that I can assign one spell only to one weapon, and I want to do so that one spell can be attributed e.g. to all two-handed weapons. Link to comment Share on other sites More sharing options...
blkcrow Posted September 10, 2012 Share Posted September 10, 2012 ~~If Item(Spell(spellnum).WepReq).Type = ITEM_TYPE_WEAPON Thendeleting this line and one end if will make it work with any item type~~Edit: Sorry it wont since you are checking only the weapon slot Link to comment Share on other sites More sharing options...
Triple_X Posted September 10, 2012 Share Posted September 10, 2012 Ok. I found a solution to my problem. Thanks for your interest in my problem. Link to comment Share on other sites More sharing options...
merunes Posted October 21, 2012 Share Posted October 21, 2012 Okay….does this only work for Weapons? <.< i tried it with a custom Equipmentslot "Classitem" i can compile wihtout error, it works almost...if someone equips the needed item, he still can cast the spell, it says that he has not the right equipment. even if he has it equiped. Link to comment Share on other sites More sharing options...
or3o Posted October 21, 2012 Share Posted October 21, 2012 you need to edit this part``` If Spell(spellnum).WepReq <> 0 Then If Item(Spell(spellnum).WepReq).Type = ITEM_TYPE_WEAPON Then If Not Spell(spellnum).WepReq = Player(index).Equipment(1) Then PlayerMsg index, "You dont have the right Equipment! (" + Trim$(Item(Spell(spellnum).WepReq).Name) + ")", BrightRed Exit Sub End If End If End If```i dont know what type of item your using but lets say you wanna make your shield be required to cast a spell first your would need to change the```if item(spell(spellnum).wepreq).type = item_type_shield then ```next you would need to go to the next line of code and change```if notspell(spellnum).wepreq = player(index).equipment(4) then ```<– see what i changed? the 1 got changed to a 4 because in modconstants under item constants the shield is number 4\. so just go to mod constants and find what item type your planning on using and use the number next to it. hope that helps. Link to comment Share on other sites More sharing options...
merunes Posted October 21, 2012 Share Posted October 21, 2012 Thanks oÇɹo you was abit wrong with your answer but got me on the Right Track. The Number is not the Number the item have in Modconstants, rather it is the itemslot it is attached to.means: i have 12 equipslots for a player, the item the spell(can or cant't) cast is boudn to has the number 9, but is equiped in the 12\. equipmentslot.Anyway, much thanks you help me out. Link to comment Share on other sites More sharing options...
Larias Posted February 1, 2013 Share Posted February 1, 2013 Sorry to bump but since TripleX didn't post his solution to the problem, I was wondering if anyone knew of a way to require a specific item type. For example, these abilities can only be used with a 1h sword (but all 1h swords work), 1h wand (but all 1h wands work), etc.Thanks ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Matt Posted February 1, 2013 Share Posted February 1, 2013 > Sorry to bump but since TripleX didn't post his solution to the problem, I was wondering if anyone knew of a way to require a specific item type. For example, these abilities can only be used with a 1h sword (but all 1h swords work), 1h wand (but all 1h wands work), etc.> > Thanks ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)It would be rather easy. Add the rec in SpellRec, add the cmb or whatever to the Spell Editor and make sure it saves, then put in cast spell a check to see if they have a weapon/shield etc Link to comment Share on other sites More sharing options...
pikachu2010 Posted February 20, 2013 Share Posted February 20, 2013 good jod work perfecly +10![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) 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