ryono Posted February 15, 2009 Author Share Posted February 15, 2009 hey guys, I can't seem to figure out what's wrong with this script. maybe you can figure it out. It is supposed to be a combo system. or the begining of one.put this at bottom of main.txt:```sub attackanimation(index, animation) dim map dim playerx dim playery dim dir map = getplayermap(index) playerx = getplayerx(index) playery = getplayery(index) dir = getplayerdir(index) if dir = 0 then call spellanim(animation, map, playerx, playery - 1) elseif dir = 1 then call spellanim(animation, map, playerx, playery + 1) elseif dir = 2 then call spellanim(animation, map, playerx - 1, playery) else call spellanim(animation, map, playerx + 1, playery) end ifend sub'COMBO SYSTEM!!!!!!!!!!!!sub damagecommand(index, high, low, hitrate, critrate, hitanimation, missanimation, critanimation, hitsound, misssound, critsound) dim str dim dmg dim playerdef dim npcdef dim critdmg dim hitchance dim critchance dim target dim npcnum dim playerx dim playery dim npcx dim npcy dim dir dim targettype str = getplayerstr(index) * 2 if low < 0 then low = 0 end if if hitrate < 0 then hitrate = 0 end if if hitrate > 100 then hitrate = 100 end if critdmg = high / 4 if critrate > 100 then critrate = 100 end if if critrate < 0 then critrate = 0 end if critchance = rand(0, 100) npcnum = getplayertargetnpc(index) npcdef = getnpcdefense(npcnum) if int(getplayertarget(index)) > 0 then target = getplayertarget(index) targettype = 1 if hitchance <= hitrate then playerdef = getplayerdef(target) dmg = (rand(low, high) + (str * 2)) - (playerdef * 5) else dmg = 0 end if else target = getplayertargetnpc(index) targettype = 0 if hitchance <= hitrate then dmg = (rand(low, high) + (str * 2)) - (npcdef * 5) else dmg = 0 end if end if playerx = getplayerx(index) playery = getplayery(index) npcx = getnpcx(getplayermap(index), npcnum) npcy = getnpcy(getplayermap(index), npcnum) dir = getplayerdir(index) if dir = 0 then if playerx = npcx then if playery = npcy + 1 then if critchance <= critrate then call putvar("Damage.ini", "DAMAGE", getplayername(index), "2") dmg = high + rand(0, critdmg) else call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") end if if targettype = 1 then call damageplayer(index, target, dmg) call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") else call damagenpc(index, target, dmg) call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") end if end if end if elseif dir = 1 then if playerx = npcx then if playery = npcy - 1 then if critchance <= critrate then call putvar("Damage.ini", "DAMAGE", getplayername(index), "2") dmg = high + rand(0, critdmg) else call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") end if if targettype = 1 then call damageplayer(index, target, dmg) else call damagenpc(index, target, dmg) end if end if end if elseif dir = 2 then if playerx = npcx + 1 then if playery = npcy then if critchance <= critrate then call putvar("Damage.ini", "DAMAGE", getplayername(index), "2") dmg = high + rand(0, critdmg) else call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") end if if targettype = 1 then call damageplayer(index, target, dmg) else call damagenpc(index, target, dmg) end if end if end if else if playerx = npcx - 1 then if playery = npcy then if critchance <= critrate then call putvar("Damage.ini", "DAMAGE", getplayername(index), "2") dmg = high + rand(0, critdmg) else call putvar("Damage.ini", "DAMAGE", getplayername(index), "1") end if if targettype = 1 then call damageplayer(index, target, dmg) else call damagenpc(index, target, dmg) end if end if end if end if if dmg = 0 then call putvar("Damage.ini", "DAMAGE", getplayername(index), "0") end if if getvar("Damage.ini", "DAMAGE", getplayername(index)) = "2" then call attackanimation(index, critanimation) call playsound(index, critsound) elseif getvar("Damage.ini", "DAMAGE", getplayername(index)) = "1" then call attackanimation(index, hitanimation) call playsound(index, hitsound) else call attackanimation(index, missanimation) call playsound(index, misssound) end if call putvar("Damage.ini", "DAMAGE", getplayername(index), "0")end subsub nexthit(index) call removetimer("nexthit " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "0")end subsub hitdelay1(index) call removetimer("hitdelay1 " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "1") call settimer("nexthit " & index, 3000) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1")end subsub hitdelay2(index) call removetimer("hitdelay2 " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "2") call settimer("nexthit " & index, 3000) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1")end subsub hitdelay3(index) call removetimer("hitdelay3 " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "3") call settimer("nexthit " & index, 3000) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1")end subsub hitdelay4(index) call removetimer("hitdelay4 " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "4") call settimer("nexthit " & index, 3000) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1")end subsub hitdelay5(index) call removetimer("hitdelay5 " & index) call putvar("HitNumber.ini", "HIT", getplayername(index), "1") call settimer("nexthit " & index, 3000) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1")end sub```put this in OnNewCharCreate sub:```call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "1") call putvar("HitNumber.ini", "HIT", getplayername(index), "0")```replace HotScript sub with this:```' Executes when a hotkey is pressed client-side.Sub HotScript(Index, KeyID) Select Case KeyID ' Executes when any player presses the PageUp key. Case 1 if getvar("HitNumber.ini", "CAN ATTACK", getplayername(index)) = "1" then if getvar("HitNumber.ini", "HIT", getplayername(index)) = "0" then call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay1 " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "1" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay2 " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "2" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay3 " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "3" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay4 " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") else call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay5 " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") end if end if ' Executes when any player presses the Delete key. Case 2 ' Executes when players press the End key. Case 3 call advancedattack(index, 800, 600, 76, 8, 2, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") ' Executes when players press the PageDown key. Case 4 if getvar("HitNumber.ini", "CAN ATTACK", getplayername(index)) = "1" then if getvar("HitNumber.ini", "HIT", getplayername(index)) = "0" then call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "1" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "2" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") elseif getvar("HitNumber.ini", "HIT", getplayername(index)) = "3" then call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") else call removetimer("nexthit " & index) call damagecommand(index, 800, 600, 100, 10, 1, 2, 3, "sword.wav", "miss.wav", "SwordCritical.wav") call settimer("hitdelay " & index, 500) call putvar("HitNumber.ini", "CAN ATTACK", getplayername(index), "0") end if end if End SelectEnd Sub```and I think thats it. The error I get it a subscript out of range on line 37 when I press page up. and when I press page down, I get it on line 36\. so I don't know. well, ty in advance everyone. Link to comment Share on other sites More sharing options...
Agoraphobic Posted February 15, 2009 Share Posted February 15, 2009 I'll look at it more indepth in a little bit, but I see in your hotkey sections you're missing exit subs in case 1 and case 2, and case 3. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 why would I need exit subs? it should exit on it's own. Link to comment Share on other sites More sharing options...
Agoraphobic Posted February 15, 2009 Share Posted February 15, 2009 Sorry you are right, I am just used to putting exit subs my script works with or without the exit sub there. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 do you think it could have something to do with the server glitching maybe. because I tried an old script I had that I know worked, and it said the same exact error. Link to comment Share on other sites More sharing options...
Agoraphobic Posted February 15, 2009 Share Posted February 15, 2009 Let me input your script and see if I get the same error and I'll check it out as well. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 ok. Thank you very much for your time. tell me how it goes. Link to comment Share on other sites More sharing options...
Agoraphobic Posted February 15, 2009 Share Posted February 15, 2009 Hmm I'm not getting a error, but it doesn't appear to be working for me once I uploaded it and added the .ini files to the server. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 I remade all my .inis and made a new character, and it worked for 2 attacks but then I got like 5 thousand errors. and it was like cant show modal form when theres is no modal form. what ever modal means lol. any ideas?oh and btw, the script wont work unless you make a new character. well, it's not supposed to work unless you make one.edit: ok now I have type mismatch "attackdelay" hmmmm… Link to comment Share on other sites More sharing options...
Agoraphobic Posted February 15, 2009 Share Posted February 15, 2009 I'm not quite sure on this problem sorry I wasn't any help. Perhaps one of the other scripters that has more experience will be able to help. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 ok well I really appreciate your help. see you around. Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 holy crap I got it. I forgot to add numbers at the end of hitdelay… Link to comment Share on other sites More sharing options...
dg1423 Posted February 15, 2009 Share Posted February 15, 2009 just so you know, this is a horrible way to do directional checks. I can reduce this script to 1/5 of it's size. xDD Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 can u explain how to make it that small? Link to comment Share on other sites More sharing options...
dg1423 Posted February 15, 2009 Share Posted February 15, 2009 notice all your directional checks? throw em all away and for example change this sub:```sub attackanimation(index, animation) dim map dim playerx dim playery dim dir map = getplayermap(index) playerx = getplayerx(index) playery = getplayery(index) dir = getplayerdir(index) if dir = 0 then call spellanim(animation, map, playerx, playery - 1) elseif dir = 1 then call spellanim(animation, map, playerx, playery + 1) elseif dir = 2 then call spellanim(animation, map, playerx - 1, playery) else call spellanim(animation, map, playerx + 1, playery) end ifend sub```to this:```sub attackanimation(index, animation)Call SpellAnim(Animation, GetPlayerMap(index), GetPlayerDirX(index), GetPlayerDirY(index))end sub```see how much of a difference that makes? XD Link to comment Share on other sites More sharing options...
ryono Posted February 15, 2009 Author Share Posted February 15, 2009 lolz… well I might remake the script, its kinda "tangled up" if you will. but I got it to work. so it's all good. 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