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

  • 3 weeks later...
  • Replies 188
  • Created
  • Last Reply

Top Posters In This Topic

I had this error (in client) Variable not defined MAX_NPC_SPELLS so I added
Public Const MAX_NPC_SPELLS As Long = 5        to the modConstans and now I have Variable not defined SpellIndex
(Npc(EditorIndex).Spell(SpellIndex) = scrlSpell.Value)
Any help?
Link to comment
Share on other sites

@Peter112:

> I had this error (in client) Variable not defined MAX_NPC_SPELLS so I added
> Public Const MAX_NPC_SPELLS As Long = 5        to the modConstans and now I have Variable not defined SpellIndex
> (Npc(EditorIndex).Spell(SpellIndex) = scrlSpell.Value)
> Any help?

In the frmEditor_NPC I included, there is "Private SpellIndex As Long" at the top right under "Option Explicit"

Make sure it is still there, if not, add it in.
Link to comment
Share on other sites

  • 2 weeks later...
Okay first time trying to add something to the engine and a bit stuck, im using the latest eclipse from the download section 2.0

On trying to compile the client i get variable not defined and it points to this line
Spell(1 To MAX_NPC_SPELLS) As Long

On trying to compile the server i get this..

Method or data member not found
And it points to
If Options.Debug = 1 Then On Error GoTo errorhandler

Anyone can help ?

Thanks
Link to comment
Share on other sites

@Dryath:

> Okay first time trying to add something to the engine and a bit stuck, im using the latest eclipse from the download section 2.0
>
> On trying to compile the client i get variable not defined and it points to this line
> Spell(1 To MAX_NPC_SPELLS) As Long
>
> On trying to compile the server i get this..
>
> Method or data member not found
> And it points to
> If Options.Debug = 1 Then On Error GoTo errorhandler
>
> Anyone can help ?
>
> Thanks

Add this to your modConstants in your client
```
' NPC Spells
Public Const MAX_NPC_SPELLS As Long = 5
```
For the second issue, why is options.debug doing on the server in the first place? Delete it.
Link to comment
Share on other sites

  • 2 weeks later...
Alright installed it and everything works perfectly :]

Only things im a bit iffy on are

1\. NPC can Meele 1 player in a party = Good, but if theres more then 2 in a party.
Example: 1 is being meeled, 2 is being attacked with spells, 3 does not get attacked by spells at all, even with an AOE spell and being in the same party as player 1 & 2.

Any way to make it attack all 4 people in a party with AOE spells? :]
If so can this be added in a tut? :D

2\. Having more than 1 spell on an NPC seems a little pointless, i mean they cast at the same time.

Is there a way that i can have a random spell cast on the player such as a Fire spell is cast, then randomly a DOT is cast on the player instead of the fire spell, etc…?
If so can this be added in a tut :D

Thanks for the reply in advanced :]
Link to comment
Share on other sites

  • 2 weeks later...
Follow the original tutorial not the other post below it… The tutorial was updated may 2011, the code you posted was from 2010 that is not needed anymore... And yes Sub NpcAttackPlayer is in modcombat just search for what it says and make sure to copy the form work correctly
Link to comment
Share on other sites

I Inserted all… now it gives me no compile error...
but the NPC's doesnt cast the skills....
```
Else
                            ' lol no npc combat :(
                        End If
```Looks at my source
```
mapnum).Npc(x) > 0 And MapNpc(mapnum).Npc(x).Num > 0 Then
                    target = MapNpc(mapnum).Npc(x).target
                    targetType = MapNpc(mapnum).Npc(x).targetType

                    ' Check if the npc can attack the targeted player player
                    If target > 0 Then

                        If targetType = 1 Then ' player
                            ' Is the target playing and on the same map?
                            If IsPlaying(target) And GetPlayerMap(target) = mapnum Then
                                TryNpcAttackPlayer x, target
                            Else
                                ' Player left map or game, set target to 0
                                MapNpc(mapnum).Npc(x).target = 0
                                MapNpc(mapnum).Npc(x).targetType = 0 ' clear

                        ElseIf targetType = 2 Then
                            ' lol no npc combat :( DATS WAT YOU THINK

                            If Map(mapnum).Npc(x) > 0 And MapNpc(mapnum).Npc(x).Num > 0 Then
                            If Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET And Npc(MapNpc(mapnum).Npc(target).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            If CanNpcAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target) = True Then
                            Call PetAttackPet(mapnum, x, MapNpc(mapnum).Npc(x).target, Npc(Map(mapnum).Npc(x)).Damage)
                            End If
                            ElseIf Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            If CanNpcAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target) = True Then
                            Call PetAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target, Npc(Map(mapnum).Npc(x)).Damage)
                            End If
                            End If
                            End If

                            If Map(mapnum).Npc(target) > 0 And MapNpc(mapnum).Npc(target).Num > 0 Then
                            If Npc(MapNpc(mapnum).Npc(target).Num).Behaviour = NPC_BEHAVIOUR_PET And Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            MapNpc(mapnum).Npc(target).target = x
                            MapNpc(mapnum).Npc(target).targetType = TARGET_TYPE_NPC
                            If CanNpcAttackNpc(mapnum, target, MapNpc(mapnum).Npc(target).target) = True Then
                            Call PetAttackPet(mapnum, target, MapNpc(mapnum).Npc(target).target, Npc(Map(mapnum).Npc(target)).Damage)
                            End If
                            ElseIf Npc(MapNpc(mapnum).Npc(target).Num).Behaviour <> NPC_BEHAVIOUR_PET Then
                            MapNpc(mapnum).Npc(target).target = x
                            MapNpc(mapnum).Npc(target).targetType = TARGET_TYPE_NPC
                            If CanNpcAttackNpc(mapnum, target, MapNpc(mapnum).Npc(target).target) = True Then
                          Call NpcAttackPet(mapnum, target, MapNpc(mapnum).Npc(target).target, Npc(Map(mapnum).Npc(target)).Damage)
                          End If
                          End If
                          End If
                          End If
                          End If
                          Else

                      End If

```
Link to comment
Share on other sites

