Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO 3.0] NpcSpellPlayer Error


My Brave Shine
 Share

Recommended Posts

Hello Darling's Eclipsians. 

I Have one trouble, in Serve Side.

What Happens?!

I create one Spell and set she in one Npc // The Npc cast good, animations and damage work Fine. But, have case when Player has Killed to one Npc Nomal Damage or Spell  :s , he broken the server, and this is constant.

The error says Number 9 , and appoint this Line : 

```
' Spell Types

Select Case Spell(spellnum).Type
```
Inside of PlayerSpellNpc // ModCombat.

Above one image of line and sub.

```
 [img]http://i.imgur.com/xpbk3qv.png[/img]
```
All Sub:

```
Sub NpcSpellPlayer(ByVal MapNpcNum As Long, ByVal victim As Long, SpellSlotNum As Long)

Dim mapNum As Long
Dim i 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
Dim HPCost As Long
Dim DidCast As Boolean

' 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
Case SPELL_TYPE_HEALHP
' Make sure an npc waits for the spell to cooldown
MaxHeals = 1 + NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) \ 25
If MapNpc(mapNum).NPC(MapNpcNum).Heals >= MaxHeals Then Exit Sub
If MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) <= NPC(MapNpc(mapNum).NPC(MapNpcNum).num).HP * 0.3 Then
If Spell(spellnum).IsAoE Then
For i = 1 To MAX_MAP_NPCS
If MapNpc(mapNum).NPC(i).num > 0 Then
If MapNpc(mapNum).NPC(i).Vital(Vitals.HP) > 0 Then
If isInRange(Spell(spellnum).AoE, 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 + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)

MapNpc(mapNum).NPC(i).Vital(Vitals.HP) = MapNpc(mapNum).NPC(i).Vital(Vitals.HP) + InitDamage
SendActionMsg mapNum, "+" & InitDamage, BrightGreen, 1, (MapNpc(mapNum).NPC(i).x * 32), (MapNpc(mapNum).NPC(i).y * 32)
Call SendAnimation(mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_NPC, MapNpcNum)

If MapNpc(mapNum).NPC(i).Vital(Vitals.HP) > NPC(MapNpc(mapNum).NPC(i).num).HP Then
MapNpc(mapNum).NPC(i).Vital(Vitals.HP) = NPC(MapNpc(mapNum).NPC(i).num).HP
End If

MapNpc(mapNum).NPC(MapNpcNum).Heals = MapNpc(mapNum).NPC(MapNpcNum).Heals + 1

MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
Exit Sub
End If
End If
End If
Next
Else
' Non AOE Healing Spells
InitDamage = Spell(spellnum).Vital + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)

MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) = MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) + InitDamage
SendActionMsg mapNum, "+" & InitDamage, BrightGreen, 1, (MapNpc(mapNum).NPC(MapNpcNum).x * 32), (MapNpc(mapNum).NPC(MapNpcNum).y * 32)
Call SendAnimation(mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_NPC, MapNpcNum)

If MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) > NPC(MapNpc(mapNum).NPC(MapNpcNum).num).HP Then
MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) = NPC(MapNpc(mapNum).NPC(MapNpcNum).num).HP
End If

MapNpc(mapNum).NPC(MapNpcNum).Heals = MapNpc(mapNum).NPC(MapNpcNum).Heals + 1

MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
Exit Sub
End If
End If

' AOE Damaging Spells
Case SPELL_TYPE_DAMAGEHP
' Make sure an npc waits for the spell to cooldown
If Spell(spellnum).IsAoE Then
For i = 1 To Player_HighIndex
If isPlaying(i) Then
If GetPlayerMap(i) = mapNum Then
InUseArea2 i, MapNpcNum, spellnum
If isInRange(Spell(spellnum).AoE, MapNpc(mapNum).NPC(MapNpcNum).x, MapNpc(mapNum).NPC(MapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then
       If Spell(spellnum).IsAoE = True Then
           InUseArea i, spellnum
           DidCast = True
       End If
   End If
InitDamage = Spell(spellnum).Vital + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)
Damage = InitDamage - Player(i).stat(Stats.Willpower)
If Damage <= 0 Then
SendActionMsg GetPlayerMap(i), "RESIST!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32)
Exit Sub
Else

If Spell(spellnum).StunDuration > 0 Then
StunPlayer victim, spellnum
End If

NpcAttackPlayer MapNpcNum, i, Damage
SendAnimation mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, MapNpcNum
MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
Exit Sub
End If
End If
End If
Next
' Non AoE Damaging Spells
Else
If isInRange(Spell(spellnum).Range, MapNpc(mapNum).NPC(MapNpcNum).x, MapNpc(mapNum).NPC(MapNpcNum).y, GetPlayerX(victim), GetPlayerY(victim)) Then
InitDamage = Spell(spellnum).Vital + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)
Damage = InitDamage - Player(victim).stat(Stats.Willpower)
If Damage <= 0 Then
SendActionMsg GetPlayerMap(victim), "RESIST!", Pink, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)
Exit Sub
Else

If Spell(spellnum).StunDuration > 0 Then
StunPlayer victim, spellnum
End If

NpcAttackPlayer MapNpcNum, victim, Damage
SendAnimation mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, victim
MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000
Exit Sub
End If
End If
End If
End Select
End Sub

```

I shall be grateful if someone get help , even if you try ! (Sorry my bad english : / )
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...