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

<solved>Spells Issue</solved>


WiseRock
 Share

Recommended Posts

Hello, When I was making some spells this error popped-up

"Runtime Error '9'"

it highlights

```
CopyMemory ByVal VarPtr(Spell(spellnum)), ByVal VarPtr(SpellData(0)), SpellSize
```

from the Sub

```

Private Sub HandleUpdateSpell(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim spellnum As Long

Dim Buffer As clsBuffer

Dim SpellSize As Long

Dim SpellData() As Byte

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

spellnum = Buffer.ReadLong

SpellSize = LenB(Spell(spellnum))

ReDim SpellData(SpellSize - 1)

SpellData = Buffer.ReadBytes(SpellSize)

CopyMemory ByVal VarPtr(Spell(spellnum)), ByVal VarPtr(SpellData(0)), SpellSize

Set Buffer = Nothing

' Update the spells on the pic

Set Buffer = New clsBuffer

Buffer.WriteLong CSpells

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandleUpdateSpell", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

This started happening after I added

[Spell Scaling](http://www.touchofdeathforums.com/community/index.php?/topic/116465-eo-complex-spell-scaling-equation-server-only/)

[Spell Scaling for Warriors](http://www.touchofdeathforums.com/community/index.php?/topic/125131-eospell-scaling-for-warriors/)

and lastly

[This Bug Fix for Spells](http://www.touchofdeathforums.com/community/index.php?/topic/131259-having-more-than-23-spells-flood-server-bug-fix/)
Link to comment
Share on other sites

> make sure SpellRec in modTypes is exactly the same in server and client

Thanks now it works

> I'm going to go ahead and make an educated guess and say that your 'spellnum' is larger than the range of the array.

Thanks for Trying! Appreciate it!

This is now Locked
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...