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

Linear Spells (EO V2.0)


Octohunter
 Share

Recommended Posts

So, as the title says, this is a tutorial on making Linear Spells. 
[![](http://www.freemmorpgmaker.com/files/imagehost/pics/2f5ed374ae88c9b7d7abd5ec72df0905.png)](http://www.freemmorpgmaker.com/files/imagehost/#2f5ed374ae88c9b7d7abd5ec72df0905.png)
Special thanks to Captain Wabbit, whose Projectile System gave me the theory I needed to fix my old projectile system and make this. 

First, open modTypes.  In
```
Private Type SpellRec
``` 
before
```
End Type
```insert
```
IsLinear As Boolean
```
Open up Sub Serverloop in modServerLoop. 
After this code```
If GetTickCount > TempPlayer(i).spellBuffer.Timer + (Spell(Player(i).Spell(TempPlayer(i).spellBuffer.Spell)).CastTime * 1000) Then
```Place this.```
If Spell(Player(i).Spell(TempPlayer(i).spellBuffer.Spell)).IsLinear = False Then
```After this code```
                            If Spell(Player(i).Spell(TempPlayer(i).spellBuffer.Spell)).IsLinear = False Then
                                CastSpell i, TempPlayer(i).spellBuffer.Spell, TempPlayer(i).spellBuffer.target, TempPlayer(i).spellBuffer.tType
                                TempPlayer(i).spellBuffer.Spell = 0
                                TempPlayer(i).spellBuffer.Timer = 0
                                TempPlayer(i).spellBuffer.target = 0
                                TempPlayer(i).spellBuffer.tType = 0
```Place this.```
                            Else
                                Call FireProjectile(i, GetPlayerDir(i), Spell(Player(i).Spell(TempPlayer(i).spellBuffer.Spell)).Vital, Spell(Player(i).Spell(TempPlayer(i).spellBuffer.Spell)).Range, TempPlayer(i).spellBuffer.Spell)
                                TempPlayer(i).spellBuffer.Spell = 0
                                TempPlayer(i).spellBuffer.Timer = 0
                                TempPlayer(i).spellBuffer.target = 0
                                TempPlayer(i).spellBuffer.tType = 0
                            End If
```
Then, open modCombat.  Search for
```
Select Case SpellCastType
```Now, paste this code above it```
If Spell(spellnum).IsLinear = False Then
```And paste this code below the corresponding "End Select", right before "If HasBuffered Then".
```
Else
    HasBuffered = True
End If
```
Next, scroll down to the bottom of modCombat and paste this.
```
Public Sub FireProjectile(ByVal Index As Long, ByVal Dir As Long, ByVal Damage As Long, ByVal Range As Long, ByVal spellnum As Long)
Dim i As Long
Dim r As Long
Dim MapNum As Long
Dim canShoot As Boolean
Dim DidCast As Boolean

    MapNum = GetPlayerMap(Index)

    If Damage = 0 Then
        Damage = GetPlayerDamage(Index)
    End If

    canShoot = False
    DidCast = False

For r = 1 To Range

    If Dir = DIR_UP Then
        If GetPlayerY(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) - r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_DOWN Then
        If GetPlayerY(Index) + r > Map(MapNum).MaxY Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) + r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_LEFT Then
        If GetPlayerX(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) - r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) - r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) - r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If
    If Dir = DIR_RIGHT Then
        If GetPlayerX(Index) + r > Map(MapNum).MaxX Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) + r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) + r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) + r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If

    If DidCast = True Then
        Call SetPlayerVital(Index, Vitals.MP, GetPlayerVital(Index, Vitals.MP) - Spell(spellnum).MPCost)
        Call SendVital(Index, Vitals.MP)
        ' send vitals to party if in one
        If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index

        TempPlayer(Index).SpellCD(spellnum) = GetTickCount + (Spell(spellnum).CDTime * 1000)
        Call SendCooldown(Index, spellnum)
        SendActionMsg MapNum, Trim$(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
Next

End Sub

```
CLIENT SIDE

First, make your way to modTypes.  In```
Private Type SpellRec
``` 
before
```
End Type
```insert
```
IsLinear As Boolean
```, just like we did in the server section.
Then, go to frmEditor_Spell.  Paste this code at the bottom. ```
Private Sub chkLinear_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If chkLinear.Value = 0 Then
        Spell(EditorIndex).IsLinear = False
    Else
        Spell(EditorIndex).IsLinear = True
    End If

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "chkLinear_Click", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```Now, open up the form and add a checkbox as shown in this picture.  Call it chkLinear.
[![](http://www.freemmorpgmaker.com/files/imagehost/pics/0c4a26f84add465bbd1b5607a2d77380.png)](http://www.freemmorpgmaker.com/files/imagehost/#0c4a26f84add465bbd1b5607a2d77380.png)
Finally, search```
        If Spell(EditorIndex).IsAoE Then
            .chkAOE.Value = 1
        Else
            .chkAOE.Value = 0
        End If
```in SpellEditorInit, and add under it
```
        If Spell(EditorIndex).IsLinear Then
            .chkLinear.Value = 1
        Else
            .chkLinear.Value = 0
        End If
```
And you're done.

I am aware that there are other, better ways to accomplish this, but the way I have outlined here gives you a nifty new sub, FireProjectile, that you can use. 
Please report any and all bugs, as well as give credit if you use this.
EDIT: Added in support for PVP combat.  Not tested, as I don't have someone else to test it with, but I think it should work.
EDIT2: Partially rewrote code.  Now supports AOEs, healing spells, mana damage, stuns, and DOTs. :D
Link to comment
Share on other sites

Alright, partially rewrote the tutorial.  If you followed the old version, simply replace your CastSpell sub with a vanilla EO CastSpell sub or remove anything related to IsLinear in that sub.  Then, only replace your FireProjectile sub with the new one and do the step involving Sub ServerLoop.

There's a good reason for the change, though; it adds support for AOEs, Mana Damage, and Healing! :D
Link to comment
Share on other sites

Spells are now affected by solid objects.  Now, if you attempt to cast a spell through a wall, the animation will play on the tile that the wall is on and nothing will happen.
Just replace your FireProjectile sub with the new one or add this code```
    If Dir = DIR_UP Then
        If Map(mapNum).Tile(GetPlayerX(index), GetPlayerY(index) - r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation mapNum, Spell(spellnum).SpellAnim, GetPlayerX(index), GetPlayerY(index) - r
            Else
                SendAnimation mapNum, Item(GetPlayerEquipment(index, Weapon)).animation, GetPlayerX(index), GetPlayerY(index) - r
            End If
            Exit Sub
        End If
    End If
    If Dir = DIR_DOWN Then
        If Map(mapNum).Tile(GetPlayerX(index), GetPlayerY(index) + r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation mapNum, Spell(spellnum).SpellAnim, GetPlayerX(index), GetPlayerY(index) + r
            Else
                SendAnimation mapNum, Item(GetPlayerEquipment(index, Weapon)).animation, GetPlayerX(index), GetPlayerY(index) + r
            End If
            Exit Sub
        End If
    End If
    If Dir = DIR_LEFT Then
        If Map(mapNum).Tile(GetPlayerX(index) - r, GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation mapNum, Spell(spellnum).SpellAnim, GetPlayerX(index) - r, GetPlayerY(index)
            Else
                SendAnimation mapNum, Item(GetPlayerEquipment(index, Weapon)).animation, GetPlayerX(index) - r, GetPlayerY(index)
            End If
            Exit Sub
        End If
    End If
    If Dir = DIR_RIGHT Then
        If Map(mapNum).Tile(GetPlayerX(index) + r, GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation mapNum, Spell(spellnum).SpellAnim, GetPlayerX(index) + r, GetPlayerY(index)
            Else
                SendAnimation mapNum, Item(GetPlayerEquipment(index, Weapon)).animation, GetPlayerX(index) + r, GetPlayerY(index)
            End If
            Exit Sub
        End If
    End If
```under```
for r = 1 to Range
```
Link to comment
Share on other sites

Fixed a subscript out of range error when attempting to cast a spell beyond the boundaries of the map.  Just replace your FireProjectile sub with```
Public Sub FireProjectile(ByVal Index As Long, ByVal Dir As Long, ByVal Damage As Long, ByVal Range As Long, ByVal spellnum As Long)
Dim i As Long
Dim r As Long
Dim MapNum As Long
Dim canShoot As Boolean
Dim DidCast As Boolean

    MapNum = GetPlayerMap(Index)

    If Damage = 0 Then
        Damage = GetPlayerDamage(Index)
    End If

    canShoot = False
    DidCast = False

For r = 1 To Range

    If Dir = DIR_UP Then
        If GetPlayerY(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) - r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_DOWN Then
        If GetPlayerY(Index) + r > Map(MapNum).MaxY Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) + r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_LEFT Then
        If GetPlayerX(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) - r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) - r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) - r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If
    If Dir = DIR_RIGHT Then
        If GetPlayerX(Index) + r > Map(MapNum).MaxX Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) + r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) + r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) + r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If

    If DidCast = True Then
        Call SetPlayerVital(Index, Vitals.MP, GetPlayerVital(Index, Vitals.MP) - Spell(spellnum).MPCost)
        Call SendVital(Index, Vitals.MP)
        ' send vitals to party if in one
        If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index

        TempPlayer(Index).SpellCD(spellnum) = GetTickCount + (Spell(spellnum).CDTime * 1000)
        Call SendCooldown(Index, spellnum)
        SendActionMsg MapNum, Trim$(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
Next

End Sub

```
Link to comment
Share on other sites

@Jungle: All it is is the ability to "shoot" a spell in a straight line and draw the animation wherever it hits, be that a rock or a person.  There's no projectile drawn to screen because I don't know how.  If I post a screenshot, it would likely look like the default Origins spellcasting system except that there's no targeting reticule.
Link to comment
Share on other sites

Hmm. Seems like a cool idea but I don't really get the point of it if there is now projectile drawn on the screen. I guess maybe some really basic line of sight system is all this could really be used for. Either way nice tutorial and with some editing I could see this being pretty useful.
Link to comment
Share on other sites

@Zetasis: I'll delve into Captain Wabbit's code and see if I can modify this to work with his ranged system.  :)
@screenshot people:
[![](http://www.freemmorpgmaker.com/files/imagehost/pics/2f5ed374ae88c9b7d7abd5ec72df0905.png)](http://www.freemmorpgmaker.com/files/imagehost/#2f5ed374ae88c9b7d7abd5ec72df0905.png)

Edit: New FireProjectile sub up, fixed bug in which spellcasting into a wall didn't take away MP, set the cooldown, or draw the spell text; for those who don't want to scroll up, here
```
Public Sub FireProjectile(ByVal Index As Long, ByVal Dir As Long, ByVal Damage As Long, ByVal Range As Long, ByVal spellnum As Long)
Dim i As Long
Dim r As Long
Dim MapNum As Long
Dim canShoot As Boolean
Dim DidCast As Boolean

    MapNum = GetPlayerMap(Index)

    If Damage = 0 Then
        Damage = GetPlayerDamage(Index)
    End If

    canShoot = False
    DidCast = False

For r = 1 To Range

    If Dir = DIR_UP Then
        If GetPlayerY(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) - r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_DOWN Then
        If GetPlayerY(Index) + r > Map(MapNum).MaxY Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index), GetPlayerY(Index) + r).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, 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
    End If
    If Dir = DIR_LEFT Then
        If GetPlayerX(Index) - r < 0 Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) - r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) - r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) - r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If
    If Dir = DIR_RIGHT Then
        If GetPlayerX(Index) + r > Map(MapNum).MaxX Then
            Exit Sub
        End If
        If Map(MapNum).Tile(GetPlayerX(Index) + r, GetPlayerY(Index)).Type = TILE_TYPE_BLOCKED Then
            If spellnum > 0 Then
                SendAnimation MapNum, Spell(spellnum).SpellAnim, GetPlayerX(Index) + r, GetPlayerY(Index)
                DidCast = True
            Else
                SendAnimation MapNum, Item(GetPlayerEquipment(Index, Weapon)).Animation, GetPlayerX(Index) + r, GetPlayerY(Index)
                Exit Sub
            End If
        End If
    End If

    If DidCast = True Then
        Call SetPlayerVital(Index, Vitals.MP, GetPlayerVital(Index, Vitals.MP) - Spell(spellnum).MPCost)
        Call SendVital(Index, Vitals.MP)
        ' send vitals to party if in one
        If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index

        TempPlayer(Index).SpellCD(spellnum) = GetTickCount + (Spell(spellnum).CDTime * 1000)
        Call SendCooldown(Index, spellnum)
        SendActionMsg MapNum, Trim$(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
Next

End Sub
```
Link to comment
Share on other sites

@Jungle:

> I'm sorry, but I don't understand your last step. Where is SpellEditorInit and where do I have to search?

umm cant u just search (whole project) for 'If Spell(EditorIndex).IsAoE Then' then look for
                    .chkAOE.Value = 1
        Else
                  .chkAOE.Value = 0     
End If–-- then under it add the new piece of code
Link to comment
Share on other sites

its in modGameEditors look for  ' ////////////////// then go down alittle further and you'll see it at the
                                                  ' // Spell Editor //bottom of ' set values i still dont understand why u
                                                  ' ////////////////// cant search though  :confused:
Link to comment
Share on other sites

@Jungle:

> Thanks man! You were really helpful! If I could rep you I would.
>
> I dont understand why I cant search either. This is going to make Programming hell -_-

FYI you can open the search manually by first; opening any module (Or right clicking any form and click view code) Then open the tab "Edit" at the top of the window and scroll down to, Find.

Anyways, This looks like it may be what i was looking for, I'll have to try it out later. Thanks! :)
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

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...