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

Problem with Linear Spells in Skywyre


Abyss
 Share

Recommended Posts

Hello guys! I have added Linear spells in Skywyre Primitive but the cooldown timer doesn't work with it and it doesn't take mana. 

I have this in Modcombat at the bottom:

```
Sub InUseLinear(ByVal index As Integer, ByVal SpellNum As Long)
       Dim i As Integer
       Dim Calculate As Long
       Dim Mapa As Long
       Mapa = GetPlayerMap(index)

       i = 1
       Do While i < Spell(SpellNum).AoE

           Select Case GetPlayerDir(index)

               Case DIR_UP
                   Calculate = GetPlayerY(index) - i
                   If Calculate <= 0 Then Exit Sub
                   If Map(Mapa).Tile(GetPlayerX(index), GetPlayerY(index) - i).Type = TILE_TYPE_BLOCKED Then Exit Sub
                   IsUseLinear index, SpellNum, Mapa, GetPlayerX(index), GetPlayerY(index) - i

               Case DIR_DOWN
                   Calculate = GetPlayerY(index) + i
                   If Calculate >= Map(i).MaxY Then Exit Sub
                   If Map(Mapa).Tile(GetPlayerX(index), GetPlayerY(index) + i).Type = TILE_TYPE_BLOCKED Then Exit Sub
                   IsUseLinear index, SpellNum, Mapa, GetPlayerX(index), GetPlayerY(index) + i

               Case DIR_LEFT
                   Calculate = GetPlayerX(index) - i
                   If Calculate <= 0 Then Exit Sub
                   If Map(Mapa).Tile(GetPlayerX(index) - i, GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then Exit Sub
                   IsUseLinear index, SpellNum, Mapa, GetPlayerX(index) - i, GetPlayerY(index)

               Case DIR_RIGHT
                   Calculate = GetPlayerX(index) + i
                   If Calculate <= 0 Then Exit Sub
                   If Map(Mapa).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then Exit Sub
                   IsUseLinear index, SpellNum, Mapa, GetPlayerX(index) + i, GetPlayerY(index)
           End Select
           i = i + 1
       Loop
   End Sub

   Function IsUseLinear(ByVal index As Integer, ByVal SpellNum As Integer, ByVal Mapa As Integer, ByVal x As Byte, ByVal y As Byte)
       Dim i As Long

       Select Case GetPlayerDir(index)

           Case DIR_UP
               SendAnimation Mapa, Spell(SpellNum).SpellAnim, x, y
           Case DIR_RIGHT
               SendAnimation Mapa, Spell(SpellNum).SpellAnimRight, x, y
           Case DIR_DOWN
               SendAnimation Mapa, Spell(SpellNum).SpellAnimDown, x, y
           Case DIR_LEFT
               SendAnimation Mapa, Spell(SpellNum).SpellAnimLeft, x, y
       End Select

       'Loop Global Npc
       For i = 1 To MAX_MAP_NPCS
           If MapNpc(Mapa).NPC(i).num > 0 And MapNpc(Mapa).NPC(i).x = x And MapNpc(Mapa).NPC(i).y = y And MapNpc(Mapa).NPC(i).Vital(HP) > 0 Then PlayerAttackNpc index, i, Spell(SpellNum).Vital, SpellNum
       Next

       'Loop Global Player
       For i = 1 To Player_HighIndex
           If GetPlayerMap(i) = Mapa And GetPlayerX(i) = x And GetPlayerY(i) = y Then PlayerAttackPlayer index, i, Spell(SpellNum).Vital, SpellNum
       Next
   End Function

```

And in Bufferspell I have this:

```
       With Spell(SpellNum)
           If .Type = SPELL_TYPE_LINEAR Then
               InUseLinear index, SpellNum
               Exit Sub
           End If
   End With

```

Under this:

```
   ' make sure the classreq > 0
   If ClassReq > 0 Then ' 0 = no req
       If ClassReq <> GetPlayerClass(index) Then
           Call PlayerMsg(index, "Only " & CheckGrammar(Trim$(Class(ClassReq).Name)) & " can use this spell.", BrightRed)
           Exit Sub
       End If
   End If
```

Can you guys tell me in the right direction? I'm pretty much lost! Thanks!
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...