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

[EO] NPC Spells v.2.0.0


DJMaxus
 Share

Recommended Posts

  • Replies 188
  • Created
  • Last Reply

Top Posters In This Topic

  • 4 months later...
I am in trouble, my npc not to use that skill? excuse my english

@EDIT

I arranged the problem the more attacking npc this very fast why? when I put more than two spells in a npc to his attack animation is very fast over there when he uses the second spell he gets the usual animation, and also the npc not batento this normal, taking this hit a little ..
Link to comment
Share on other sites

  • 2 weeks later...
Thanks, great tutorial! ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

If anyone needs the code for DAMAGE MP add this to npcspellplayer before end select

```

Case SPELL_TYPE_DAMAGEMP

' 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

If isInRange(Spell(SpellNum).AoE, MapNpc(mapnum).Npc(MapNpcNum).x, MapNpc(mapnum).Npc(MapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then

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

SpellPlayer_Effect Vitals.mp, False, Victim, Damage, SpellNum

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

End If

Next

' Non AoE DamagingMP 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

SpellPlayer_Effect Vitals.mp, False, Victim, Damage, SpellNum

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

```

For people with [this buff system](http://www.touchofdeathforums.com/community/index.php?/topic/125070-eo-buffdebuff-spells-v12/page__hl__buff) liking to combine it with the buff tutorial. Add this before end select:

Please NOTE: This will always hit players only, if you use an ADD BUFF it would be a supportive NPC. SUB BUFF should work fine too

```
Dim dur As Long

dur = 1 + (Spell(SpellNum).Duration * Round(Npc(MapNpc(mapnum).Npc(MapNpcNum).num).stat(Stats.willpower) / 4))

'Make sure an npc waits for the spell to cooldown

'AoE SUB & SUB naar player.

If Spell(SpellNum).IsAoE Then

For i = 1 To Player_HighIndex

If IsPlaying(i) Then

If GetPlayerMap(i) = mapnum Then

If isInRange(Spell(SpellNum).AoE, MapNpc(mapnum).Npc(MapNpcNum).x, MapNpc(mapnum).Npc(MapNpcNum).y, GetPlayerX(i), GetPlayerY(i)) Then

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

ApplyBuff Victim, Spell(SpellNum).BuffType, dur, 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

End If

Next

'non AoE SUB buff

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

ApplyBuff Victim, Spell(SpellNum).BuffType, dur, 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
```
Link to comment
Share on other sites

  • 2 weeks later...
> someone makes an engine with this system it please

Or… you could spend 5 minutes putting this into your source. Thinking outside the box ;].
Link to comment
Share on other sites

Rolled back client and server to see if maybe its a bug from earlier compile that i didnt catch till now..

Yep Deathbeams pathing is causing it although its not as noticeable until i add this into it.. Guess this is something unique to me and it just isnt playing friendly.

on plain nightly EO3 i can confirm that this TUT works PERFECTLY except you will have to make the npc editor form your self (just copy paste the spell section and copy paste anyhting in the code that mentions spells on that form)

And several lines are under different mods

A+ now off to debug :/
Link to comment
Share on other sites

  • 4 weeks later...
  • 6 months later...
> i get an error in the server only when i am killed by an npc that has spells, its a rte 9 error and it hightlights this
>
> ```
> Select Case Spell(spellnum).Type
> ```
> in npcspell player sub anyone have this issue? the npcs cast spells and everything but if they kill a player my server crashes. and for some reason if only does this if its on the first map.

I know this thread is old, but I also have this problem minus the death only on first map. What's strange is in a fresh copy of EO 2.3, it's perfect. It never crashes, but in a modified version of EO 2.3 (My Modified version) it crashes on death. I've noticed it only crashes if the spell the NPC has involves healing itself. I put the code in the exact same places and everything. I can't figure it out. I've gone through the tut about 4 times now. Please, someone help!

-EDIT-

Well, I've found out what causes the crashes. Unlike my previous fixes and guesses, It has nothing to do with Alatar's Checkpoint system. It has to do with NPCs. If you have a NPC on the map that you get booted back to, it'll crash. Simple as that. I guess it doesn't refresh the Spell for NPCs fast enough or something. If anyone can fix this error, it'd be greatly appreciated!

My way for the fix is to just have them respawn to a map with no NPCs. Use this method until someone makes a proper fix.
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

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...