Print Page | Close Window

Forget Spell Command

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=192
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Forget Spell Command
Posted By: Sync
Subject: Forget Spell Command
Date Posted: 11 February 2006 at 3:25pm
Difficulty: Easy 1/5

Originaly Posted By: Sonire

In the server, open modServerTCP.bas.
In the HandleData() sub, find this code:

' :::::::::::::::::
' :: Cast packet ::
' :::::::::::::::::
If LCase(Parse(0)) = "cast" Then
    ' Spell slot
    n = Val(Parse(1))

    Call CastSpell(Index, n)

    Exit Sub
End If


and underneath it add:

' :::::::::::::::::::::::::
' :: Forget spell packet ::
' :::::::::::::::::::::::::
If LCase(Parse(0)) = "forgetspell" Then
    ' Spell slot
    n = CLng(Parse(1))

    ' Prevent subscript out of range
    If n <= 0 Or n > MAX_PLAYER_SPELLS Then
        HackingAttempt Index, "Invalid Spell Slot"
        Exit Sub
    End If

    With Player(Index).Char(Player(Index).CharNum)
        If .Spell(n) = 0 Then
             PlayerMsg Index, "No spell here.", Red
        Else
             PlayerMsg Index, "You have forgotten the spell """ & Trim$(Spell(.Spell(n)).Name) & """", Green
             .Spell(n) = 0
             SendSpells Index
        End If
    End With
    Exit Sub
End If


In the client, open frmMirage.
Add a label to picPlayerSpells, set it's name property to "lblForgetSpell", and set it's caption property to "Forget Spell".
Double-click it and add this code:

If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
    If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
        If MsgBox("Are you sure you want to forget the spell """ & Trim$(Spell(Player(MyIndex).Spell(lstSpells.ListIndex + 1)).Name) & """?", vbQuestion Or vbYesNo, ForgetSpell = vbNo) Then Exit Sub
             SendData "forgetspell" & SEP_CHAR & lstSpells.ListIndex + 1 & SEP_CHAR & END_CHAR
             picPlayerSpells.Visible = False
        End If
    Else
        AddText "No spell here.", BrightRed
End If


All done.

Now you can click on the Forget Spell label to forget spells you don't want anymore, yay.

[quote]Posted by EnigmaWave on Feb 6, 04 [quote]



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info