01-06-2006, 10:19 PM
Author: grimsk8ter11
Difficulty: 1/5
:: CLIENT SIDE ::
In frmMirage, under "Options Explicit", add:
Add
anywhere)
Find "Private Sub Form_KeyUp" and replace it all with:
When a player double clicks the spell he/she wants to memorize it will save it to SpellMemorized, and when they hit F1 it will cast the spell. (Only if an NPC is targeted.)
If you want it so when the player holds down the F1 key to cast the memorized spell then replace "Private Sub Form_KeyDown" with:
(Optional) Right Click To Cast Spell
In the frmMirage code find "Private Sub picScreen_MouseDown" replace it all with:Now you must target the enemy first by using the left click button, and right click will cast the memorized spell.
Difficulty: 1/5
:: CLIENT SIDE ::
In frmMirage, under "Options Explicit", add:
Code:
Dim SpellMemorized As Long
Add

Code:
Private Sub lstSpells_DblClick()
If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
SpellMemorized = lstSpells.ListIndex + 1
Call AddText("Successfully memorized spell!", White)
Else
Call AddText("No spell here to memorize.", BrightRed)
End If
End Sub
Find "Private Sub Form_KeyUp" and replace it all with:
Code:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
If SpellMemorized > 0 Then
If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
If Player(MyIndex).Moving = 0 Then
Call SendData("cast" & SEP_CHAR & SpellMemorized & SEP_CHAR & END_CHAR)
Player(MyIndex).Attacking = 1
Player(MyIndex).AttackTimer = GetTickCount
Player(MyIndex).CastedSpell = YES
Else
Call AddText("Cannot cast while walking!", BrightRed)
End If
End If
Else
Call AddText("No spell here memorized.", BrightRed)
End If
Else
Call CheckInput(0, KeyCode, Shift)
End If
End Sub
When a player double clicks the spell he/she wants to memorize it will save it to SpellMemorized, and when they hit F1 it will cast the spell. (Only if an NPC is targeted.)
If you want it so when the player holds down the F1 key to cast the memorized spell then replace "Private Sub Form_KeyDown" with:
Code:
Private Sub picScreen_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim i As Long
Call EditorMouseDown(Button, Shift, x, y)
If Button = 1 And InEditor = False Then
Call PlayerSearch(Button, Shift, x, y)
End If
For i = 1 To MAX_MAP_NPCS
If MapNpc(i).y = Int(y / PIC_Y) And MapNpc(i).x = Int(x / PIC_X) Then
If InEditor = False And Button = 2 Then
If SpellMemorized > 0 Then
If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
If Player(MyIndex).Moving = 0 Then
Call SendData("cast" & SEP_CHAR & SpellMemorized & SEP_CHAR & END_CHAR)
Player(MyIndex).Attacking = 1
Player(MyIndex).AttackTimer = GetTickCount
Player(MyIndex).CastedSpell = YES
Else
Call AddText("Cannot cast while walking!", BrightRed)
End If
End If
Else
Call AddText("No spell memorized.", BrightRed)
End If
End If
End If
Next i
End Sub
(Optional) Right Click To Cast Spell
In the frmMirage code find "Private Sub picScreen_MouseDown" replace it all with:
Code:
Private Sub picScreen_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Call EditorMouseDown(Button, Shift, x, y)
If Button = 1 And InEditor = False Then
Call PlayerSearch(Button, Shift, x, y)
End If
If InEditor = False And Button = 2 Then
If SpellMemorized > 0 Then
If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
If Player(MyIndex).Moving = 0 Then
Call SendData("cast" & SEP_CHAR & SpellMemorized & SEP_CHAR & END_CHAR)
Player(MyIndex).Attacking = 1
Player(MyIndex).AttackTimer = GetTickCount
Player(MyIndex).CastedSpell = YES
Else
Call AddText("Cannot cast while walking!", BrightRed)
End If
End If
Else
Call AddText("No spell memorized.", BrightRed)
End If
End If
End Sub