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

Pet System


Sheker
 Share

Recommended Posts

Implementing Lightning's Pet System on CS:DE, and everything works but one line.
```
                ' /////////////////////////////////////////////
                ' // This is used for npcs to attack targets //
                ' /////////////////////////////////////////////
                ' Make sure theres a npc with the map
                If Map(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
                                ' melee combat
                                TryNpcAttackPlayer x, target
                        ElseIf targetType = 2 Then
                            ' lol no npc combat :( DATS WAT YOU THINK
                            If CanNpcAttackNpc(mapNum, x, MapNpc(mapNum).Npc(x).target) = True Then
                                Call NpcAttackNpc(mapNum, x, MapNpc(mapNum).Npc(x).target, Npc(Map(mapNum).Npc(x)).Damage)
                            End If
                        Else
                        ' Player left map or game, set target to 0
                                MapNpc(mapNum).Npc(x).target = 0
                                MapNpc(mapNum).Npc(x).targetType = 0 ' clear
                        End If
                    End If
                End If

                    ' check for spells
                    If MapNpc(mapNum).Npc(x).spellBuffer.Spell = 0 Then
                        ' loop through and try and cast our spells
                        For i = 1 To MAX_NPC_SPELLS
                            If Npc(npcNum).Spell(i) > 0 Then
                                NpcBufferSpell mapNum, x, i
                            End If
                        Next
                    Else
                        ' check the timer
                        If MapNpc(mapNum).Npc(x).spellBuffer.Timer + (Spell(Npc(npcNum).Spell(MapNpc(mapNum).Npc(x).spellBuffer.Spell)).CastTime * 1000) < GetTickCount Then
                            ' cast the spell
                            NpcCastSpell mapNum, x, MapNpc(mapNum).Npc(x).spellBuffer.Spell, MapNpc(mapNum).Npc(x).spellBuffer.target, MapNpc(mapNum).Npc(x).spellBuffer.tType
                            ' clear the buffer
                            MapNpc(mapNum).Npc(x).spellBuffer.Spell = 0
                            MapNpc(mapNum).Npc(x).spellBuffer.target = 0
                            MapNpc(mapNum).Npc(x).spellBuffer.Timer = 0
                            MapNpc(mapNum).Npc(x).spellBuffer.tType = 0
                        End If
                    End If
                End If
```"Call NpcAttackNpc" is highlighted in "Call NpcAttackNpc(mapNum, x, MapNpc(mapNum).Npc(x).target, Npc(Map(mapNum).Npc(x)).Damage)", and I tried to comment it out and it compiled properly. Does anybody know what's wrong?
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...