BugSICK Posted July 27, 2009 Author Share Posted July 27, 2009 i found a script trough surfing a month ago, but i cant find it right now, its a spell animation on npc death. anybody knows?and correct me on this please.```Call SpellAnim(6, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index))```the spell animation is random on the map, how can i correct it. thanks Link to comment Share on other sites More sharing options...
Dennys Posted July 27, 2009 Share Posted July 27, 2009 SHoulnt it be:```Call SpellAnim(6, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetNpcY(GetPlayerMap(index), npcnum)) ```Instead of The Players Y position it should be the NPC's Y position sicne its an animation on the NPC not the players, Hence if you put NpcY and then Player X you will get teh spell anim at a random point depending on both the players and the Npcs Position. Link to comment Share on other sites More sharing options...
Greendude120 Posted July 27, 2009 Share Posted July 27, 2009 Warning - while you were reading a new reply has been posted. You may wish to review your post. (Dammnit! lol)Goes under Sub OnAttack(Index, Damage). Under the current stuff already in there..::..::..::..::..::..::.Dim npcnumnpcnum = GetPlayerTargetNPC(Index)If GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then If GetPlayerDir(index) = 0 Then Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) End IfElseEnd IfIf GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then If GetPlayerDir(index) = 1 Then Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) End IfElseEnd IfIf GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then If GetPlayerDir(index) = 2 Then Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End IfElseEnd IfIf GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then If GetPlayerDir(index) = 3 Then Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End IfElseEnd IfEnd Sub'Dont bother adding the End Sub above! You only need one. its just to give you an idea where the script would go.::..::..::..::..::..::.Change the orange numbers to the Spell Animation Number of courseEach animation will play if all requirements are met. The requirements are the player direction. (There is one for each direction so itll always be met) And that the NPCs health is below 1\. Which only leaves 0 which means dead… so it should play when u pwn the npc.I didnt test it but it looks like itll work.I know you only asked for the 1 line lol but i quickly found the player attack animation that mr miguu made, and i turned it into this so didnt take me long. Link to comment Share on other sites More sharing options...
BugSICK Posted July 27, 2009 Author Share Posted July 27, 2009 i tried your code still its random, some appeared in me and some in NPC and sometimes doenst appeared. and if i move the death animation moves too. :cry: Link to comment Share on other sites More sharing options...
Greendude120 Posted July 27, 2009 Share Posted July 27, 2009 I dont get what you mean by the animation moves…? when u call an animation its suppose to full play on the given map and coordinates. also are u such u placed the script in the right place. I just tested it on my sub and it works fine. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 27, 2009 Share Posted July 27, 2009 Greendude120's has a better chance of succeeding, as I think the OnNpcDeath sub executes after the NPC has died, which means he will no longer have an X or Y on the map.Though he doesn't need the "Else" in his If-Then statement, and he could just do:```If GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then If GetPlayerDir(index) = 0 Then Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) End If If GetPlayerDir(index) = 1 Then Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) End If If GetPlayerDir(index) = 2 Then Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End If If GetPlayerDir(index) = 3 Then Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End IfEnd If```Or even better,```If GetMapNpcHP(GetPlayerMap(Index), npcnum) < 1 Then Select Case GetPlayerDir(Index) Case 0 Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) Case 1 Call SpellAnim(1, GetPlayerMap(index), GetPlayerX(index), GetNpcY(GetPlayerMap(index), npcnum)) Case 2 Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) Case 3 Call SpellAnim(1, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End SelectEnd If```These would require less computation atleast.Though, both codes seem abit unstable.Warning - while you were typing a new reply has been posted. You may wish to review your post.@BugSICK:> i tried your code still its random, some appeared in me and some in NPC and sometimes doenst appeared. and if i move the death animation moves too. :cry:Give me afew; I'll see if I can work something out.Warning - while you were typing a new reply has been posted. You may wish to review your post.Depending on the direction the player faces, it looks like you're using the player's X or Y; in theory, if the player moves before the spell animation players, it will move in relation to where the player moved, and not on the NPC. Link to comment Share on other sites More sharing options...
Greendude120 Posted July 27, 2009 Share Posted July 27, 2009 Yea im not familiar with Cases and case select but that one by admiral looks good.Also i think i know what ur problem is. I just got my client and server unsynced (cause of the map freeze bug) and i attacked an npc but the animation was on my char cause of the unsync. so maybe thats what happening to you? Link to comment Share on other sites More sharing options...
BugSICK Posted July 27, 2009 Author Share Posted July 27, 2009 hmmm. should i put it in the sub onattack or in the npcdeath? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 27, 2009 Share Posted July 27, 2009 Okay, this should work; just throw it into your OnNpcDeath; it seems to execute before killing the NPCs:```Call SpellAnim(1, Map, GetNpcX(Map, NPCIndex), GetNpcY(Map, NPCIndex))```Of course, replace "1" with the spell's number.EDIT: Incase anyone wants to know what the problem was (incase it isn't obvious), GetNpcX takes in two values: The NPC's map, and the NPC's Index on that map. You guys (excluding Greendude) were passing the NPC's number in; you needed to pass the index (luckily, the map and NPC index are passed into OnNpcDeath XD) Link to comment Share on other sites More sharing options...
Dennys Posted July 27, 2009 Share Posted July 27, 2009 Admiral thats excatly what i said to him…. But mine was ignored by both Greendude and and yourself Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 27, 2009 Share Posted July 27, 2009 @Bloodmyst:> Admiral thats excatly what i said to him…. But mine was ignored by both Greendude and and yourselfPlease read my "Edit".You were passing in "npcnum" not "npcindex".(also, you didn't have to GetPlayerMap, as "Map" is already passed though, and better, it's the NPC's map, not the player's map) Link to comment Share on other sites More sharing options...
BugSICK Posted July 27, 2009 Author Share Posted July 27, 2009 thanks admiral it works perfectly both x and y direction left and right, top and bottom, ;) Link to comment Share on other sites More sharing options...
Dennys Posted July 27, 2009 Share Posted July 27, 2009 i wasent parsing anythign i left the script like he had it i just fixed what was wrong, now if he dint define the right NpcIndex or NpcNum then he shoudl have posted more info about the script, dotn you think? Link to comment Share on other sites More sharing options...
Greendude120 Posted July 27, 2009 Share Posted July 27, 2009 I didnt ignore yours. I just thought id put the whole thing up for him. Link to comment Share on other sites More sharing options...
BugSICK Posted July 27, 2009 Author Share Posted July 27, 2009 thank you both for the replies. ive tried your both code. its just i cant explained the way it was. 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