lepom0102 Posted March 10, 2016 Author Share Posted March 10, 2016 for those with npc spell system 2.0open Serverfind ModCombatfind NpcSpellPlayer and replace```Sub NpcSpellPlayer(ByVal mapNpcNum As Long, ByVal Victim As Long, SpellSlotNum As Long)Dim Mapnum As LongDim i As Long, j As LongDim n As LongDim spellnum As LongDim Buffer As clsBufferDim InitDamage As LongDim Damage As LongDim MaxHeals As Long' Check for subscript out of rangeIf mapNpcNum <= 0 Or mapNpcNum > MAX_MAP_NPCS Or IsPlaying(Victim) = False ThenExit SubEnd If' Check for subscript out of rangeIf MapNpc(GetPlayerMap(Victim)).NPC(mapNpcNum).Num <= 0 ThenExit SubEnd IfIf SpellSlotNum <= 0 Or SpellSlotNum > MAX_NPC_SPELLS Then Exit Sub' The VariablesMapnum = GetPlayerMap(Victim)spellnum = NPC(MapNpc(Mapnum).NPC(mapNpcNum).Num).Spell(SpellSlotNum)' Send this packet so they can see the person attackingSet Buffer = New clsBufferBuffer.WriteLong SNpcAttackBuffer.WriteLong mapNpcNumSendDataToMap Mapnum, Buffer.ToArray()Set Buffer = Nothing' CoolDown TimeIf MapNpc(Mapnum).NPC(mapNpcNum).SpellTimer(SpellSlotNum) > GetTickCount Then Exit Sub' Spell TypesSelect Case Spell(spellnum).Type' AOE Healing Spells' AOE Damaging SpellsCase SPELL_TYPE_DAMAGEHP' Make sure an npc waits for the spell to cooldownSendAnimation 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 SubCase SPELL_TYPE_DAMAGEMP ' Make sure an npc waits for the spell to cooldownSendAnimation 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 SubCase 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 SubCase 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 SubEnd SelectExit SubEnd Subok. 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``` 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