Admiral Refuge Posted March 8, 2009 Author Share Posted March 8, 2009 Well, I have to face the fact that I'm going to have to get spells working one way or another, and I figured, why not just script them?Now, I'm at a loss….What's wrong with this scripted spell? It's just suppose to take 3 HP away from a player or NPC... It can target a player fine, and zap the player fine, but it doesn't show the animation.I don't think it's doing anything for the NPC at all...```'~~~~~~~~~~~~~~~~~' Spells'~~~~~~~~~~~~~~~~~Sub epicspell(index) dim mp mp = 5 dim target if getplayermp(index) >= mp then if getplayertarget(index) > 0 then target = getplayertarget(index) call DamagePlayer(index, target, 3) call spellanim(getplayermap(target), getplayerX(target), getplayerY(target), 61) mp = getplayermp(index) - 5 call setplayermp(index, mp) else if getplayertarget(index) < 0 then target = getplayertargetnpc(index) Call DamagePlayer(index, target, 3) call spellanim(getplayermap(target), getplayerx(target), getplayery(target), 61) mp = getplayermp(index) - 5 call setplayermp(index, mp) end if end if else call playermsg(index, "You need 5 MP!", 1) end ifend sub```EDIT: Crap, I just realized that I'm trying to deduct the NPC's HP with a damagePlayer command… That wouldn't work, would it?If that's the case, what command can I use to dmg the NPC? And what am I doing wrong with the animation (I think I need to change the animation command for the NPC, but the player one isn't working either) Link to comment Share on other sites More sharing options...
Jed Posted March 8, 2009 Share Posted March 8, 2009 Admiral, look around this area:if getplayertarget(index) < 0 then target = getplayertargetnpc(index) Call DamagePlayer(index, target, 3) call spellanim(getplayermap(target), **getplayerx(target), getplayery(target)**, 61) mp = getplayermp(index) - 5 call setplayermp(index, mp)try replacing that with something like this:getplayertarget(Map, X, Y)or you can try this:X = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "x")Y = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "y")try replacing that, and if it does not work, please reply. Link to comment Share on other sites More sharing options...
Nubbs Posted March 8, 2009 Share Posted March 8, 2009 you need to call this to damage a npc```DamageNPC(index, target, 3)```then to call the spell animation you would need to do something like this instead```Call SpellAnim(GetPlayerMap(index),GetNpcX(mapnum,npcnum) , GetNpcY(mapnum,npcnum), 61)```mapnum = the map the npc is onnpcnum = the number of the npcTry to "Dim" everything in your Call SpellAnim(whatever) so it looks like Call SpellAnim(1, 2, 3, 4, 61) of course "1,2,3,4" being what you want them to be.. and 61 is the spellanim as you already know ;)hope that helps you outbtw just wondering 2 things:1:can this spell kill the player?2: and does it take away the 5 mp ? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 8, 2009 Author Share Posted March 8, 2009 Thanks for all your help so far!Also Nubbs, yes it can kill players (I just used it on myself lol), and it does take away 5 mp (or whatever the var "mp" is).You can now successfully attack the NPCs, but it's still not showing the animation.Though, I did find that I was calling the animation wrong, and it should be:Call SpellAnim(61, map, x, y)But it's still not working (not for the npc, or the player)Here's the updated spell:```'~~~~~~~~~~~~~~~~~' Spells'~~~~~~~~~~~~~~~~~Sub epicspell(index) dim mp dim dmg dim anm dim target dim x dim y dim npc mp = 5 map = getplayermap(index) dmg = 3 anm = 61 if getplayermp(index) >= mp then if getplayertarget(index) > 0 then target = getplayertarget(index) y = getplayerY(target) x = getplayerX(target) call DamagePlayer(index, target, dmg) Call SpellAnim(map, x, y, anm) mp = getplayermp(index) - mp call setplayermp(index, mp) else if getplayertarget(index) < 0 then target = getplayertargetnpc(index) npc = GetMapNPCnumber(map, target) y = GetNpcY(map, npc) x = GetNpcX(map, npc) Call DamageNPC(index, target, dmg) Call SpellAnim(map, x, y, anm) mp = getplayermp(index) - mp call setplayermp(index, mp) end if end if else call playermsg(index, "You need 5 MP!", 1) end ifend sub```So I guess ~~two~~ a question~~s~~…~~I **know** I'm not calling the animation correctly for the NPCs; I don't think I'm using the getmapnpcnumer right, nor am I using the GetNpcX or GetNpcY right…How would I call the animation on the NPC correctly (since I don't know how to get the number)?~~And of course, why isn't the spell animation working at all (player or npc)?**EDIT:** I don't think I was calling the spell animation wrong…**EDIT2:** I updated the spell abit Link to comment Share on other sites More sharing options...
Nubbs Posted March 8, 2009 Share Posted March 8, 2009 you have target dimmed as target = GetPlayerTarget {which get the (enemy player) not the enemy npc you would need something liketarget2 = getplayertargetnpc(index)your (target) wont work since you have it dimmed twice as 2 different things let me see if i can write this for you.. Link to comment Share on other sites More sharing options...
Nubbs Posted March 8, 2009 Share Posted March 8, 2009 ok so if you have spell animation 61 then this should work on players but the npc part im still not sure about but it might work here's what i got .. sorry i havent tested it```~~~~~~~~~~~~~~~~~' Spells'~~~~~~~~~~~~~~~~~Sub epicspell(index) Dim mp Dim dmg Dim anm Dim target Dim y Dim x Dim npcx Dim npcy Dim l Dim mob mp = 5 dmg = 3 anm = 61 target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) npcx = GetNpcX(l , mob) npcy = GetNpcY(l , mob) l = GetPlayerMap(index) mob = GetPlayerTargetNpc(index) If GetPlayerMP(index) >= mp Then If GetPlayerTarget(index) > 0 Then Call DamagePlayer(index, target, dmg) Call SpellAnim( anm, l, x, y)) mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) Else If GetPlayerTargetNpc(index) < 0 Then Call DamageNPC(index, mob, dmg) Call SpellAnim(map, npcx,npcy, anm) mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) End If End If Else Call PlayerMsg(index, "You need 5 MP!", 1) End IfEnd Sub``` Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 8, 2009 Author Share Posted March 8, 2009 I was able to get it working correctly with the one you posted (had to swap afew vars), but the animation still isn't working.Hmm… I wonder if the bugged spells is preventing the animation from showing... Because both versions of those spells (mine and yours) work flawless (excluding the animation). Link to comment Share on other sites More sharing options...
Nubbs Posted March 8, 2009 Share Posted March 8, 2009 do you have spell animation 61? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 8, 2009 Author Share Posted March 8, 2009 @[SB:> Nubbs aka mR. FahREnhEIT link=topic=40091.msg391899#msg391899 date=1236541320]> do you have spell animation 61?I tried 61, I tried 2, I tried alot of them. The animation just isn't showing up in general (I have a bad feeling that it's a bug) Link to comment Share on other sites More sharing options...
Nubbs Posted March 8, 2009 Share Posted March 8, 2009 a bug with scripted spell animations>? have you tried making yourself the target of the spell animation besides the player/npc ? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 8, 2009 Author Share Posted March 8, 2009 @[SB:> Nubbs aka mR. FahREnhEIT link=topic=40091.msg391910#msg391910 date=1236541854]> a bug with scripted spell animations>? have you tried making yourself the target of the spell animation besides the player/npc ?YepI take dmg, I loose MP, but I the animation doesn't show Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 13, 2009 Author Share Posted March 13, 2009 **I GOT IT WORK!**Okay, finally, scripted spell script!To figure out what I was doing wrong, I actually started using PlayerMsg to read the the vars, to make sure everything was saving right…See the script below (fully works!)```'~~~~~~~~~~~~~~~~~' Spells'~~~~~~~~~~~~~~~~~Sub epicspell(index) Dim mp Dim dmg Dim anm Dim target Dim x Dim y Dim npc mp = 1 map = GetPlayerMap(index) dmg = 50 anm = 3 If GetPlayerMP(index) >= mp Then If GetPlayerTarget(index) > 0 Then target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) Call DamagePlayer(index, target, dmg) Call SpellAnim(anm, map, x, y) Call PlaySound(index, "magic1.wav") mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) Else If GetPlayerTarget(index) < 0 Then target = GetPlayerTargetNpc(index) npc = GetMapNpcNumber(map, target) y = GetNpcY(map, target) x = GetNpcX(map, target) Call PlayerMsg(index, "Map is " & map & " Npc x is " & x & " Npc y is " & y & " npc number is " & npc & " okay", 1) Call DamageNPC(index, target, dmg) Call SpellAnim(anm, map, x, y) Call PlaySound(index, "magic1.wav") mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) End If End If Else Call PlayerMsg(index, "You need 5 MP!", 1) End IfEnd Sub```Once I make sure all the magic numbers are gone, I'll paste it in the script database! Link to comment Share on other sites More sharing options...
Nubbs Posted March 16, 2009 Share Posted March 16, 2009 nice work so why wasnt the spell animation showing up with the others? i couldnt figure it out Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 16, 2009 Author Share Posted March 16, 2009 I was using "index" instead of "target" for one of the get or call functions; something like that. 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