Abyss Posted June 7, 2015 Author Share Posted June 7, 2015 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 More sharing options...
Irij47 Posted June 7, 2015 Share Posted June 7, 2015 That's because looking at your code, there is nothing telling it to reduce your mana or cooldown. Where the code is to attack the player/npc with the spell, remove mana and/or set the cooldown timer. Link to comment Share on other sites More sharing options...
Abyss Posted June 7, 2015 Author Share Posted June 7, 2015 Yeah I got that. But I have no idea how to do it! Does someone know? It's driving me nuts! 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