for those with  npc spell system 2.0

open Server
find ModCombat
find NpcSpellPlayer and replace


Sub NpcSpellPlayer(ByVal mapNpcNum As Long, ByVal Victim As Long, SpellSlotNum As Long)
Dim Mapnum As Long
Dim i As Long, j As Long
Dim n As Long
Dim spellnum As Long
Dim Buffer As clsBuffer
Dim InitDamage As Long
Dim Damage As Long
Dim MaxHeals As Long

' Check for subscript out of range
If mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or IsPlaying(Victim) = False Then
Exit Sub
End If

' Check for subscript out of range
If MapNpc(GetPlayerMap(Victim)).NPC(mapNpcNum).Num <= 0 Then
Exit Sub
End If

If SpellSlotNum <= 0 Or SpellSlotNum > MAX_NPC_SPELLS Then Exit Sub

' The Variables
Mapnum = GetPlayerMap(Victim)
spellnum = NPC(MapNpc(Mapnum).NPC(mapNpcNum).Num).Spell(SpellSlotNum)

' Send this packet so they can see the person attacking
Set Buffer = New clsBuffer
Buffer.WriteLong SNpcAttack
Buffer.WriteLong mapNpcNum
SendDataToMap Mapnum, Buffer.ToArray()
Set Buffer = Nothing

' CoolDown Time
If MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) > GetTickCount Then Exit Sub

' Spell Types
Select Case Spell(spellnum).Type
' AOE Healing Spells

' AOE Damaging Spells
Case SPELL_TYPE_DAMAGEHP
' Make sure an npc waits for the spell to cooldown
SendAnimation Mapnum, Spell(spellnum).CastAnim, 0, 0, TARGET_TYPE_NPC, mapNpcNum
            For i = 1 To Player_HighIndex

            If IsPlaying(Victim) = True Then
              If IsPlaying(i) = True And GetPlayerMap(i) = Mapnum Then

                     If isInRange(Spell(spellnum).Range, MapNpc(Mapnum).NPC(mapNpcNum).x, MapNpc(Mapnum).NPC(mapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then

               InitDamage = Spell(spellnum).Vital

               Damage = InitDamage * 10

               If Damage <= 0 Then

                   SendActionMsg GetPlayerMap(i), "RESIST!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32)

                   Exit Sub

               End If
               If Spell(spellnum).StunDuration > 0 Then 'stun

             StunPlayer i, spellnum

                    End If

                  NpcAttackPlayer mapNpcNum, i, Damage

                   SendAnimation Mapnum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, i
                   End If
                   End If
                   End If
                   Next

                   MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000

                   Exit Sub

Case SPELL_TYPE_DAMAGEMP

   ' Make sure an npc waits for the spell to cooldown

SendAnimation Mapnum, Spell(spellnum).CastAnim, 0, 0, TARGET_TYPE_NPC, mapNpcNum
           For i = 1 To Player_HighIndex
           If IsPlaying(Victim) = True Then
                If IsPlaying(i) = True And GetPlayerMap(i) = Mapnum Then
                     If isInRange(Spell(spellnum).Range, MapNpc(Mapnum).NPC(mapNpcNum).x, MapNpc(Mapnum).NPC(mapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then

               InitDamage = Spell(spellnum).Vital

               Damage = InitDamage * 10

               If Damage <= 0 Then

                   SendActionMsg GetPlayerMap(i), "RESIST!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32)

                   Exit Sub

               End If
               If Spell(spellnum).StunDuration > 0 Then 'stun

               StunPlayer i, spellnum

                 End If

                   SpellPlayer_Effect Vitals.MP, False, i, Damage, spellnum

                   SendAnimation Mapnum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, i
                   End If
                   End If
                   End If
                   Next

                   MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000

                   Exit Sub

Case SPELL_TYPE_HEALHP
' Make sure an npc waits for the spell to cooldown

       For i = 1 To MAX_MAP_NPCS
       If IsPlaying(Victim) = True Then

               If isInRange(Spell(spellnum).Range, MapNpc(Mapnum).NPC(mapNpcNum).x, MapNpc(Mapnum).NPC(mapNpcNum).y, MapNpc(Mapnum).NPC(i).x, MapNpc(Mapnum).NPC(i).y) Then

               InitDamage = Spell(spellnum).Vital

               Damage = InitDamage * 10

               If Damage <= 0 Then

                   'SendActionMsg GetPlayerMap(Victim), "RESIST!", Pink, 1, (GetPlayerX(Victim) * 32), (GetPlayerY(Victim) * 32)

                   Exit Sub

              End If

                   SpellNpc_Effect Vitals.HP, True, i, Damage, spellnum, Mapnum

                   SendAnimation Mapnum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_NPC, i

                   End If
                   End If
                   Next
               MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
                Exit Sub

Case SPELL_TYPE_HEALMP
' Make sure an npc waits for the spell to cooldown

        For i = 1 To MAX_MAP_NPCS
        If IsPlaying(Victim) = True Then
               If isInRange(Spell(spellnum).Range, MapNpc(Mapnum).NPC(mapNpcNum).x, MapNpc(Mapnum).NPC(mapNpcNum).y, MapNpc(Mapnum).NPC(i).x, MapNpc(Mapnum).NPC(i).y) Then

               InitDamage = Spell(spellnum).Vital

               Damage = InitDamage * 10

               If Damage <= 0 Then

                   'SendActionMsg GetPlayerMap(Victim), "RESIST!", Pink, 1, (GetPlayerX(Victim) * 32), (GetPlayerY(Victim) * 32)

                   Exit Sub

              End If

                   SpellNpc_Effect Vitals.MP, True, i, Damage, spellnum, Mapnum

                   SendAnimation Mapnum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_NPC, i

                   End If
                   End If
                   Next
                  MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
                   Exit Sub

End Select
Exit Sub
End Sub

ok. now you set 1 new spells, and tuning range> 0, type hp and mp is heal for npc, damage hp and mp is for players, you can also adjust the time to stun  players. good luck