Difficulty: Medium 3/5
Originaly Posted By: GodSentDeath
Wow... this took a whole 5 minutes :P
All Client Side
in the frmMirage code add:
Dim SpellMemorized As Long at the top under Options Explicit.
Add the following anywhere:
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 replace it all with:
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
Ok this should be basically it... When a player double clicks the spell he/she wants to memorize it will save it to SpellMemorized, and when they hit F1 and an npc is targeted it will cast the saved spell.
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:
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
Thats All!
[edit] Right Click To Cast Spell
In the frmMirage code find Private Sub picScreen_MouseDown replace it all with:
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
Now you must target the enemy first by using the left click button, and right click will cast the memorized spell
[edit2]I changed the Right Click Spell code because I noticed you can click anywhere to attack, now its just when you click them
|