use this u forgot something

```
mapnum).Npc(x) > 0 And MapNpc(mapnum).Npc(x).Num > 0 Then
                    target = MapNpc(mapnum).Npc(x).target
                    targetType = MapNpc(mapnum).Npc(x).targetType

                    ' Check if the npc can attack the targeted player player
                    If target > 0 Then

                        If targetType = 1 Then ' player
                            ' Is the target playing and on the same map?
                            If IsPlaying(target) And GetPlayerMap(target) = mapnum Then
                                TryNpcAttackPlayer x, target
                            Else
                                ' Player left map or game, set target to 0
                                MapNpc(mapnum).Npc(x).target = 0
                                MapNpc(mapnum).Npc(x).targetType = 0 ' clear

                        ElseIf targetType = 2 Then
                            ' lol no npc combat :( DATS WAT YOU THINK

                            If Map(mapnum).Npc(x) > 0 And MapNpc(mapnum).Npc(x).Num > 0 Then
                            If Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET And Npc(MapNpc(mapnum).Npc(target).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            If CanNpcAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target) = True Then
                            Call PetAttackPet(mapnum, x, MapNpc(mapnum).Npc(x).target, Npc(Map(mapnum).Npc(x)).Damage)
                            End If
                            ElseIf Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            If CanNpcAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target) = True Then
                            Call PetAttackNpc(mapnum, x, MapNpc(mapnum).Npc(x).target, Npc(Map(mapnum).Npc(x)).Damage)
                            End If
                            End If
                            End If

                            If Map(mapnum).Npc(target) > 0 And MapNpc(mapnum).Npc(target).Num > 0 Then
                            If Npc(MapNpc(mapnum).Npc(target).Num).Behaviour = NPC_BEHAVIOUR_PET And Npc(MapNpc(mapnum).Npc(x).Num).Behaviour = NPC_BEHAVIOUR_PET Then
                            MapNpc(mapnum).Npc(target).target = x
                            MapNpc(mapnum).Npc(target).targetType = TARGET_TYPE_NPC
                            If CanNpcAttackNpc(mapnum, target, MapNpc(mapnum).Npc(target).target) = True Then
                            Call PetAttackPet(mapnum, target, MapNpc(mapnum).Npc(target).target, Npc(Map(mapnum).Npc(target)).Damage)
                            End If
                            ElseIf Npc(MapNpc(mapnum).Npc(target).Num).Behaviour <> NPC_BEHAVIOUR_PET Then
                            MapNpc(mapnum).Npc(target).target = x
                            MapNpc(mapnum).Npc(target).targetType = TARGET_TYPE_NPC
                            If CanNpcAttackNpc(mapnum, target, MapNpc(mapnum).Npc(target).target) = True Then
                          Call NpcAttackPet(mapnum, target, MapNpc(mapnum).Npc(target).target, Npc(Map(mapnum).Npc(target)).Damage)
                          End If
                          End If
                          End If
                          End If
                          End If
                          Else

                      End If
    ' Spell Casting
                                For i = 1 To MAX_NPC_SPELLS
                                    If NPC(npcNum).Spell(i) > 0 Then
                                        If MapNpc(mapNum).NPC(x).SpellTimer(i) +  (Spell(NPC(npcNum).Spell(i)).CastTime * 1000) < GetTickCount Then
                                            NpcSpellPlayer x, target, i
                                        End If
                                    End If
                                Next
                            End If

```Also what pet system is that? It looks not very good =/
Link to comment
Share on other sites

I've insertet it above
                        ElseIf targetType = 2 Then
                            ' lol no npc combat :( DATS WAT YOU THINK
When i insert it at the bottom i got an Error
RTE 9
Subscript out of range
The Pet system was theren when i downloaded it ;) but it works so its good haha

EDIT–--
If Npc(npcNum).Spell(i) > 0 Then      <---- This is hilighted

EDIT 2---
I Moved it again Up and now its working Thanks :D
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 1 month 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.
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
I've inserted the code, i don't get an error but i need to add the scrl… how i name them and which code i put in them?

p.s. i use eclipse origins 2.3

EDIT: Fixed getting code from other frmNpc_Editor ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
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...