Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Someone tell me why this script wont work…. im about to kill myself over it


Sting
 Share

Recommended Posts

```
sub playerspellb(index, damage, range, animation)
    dim i
    dim r
    dim name
    select case getplayerdir(index)
    case 0 
i = 0
r = 1
do while i <= GetVar("Data.ini", "MAX", "MAX_PLAYERS")
call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) - r)
if getplayermap(i) = getplayermap(index) then
if getplayerx(index) = getplayerx(i) then
if getplayery(i) > getplayery(index) - range then
if getplayery(i) < getplayery(index) then
if 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 if
end if
end if
end if
    r = r + 1 
    i = i + 1
if r > range then
r = 1
end if
loop
```*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

there is more to the script yes and the end sub is there

this is the whole script

of 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 = 0
r = 1
do while i <= GetVar("Data.ini", "MAX", "MAX_PLAYERS")
call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) - r)
if getplayermap(i) = getplayermap(index) then
if getplayerx(index) = getplayerx(i) then
if getplayery(i) > getplayery(index) - range then
if getplayery(i) < getplayery(index) then
if 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 if
end if
end if
end if
    r = r + 1 
    i = i + 1
if r > range then
r = 1
end if
loop

    case 1 
i = 0
r = 1
do while i < 16
call spellanim(animation, getplayermap(index), getplayerx(index), getplayery(index) + r)
if getnpcx(getplayermap(index), i) = getplayerx(index) then
if getnpcy(getplayermap(index), i) < getplayery(index) + range then
if getnpcy(getplayermap(index), i) > getplayery(index) then
if 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 if
end if
end if
    r = r + 1 
    i = i + 1
if r > range then
r = 1
end if
loop

    case 2 
i = 0
r = 1
do while i < 16
call spellanim(animation, getplayermap(index), getplayerx(index) - r, getplayery(index))
if getnpcx(getplayermap(index), i) > getplayerx(index) - range then
if getnpcy(getplayermap(index), i) = getplayery(index) then
if getnpcx(getplayermap(index), i) < getplayerx(index) then
if 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 if
end if
end if
    r = r + 1 
    i = i + 1
if r > range then
r = 1
end if
loop

    case 3 
i = 0
r = 1
do while i < 16
call spellanim(animation, getplayermap(index), getplayerx(index) + r, getplayery(index))
if getnpcx(getplayermap(index), i) < getplayerx(index) + range then
if getnpcy(getplayermap(index), i) = getplayery(index) then
if getnpcx(getplayermap(index), i) > getplayerx(index) then
if 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 if
end if
end if
    r = r + 1 
    i = i + 1
if r > range then
r = 1
end if
loop

    end select
  exit sub
end sub
```
Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...