Sting Posted July 10, 2009 Author Share Posted July 10, 2009 ```sub playerspellb(index, damage, range, animation) dim i dim r dim name select case getplayerdir(index) case 0 i = 0r = 1do while i <= GetVar("Data.ini", "MAX", "MAX_PLAYERS")call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) - r)if getplayermap(i) = getplayermap(index) thenif getplayerx(index) = getplayerx(i) thenif getplayery(i) > getplayery(index) - range thenif getplayery(i) < getplayery(index) thenif getplayerhp(i) > damage then call playermsg(index, "hit", 4)Call Setplayerhp(i, getplayerhp(i) - damage)call sendhp(i)else call playermsg(index, "hit", 4)call ondeath(i)end if end ifend ifend ifend if r = r + 1 i = i + 1if r > range thenr = 1end ifloop```*dies* (it wont get past the first if statment its just like NO! IM NOT GONNA DO THAT! and im like WTF! so pretty much it makes a spell animation on 1 tile and thats it….) Link to comment Share on other sites More sharing options...
Bobosk Posted July 10, 2009 Share Posted July 10, 2009 There's no "End Select" in what you posted, although, that's probably because there's possibly more than just "Case 0"?? in which case that's not the problem. But as far as syntax, i don't see anything else wrong Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 10, 2009 Share Posted July 10, 2009 You may have to Int() your GetVar Link to comment Share on other sites More sharing options...
Sting Posted July 10, 2009 Author Share Posted July 10, 2009 there is more to the script yes and the end sub is therethis is the whole scriptof course im only working on case 1 right now because all the other cases are from my npce spell that works perefectly fine i cant seem to figure out why when it starts doing the if statments in the case 0 it just stops itself and like exits sub```sub playerspellb(index, damage, range, animation) dim i dim r dim name select case getplayerdir(index) case 0 i = 0r = 1do while i <= GetVar("Data.ini", "MAX", "MAX_PLAYERS")call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) - r)if getplayermap(i) = getplayermap(index) thenif getplayerx(index) = getplayerx(i) thenif getplayery(i) > getplayery(index) - range thenif getplayery(i) < getplayery(index) thenif getplayerhp(i) > damage then call playermsg(index, "hit", 4)Call Setplayerhp(i, getplayerhp(i) - damage)call sendhp(i)else call playermsg(index, "hit", 4)call ondeath(i)end if end ifend ifend ifend if r = r + 1 i = i + 1if r > range thenr = 1end ifloop case 1 i = 0r = 1do while i < 16call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) + r)if getnpcx(getplayermap(index), i) = getplayerx(index) thenif getnpcy(getplayermap(index), i) < getplayery(index) + range thenif getnpcy(getplayermap(index), i) > getplayery(index) thenif getmapnpchp(getplayermap(index), i) > damage then call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, GetMapNpcHP( getplayermap(index), i) - damage)call sendNPChp( getplayermap(index), i)else call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, 1)Call sendNPC( getplayermap(index), i)end if end ifend ifend if r = r + 1 i = i + 1if r > range thenr = 1end ifloop case 2 i = 0r = 1do while i < 16call spellanim(animation, getplayermap(index), getplayerx(index) - r, getplayery(index))if getnpcx(getplayermap(index), i) > getplayerx(index) - range thenif getnpcy(getplayermap(index), i) = getplayery(index) thenif getnpcx(getplayermap(index), i) < getplayerx(index) thenif getmapnpchp(getplayermap(index), i) > damage then call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, GetMapNpcHP( getplayermap(index), i) - damage)call sendNPChp( getplayermap(index), i)else call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, 1)Call sendNPC( getplayermap(index), i)end if end ifend ifend if r = r + 1 i = i + 1if r > range thenr = 1end ifloop case 3 i = 0r = 1do while i < 16call spellanim(animation, getplayermap(index), getplayerx(index) + r, getplayery(index))if getnpcx(getplayermap(index), i) < getplayerx(index) + range thenif getnpcy(getplayermap(index), i) = getplayery(index) thenif getnpcx(getplayermap(index), i) > getplayerx(index) thenif getmapnpchp(getplayermap(index), i) > damage then call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, GetMapNpcHP( getplayermap(index), i) - damage)call sendNPChp( getplayermap(index), i)else call playermsg(index, "hit", 4)Call SetMapNpcTarget( getplayermap(index), i, index)Call SetMapNpcHP( getplayermap(index), i, 1)Call sendNPC( getplayermap(index), i)end if end ifend ifend if r = r + 1 i = i + 1if r > range thenr = 1end ifloop end select exit sub end sub``` Link to comment Share on other sites More sharing options...
dg1423 Posted July 11, 2009 Share Posted July 11, 2009 First off, there are so many easier ways to do this, why so complicated? Also what do you mean by "when it starts doing the if statments in the case 0 it just stops itself and like exits sub" You mind explaining a bit more. I'm a bit lazy at the moment and I don't feel like reading through all of your code. Link to comment Share on other sites More sharing options...
zearth Posted July 11, 2009 Share Posted July 11, 2009 if i remember correctly, he used this script in one of our past games but he lost parts of it and needs to try to fix it Link to comment Share on other sites More sharing options...
Sting Posted July 11, 2009 Author Share Posted July 11, 2009 kody… aka zearth... ur not helping... just spamming... anyways the problem right now is its pretty much if i u know edit out the if statments in case 0 it works fine but if i leave them there or even just one of them there it pretty much acts as if there is an exit sub right before the if like it does the spell animation but then anything after the first if command dosnt happen so it dosnt look r dosnt get to + 1 along with the i variable Link to comment Share on other sites More sharing options...
dg1423 Posted July 11, 2009 Share Posted July 11, 2009 facepalm. took me 2 seconds to realize it after copying the code to nope pad.change this:```i = 0```to this```i = 1``` Link to comment Share on other sites More sharing options...
xelander Posted July 11, 2009 Share Posted July 11, 2009 Im really new to scripting but does it mather that its a B after spell?sub playerspellb(index, damage, range, animation) Link to comment Share on other sites More sharing options...
Sting Posted July 11, 2009 Author Share Posted July 11, 2009 thanks for the help and no it dosnt matter cuz the sub is called playerspellbits fixed now =] 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