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

Linear Spell System


Wortel Angels
 Share

Recommended Posts

I posted [here](http://www.touchofdeathforums.com/community/index.php?/topic/131391-linear-spell/) an Linear spell system :-)

Now i made an tutorial for an friend how to do it and decided to share it with all

First add this :

[Linear](http://www.mmorpgbr.com/t11758-tutorialspell-linear-100-funcional)

Then **Client Side**

SpellEditor

![](http://www10.pic-upload.de/19.01.13/cnf8fhfvfq6k.png)

Search

```

Private Sub scrlAnim_Change()

```

And replace that sub with

```

Private Sub scrlAnim_Change()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If Not cmbType.text = "Linear" Then

If scrlAnim.Value > 0 Then

lblAnim.Caption = "Animation: " & Trim$(Animation(scrlAnim.Value).Name)

Else

lblAnim.Caption = "Animation: None"

End If

Else

If scrlAnim.Value > 0 Then

lblAnim.Caption = "Up Animation: " & Trim$(Animation(scrlAnim.Value).Name)

Else

lblAnim.Caption = "Up Animation: None"

End If

End If

Spell(EditorIndex).SpellAnim = scrlAnim.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlAnim_Change", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Then add at bottom

```

Private Sub scrlAnimDown_Change()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If scrlAnim.Value > 0 Then

lblAnimDown.Caption = "Down Animation: " & Trim$(Animation(scrlAnimDown.Value).Name)

Else

lblAnimDown.Caption = "Down Animation: None"

End If

Spell(EditorIndex).SpellAnimDown = scrlAnimDown.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlAnimDown_Change", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub scrlAnimLeft_Change()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If scrlAnimLeft.Value > 0 Then

lblAnimLeft.Caption = "Left Animation: " & Trim$(Animation(scrlAnimLeft.Value).Name)

Else

lblAnimLeft.Caption = "Animation: None"

End If

Spell(EditorIndex).SpellAnimLeft = scrlAnimLeft.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlAnimLeft_Change", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub scrlAnimRight_Change()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If scrlAnimRight.Value > 0 Then

lblAnimRight.Caption = "Right Animation: " & Trim$(Animation(scrlAnimRight.Value).Name)

Else

lblAnimRight.Caption = "Right Animation: None"

End If

Spell(EditorIndex).SpellAnimRight = scrlAnimRight.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlAnimRight_Change", "frmEditor_Spell", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Then at

```

Private Type SpellRec

```
add under

```

SpellAnim As Long

```
that

```

SpellAnimRight As Long

SpellAnimDown As Long

SpellAnimLeft As Long

```

**Server Side**

At

```

Private Type SpellRec

```
add under

```

SpellAnim As Long

```
that

```

SpellAnimRight As Long

SpellAnimDown As Long

SpellAnimLeft As Long

```

Now search

```

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

```

and replace it by

```

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

```

**Finish**

I hope i dont forgot something :-) but i think it should work

Credits

Blizzard

Me
Link to comment
Share on other sites

> That the spell is linear in 1 direction and drawed on every tile no target needed ;-)
>
> You can download at the first link an version with this included

So basically I can shoot fireballs from inside the city and hit mobs outside?

Will the spell stop on things like buildings?

The range of the spell shows how far my fireball can go?
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...