My Brave Shine Posted July 3, 2015 Author Share Posted July 3, 2015 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 TypesSelect 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 LongDim i As LongDim n As LongDim spellnum As LongDim buffer As clsBufferDim InitDamage As LongDim Damage As LongDim MaxHeals As LongDim HPCost As LongDim DidCast As Boolean' 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 SpellsCase SPELL_TYPE_HEALHP' Make sure an npc waits for the spell to cooldownMaxHeals = 1 + NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) \ 25If MapNpc(mapNum).NPC(MapNpcNum).Heals >= MaxHeals Then Exit SubIf MapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) <= NPC(MapNpc(mapNum).NPC(MapNpcNum).num).HP * 0.3 ThenIf Spell(spellnum).IsAoE ThenFor i = 1 To MAX_MAP_NPCSIf MapNpc(mapNum).NPC(i).num > 0 ThenIf MapNpc(mapNum).NPC(i).Vital(Vitals.HP) > 0 ThenIf isInRange(Spell(spellnum).AoE, MapNpc(mapNum).NPC(MapNpcNum).x, MapNpc(mapNum).NPC(MapNpcNum).y, MapNpc(mapNum).NPC(i).x, MapNpc(mapNum).NPC(i).y) ThenInitDamage = 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) + InitDamageSendActionMsg 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 ThenMapNpc(mapNum).NPC(i).Vital(Vitals.HP) = NPC(MapNpc(mapNum).NPC(i).num).HPEnd IfMapNpc(mapNum).NPC(MapNpcNum).Heals = MapNpc(mapNum).NPC(MapNpcNum).Heals + 1MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000Exit SubEnd IfEnd IfEnd IfNextElse' Non AOE Healing SpellsInitDamage = 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) + InitDamageSendActionMsg 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 ThenMapNpc(mapNum).NPC(MapNpcNum).Vital(Vitals.HP) = NPC(MapNpc(mapNum).NPC(MapNpcNum).num).HPEnd IfMapNpc(mapNum).NPC(MapNpcNum).Heals = MapNpc(mapNum).NPC(MapNpcNum).Heals + 1MapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000Exit SubEnd IfEnd If' AOE Damaging SpellsCase SPELL_TYPE_DAMAGEHP' Make sure an npc waits for the spell to cooldownIf Spell(spellnum).IsAoE ThenFor i = 1 To Player_HighIndexIf isPlaying(i) ThenIf GetPlayerMap(i) = mapNum ThenInUseArea2 i, MapNpcNum, spellnumIf 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 IfInitDamage = Spell(spellnum).Vital + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)Damage = InitDamage - Player(i).stat(Stats.Willpower)If Damage <= 0 ThenSendActionMsg GetPlayerMap(i), "RESIST!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32)Exit SubElseIf Spell(spellnum).StunDuration > 0 ThenStunPlayer victim, spellnumEnd IfNpcAttackPlayer MapNpcNum, i, DamageSendAnimation mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, MapNpcNumMapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000Exit SubEnd IfEnd IfEnd IfNext' Non AoE Damaging SpellsElseIf isInRange(Spell(spellnum).Range, MapNpc(mapNum).NPC(MapNpcNum).x, MapNpc(mapNum).NPC(MapNpcNum).y, GetPlayerX(victim), GetPlayerY(victim)) ThenInitDamage = Spell(spellnum).Vital + (NPC(MapNpc(mapNum).NPC(MapNpcNum).num).stat(Stats.Intelligence) / 2)Damage = InitDamage - Player(victim).stat(Stats.Willpower)If Damage <= 0 ThenSendActionMsg GetPlayerMap(victim), "RESIST!", Pink, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)Exit SubElseIf Spell(spellnum).StunDuration > 0 ThenStunPlayer victim, spellnumEnd IfNpcAttackPlayer MapNpcNum, victim, DamageSendAnimation mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, victimMapNpc(mapNum).NPC(MapNpcNum).SpellTimer(SpellSlotNum) = GetTickCount + Spell(spellnum).CDTime * 1000Exit SubEnd IfEnd IfEnd IfEnd SelectEnd Sub```I shall be grateful if someone get help , even if you try ! (Sorry my bad english : / ) 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