tslusny Posted August 13, 2012 Author Share Posted August 13, 2012 Tutorial required: [Linear Spells (made by Draconix)](http://www.touchofdeathforums.com/smf2/index.php/topic,73750.0.html)SERVER SIDE:Replace **Sub FireProjectile** with this:```Public Sub FireProjectile(ByVal Index As Long, ByVal Dir As Long, ByVal Damage As Long, ByVal range As Long, Optional ByVal SpellNum As Long, Optional ByVal itemnum As Long)Dim i As LongDim r As LongDim MapNum As LongDim canShoot As BooleanDim DidCast As Boolean MapNum = GetPlayerMap(Index) If Damage = 0 Then Damage = GetPlayerDamage(Index) End If canShoot = False DidCast = False For r = 1 To range Select Case Dir Case DIR_UP If GetPlayerY(Index) - r < 0 Then Exit Sub If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) - r).Type = TILE_TYPE_BLOCKED Or Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) - r).Type = TILE_TYPE_RESOURCE Then If SpellNum > 0 Then SendAnimation MapNum, Spell(Player(Index).Spell(SpellNum)).SpellAnim, GetPlayerX(Index), GetPlayerY(Index) - r DidCast = True Else SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index), GetPlayerY(Index) - r Exit Sub End If End If Case DIR_DOWN If GetPlayerY(Index) + r > Map(MapNum).MaxY Then Exit Sub If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) + r).Type = TILE_TYPE_BLOCKED Or Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) + r).Type = TILE_TYPE_RESOURCE Then If SpellNum > 0 Then SendAnimation MapNum, Spell(Player(Index).Spell(SpellNum)).SpellAnim, GetPlayerX(Index), GetPlayerY(Index) + r DidCast = True Else SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index), GetPlayerY(Index) - r Exit Sub End If End If Case DIR_LEFT If GetPlayerX(Index) - r < 0 Then Exit Sub If Map(MapNum).Tile(GetPlayerX(Index) - r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Or Map(MapNum).Tile(GetPlayerX(Index) - r, GetPlayerY(Index)).Type = TILE_TYPE_RESOURCE Then If SpellNum > 0 Then SendAnimation MapNum, Spell(Player(Index).Spell(SpellNum)).SpellAnim, GetPlayerX(Index) - r, GetPlayerY(Index) DidCast = True Else SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index), GetPlayerY(Index) - r Exit Sub End If End If Case DIR_RIGHT If GetPlayerX(Index) + r > Map(MapNum).MaxX Then Exit Sub If Map(MapNum).Tile(GetPlayerX(Index) + r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Or Map(MapNum).Tile(GetPlayerX(Index) + r, GetPlayerY(Index)).Type = TILE_TYPE_RESOURCE Then If SpellNum > 0 Then SendAnimation MapNum, Spell(Player(Index).Spell(SpellNum)).SpellAnim, GetPlayerX(Index) + r, GetPlayerY(Index) DidCast = True Else SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index), GetPlayerY(Index) - r Exit Sub End If End If End Select If DidCast = True Then Call SetPlayerVital(Index, Vitals.MP, GetPlayerVital(Index, Vitals.MP) - Spell(Player(Index).Spell(SpellNum)).MPCost) Call SendVital(Index, Vitals.MP) TempPlayer(Index).SpellCD(Player(Index).Spell(SpellNum)) = GetTickCount + (Spell(Player(Index).Spell(SpellNum)).CDTime * 1000) Call SendCooldown(Index, SpellNum) SendActionMsg MapNum, Trim$(Spell(Player(Index).Spell(SpellNum)).Name) & "!", BrightRed, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32 Exit Sub End If For i = 1 To MAX_MAP_NPCS If CanPlayerAttackNpc(Index, i, True) Then If Dir = DIR_UP Then If GetPlayerX(Index) = MapNpc(MapNum).Npc(i).x And GetPlayerY(Index) - r = MapNpc(MapNum).Npc(i).y Then canShoot = True End If End If If Dir = DIR_DOWN Then If GetPlayerX(Index) = MapNpc(MapNum).Npc(i).x And GetPlayerY(Index) + r = MapNpc(MapNum).Npc(i).y Then canShoot = True End If End If If Dir = DIR_LEFT Then If GetPlayerX(Index) - r = MapNpc(MapNum).Npc(i).x And GetPlayerY(Index) = MapNpc(MapNum).Npc(i).y Then canShoot = True End If End If If Dir = DIR_RIGHT Then If GetPlayerX(Index) + r = MapNpc(MapNum).Npc(i).x And GetPlayerY(Index) = MapNpc(MapNum).Npc(i).y Then canShoot = True End If End If If canShoot = True Then If SpellNum > 0 Then CastSpell Index, SpellNum, i, TARGET_TYPE_NPC Exit Sub Else Call PlayerAttackNpc(Index, i, Damage) Exit Sub End If End If End If Next For i = 1 To Player_HighIndex If i <> Index Then If CanPlayerAttackPlayer(Index, i, True) Then If Dir = DIR_UP Then If GetPlayerX(Index) = GetPlayerX(i) And GetPlayerY(Index) - r = GetPlayerY(i) Then canShoot = True End If End If If Dir = DIR_DOWN Then If GetPlayerX(Index) = GetPlayerX(i) And GetPlayerY(Index) + r = GetPlayerY(i) Then canShoot = True End If End If If Dir = DIR_LEFT Then If GetPlayerX(Index) - r = GetPlayerX(i) And GetPlayerY(Index) = GetPlayerY(i) Then canShoot = True End If End If If Dir = DIR_RIGHT Then If GetPlayerX(Index) + r = GetPlayerX(i) And GetPlayerY(Index) = GetPlayerY(i) Then canShoot = True End If End If If canShoot = True Then If SpellNum > 0 Then CastSpell Index, SpellNum, i, TARGET_TYPE_PLAYER Exit Sub Else Call PlayerAttackPlayer(Index, i, Damage) Exit Sub End If End If End If End If Next NextEnd Sub``` Link to comment Share on other sites More sharing options...
Dawntide Posted August 13, 2012 Share Posted August 13, 2012 I tried it, but the animation still does not show up on npcs, only on blocks, any fix? Link to comment Share on other sites More sharing options...
erkro1 Posted August 13, 2012 Share Posted August 13, 2012 What does this exactly fix? Link to comment Share on other sites More sharing options...
tslusny Posted August 13, 2012 Author Share Posted August 13, 2012 I forgot :P I fixed it in Prospekt and ripped it to tutorial but i think i fixed some major problems like when you hit blocks it sends it to cooldown etc. And it showed wrong animation i fixed that too 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