Drakiac Posted March 11, 2011 Author Share Posted March 11, 2011 This edit to the server will require an item equipped in order for you to cast a spellThese are all server side edits.Find:``` ' Prevent subscript out of range If spellslot <= 0 Or spellslot > MAX_PLAYER_SPELLS Then Exit Sub spellnum = GetPlayerSpell(index, spellslot) mapNum = GetPlayerMap(index)```and under it put:``` ' Make sure player has item equipped If GetPlayerEquipment(index, Weapon) <> 1 Then Call PlayerMsg(index, "You need your _____ equipped!", BrightRed) Exit Sub End If```If the item equipped is not a weapon change it to whatever the item is.ex. If GetPlayerEquipment(index, Helmet) <> 1 ThenThe number of the item is what you put after <>. So in this code the item required to cast the spell is item number 1.I hope this helps some people!-Drakiac Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 11, 2011 Share Posted March 11, 2011 Nice, this is perfect, casters normally use staffs or and like weapons so you just need to make caster only weapons in the editor =DGOOD JOB!!!*high five* Link to comment Share on other sites More sharing options...
Drakiac Posted March 11, 2011 Author Share Posted March 11, 2011 :) I'm glad I could help!*high fives back* Link to comment Share on other sites More sharing options...
Helladen Posted March 11, 2011 Share Posted March 11, 2011 That won't work.This would be a better approach or…> ' Make sure player has item equipped> If GetPlayerEquipment(index, Weapon) = 0 Then> Call PlayerMsg(index, "You need a weapon equipped to cast a spell!", BrightRed)> Exit Sub> End IfSelect Case, don't do it like that. Link to comment Share on other sites More sharing options...
Drakiac Posted March 11, 2011 Author Share Posted March 11, 2011 Um.. using your approach if they do have the weapon equipped then they can't cast the spell. The point of my script is so that if they do have a weapon equipped it will allow them to cast a spell. Also, I've tried it out and it does work… thanks for the constructive criticism though :)-Drakiac Link to comment Share on other sites More sharing options...
Helladen Posted March 12, 2011 Share Posted March 12, 2011 I was saying make it where if the user doesn't have a weapon they can't cast or use select case rather than the method you were using. (It's easier to read than copying and pasting the same line 100 times). Link to comment Share on other sites More sharing options...
Drakiac Posted March 12, 2011 Author Share Posted March 12, 2011 In my code it says If the item equipped is not item 1, the item required for the spell, then give message and cancel spell. Link to comment Share on other sites More sharing options...
Helladen Posted March 12, 2011 Share Posted March 12, 2011 I know… I was giving you constructive criticism in how to improve the code you provided. Link to comment Share on other sites More sharing options...
Drakiac Posted March 12, 2011 Author Share Posted March 12, 2011 Oh! I thought you were telling me to use this:``` ' Make sure player has item equipped If GetPlayerEquipment(index, Weapon) = 0 Then Call PlayerMsg(index, "You need a weapon equipped to cast a spell!", BrightRed) Exit Sub End If```I was going to say: I would have to do this for every item except for the one I want…. That would be a lot of wasted code.-Drakiac Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 12, 2011 Share Posted March 12, 2011 Edit: Helladen dose have the better version, just deal with it. Link to comment Share on other sites More sharing options...
Drakiac Posted March 12, 2011 Author Share Posted March 12, 2011 Oh!! His is if you have no weapon equipped then you can't cast a spell. mine is for If you only want one specific item, such as a wand, to be equipped for spells. we're comparing apples and oranges. :) Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 12, 2011 Share Posted March 12, 2011 =P well, arnt you going to have diffrent wands for dirrenent levels?then use his and sel the CLASS REQUIREMENTS to the wands to what ever your casing class is and set class requirements for every thing =P Link to comment Share on other sites More sharing options...
Helladen Posted March 12, 2011 Share Posted March 12, 2011 @Drakiac:> Oh!! His is if you have no weapon equipped then you can't cast a spell. mine is for If you only want one specific item, such as a wand, to be equipped for spells. we're comparing apples and oranges. :)Select Case is like 1, 2, 3, 4 will not allow you to cast. I was giving two examples. Where you have to have a weapon equipped or use select case to use it as an array. 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