Print Page | Close Window

Equipment Bonuses

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=227
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Equipment Bonuses
Posted By: Sync
Subject: Equipment Bonuses
Date Posted: 11 February 2006 at 3:41pm
This is a tutorial to add equipment bonuses, but it only works if you have the Visual Inventory already added.

Since I made this entire tutorial myself, and programmed this in, I take full credit.  :D

By the way, this is my first tutorial, sorry if I left a tiny thing out.

Part 1:

:::::::::::::::::::::::::::::::::
:::::::: CLIENT SIDE ::::::::
:::::::::::::::::::::::::::::::::

Open up frmItemEditor

Add a frame called fraBonus, and inside fraBonus add:

Combo Box
Name : cmbBonus
Style : 2
List : None
        Strength
        Defence
        Speed
        Magic
        Movement Speed
ItemData: 0
                 0
                 0
                 0
                 0
                 0

Text Box
Name : txtAmm

Label
Name : Label9
Caption : Bonus Amount

Double click on cmbType, and replace :

    If (cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        fraEquipment.Visible = True
    Else
        fraEquipment.Visible = False
    End If

with:

    If (cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        fraEquipment.Visible = True
        fraBonus.Visible = True
    Else
        fraEquipment.Visible = False
        fraBonus.Visible = False
    End If

Then, add this to the bottom of the frmItemEditor code:

Private Sub cmbBonus_Click()
    If cmbBonus.ListIndex = 5 Then
        Label9.Visible = False
        txtAmm.Visible = False
        txtAmm.Text = "0"
    Else
        Label9.Visible = True
        txtAmm.Visible = True
    End If
End Sub


Next, open frmMirage. In frmMirage, add a picture box called picLiveStats, and inside, make 8 labels, named lblLEVEL, lblTNL, lblSTR, lblDEF, lblSPEED, lblMAGIC, lblCHIT, and lblCBLOCK.

Inside the code for frmMirage, add this to the bottom, and change "picStats" to whatever your stats button is:  

Private Sub picStats_Click()
    Call SendData("getstats" & SEP_CHAR & END_CHAR)
    If picLiveStats.Visible = False Then
        picLiveStats.Visible = True
    Else
        picLiveStats.Visible = False
    End If
End Sub

 
Next, open modClientTCP.

Search for Update Item Packet.

Under

Item(n).Data4 = 0

Add:

Item(n).Data5 = Val(Parse(5))
Item(n).Data6 = Val(Parse(6))


Search for Edit Item Packet.

If there is a line that says:

Item(n).Data4 = Val(Parse(8))

Under it add:

Item(n).Data5 = Val(Parse(9))
Item(n).Data6 = Val(Parse(10))

If there is not, then find

Item(n).Data3 = Val(Parse(7))

Under it add:

Item(n).Data5 = Val(Parse(8))
Item(n).Data6 = Val(Parse(9))


Then find Sub SendSaveItem.

If it says:

Packet = "SAVEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & END_CHAR

Replace it with:

Packet = "SAVEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & Item(ItemNum).Data5 & SEP_CHAR & Item(ItemNum).Data6 & SEP_CHAR & END_CHAR


If it says:

Packet = "SAVEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & Item(ItemNum).Data4 & SEP_CHAR & END_CHAR

Replace it with:

Packet = "SAVEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & Item(ItemNum).Data4 & SEP_CHAR & Item(ItemNum).Data5 & SEP_CHAR & Item(ItemNum).Data6 & SEP_CHAR & END_CHAR


Next, find Sub HandleData.

At the very bottom, before "End Sub", add:

    ' :::::::::::::::::::::::
    ' :: Real Stats Packet ::
    ' :::::::::::::::::::::::
    If (LCase(Parse(0)) = "picrstats") Then
        frmMirage.lblLEVEL.Caption = Val(Parse(1))
        frmMirage.lblTNL.Caption = Val(Parse(2))
        frmMirage.lblSTR.Caption = Parse(3)
        frmMirage.lblDEF.Caption = Parse(4)
        frmMirage.lblMAGIC.Caption = Parse(5)
        frmMirage.lblSPEED.Caption = Parse(6)
        frmMirage.lblCHIT.Caption = Val(Parse(7)) & "%"
        frmMirage.lblCBLOCK.Caption = Val(Parse(8)) & "%"
    End If


Next, open modGameLogic.

Find Public Sub ItemEditorInit.

Replace:

    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        frmItemEditor.fraEquipment.Visible = True
        frmItemEditor.scrlDurability.Value = Item(EditorIndex).Data1
        frmItemEditor.scrlStrength.Value = Item(EditorIndex).Data2
    Else
        frmItemEditor.fraEquipment.Visible = False
    End If

With:

If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        frmItemEditor.fraEquipment.Visible = True
        frmItemEditor.scrlDurability.Value = Item(EditorIndex).Data1
        frmItemEditor.scrlStrength.Value = Item(EditorIndex).Data2
        frmItemEditor.fraBonus.Visible = True
        frmItemEditor.cmbBonus.ListIndex = Item(EditorIndex).Data5
        frmItemEditor.txtAmm.Text = Item(EditorIndex).Data6
    Else
        frmItemEditor.fraEquipment.Visible = False
        frmItemEditor.fraBonus.Visible = False
    End If


Find Public Sub ItemEditorOk.

If you don't have a Data 4 replace:

    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlDurability.Value
        Item(EditorIndex).Data2 = frmItemEditor.scrlStrength.Value
        Item(EditorIndex).Data3 = 0
    End If
   
    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlVitalMod.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
    End If
   
    If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlSpell.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
    End If

With:

    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlDurability.Value
        Item(EditorIndex).Data2 = frmItemEditor.scrlStrength.Value
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data5 = Val(frmItemEditor.cmbBonus.ListIndex)
        Item(EditorIndex).Data6 = Val(frmItemEditor.txtAmm.Text)
    End If
   
    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlVitalMod.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data5 = 0
        Item(EditorIndex).Data6 = 0
    End If
   
    If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlSpell.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data5 = 0
        Item(EditorIndex).Data6 = 0
    End If


If you do have a Data4 then replace:

If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlDurability.Value
        Item(EditorIndex).Data2 = frmItemEditor.scrlStrength.Value
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = frmItemEditor.chkDUR.Value
    End If
   
    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlVitalMod.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = 0
    End If
   
    If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlSpell.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = 0
    End If

With:

If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlDurability.Value
        Item(EditorIndex).Data2 = frmItemEditor.scrlStrength.Value
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = frmItemEditor.chkDUR.Value
        Item(EditorIndex).Data5 = Val(frmItemEditor.cmbBonus.ListIndex)
        Item(EditorIndex).Data6 = Val(frmItemEditor.txtAmm.Text)
    End If
   
    If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlVitalMod.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = 0
        Item(EditorIndex).Data5 = 0
        Item(EditorIndex).Data6 = 0
    End If
   
    If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then
        Item(EditorIndex).Data1 = frmItemEditor.scrlSpell.Value
        Item(EditorIndex).Data2 = 0
        Item(EditorIndex).Data3 = 0
        Item(EditorIndex).Data4 = 0
        Item(EditorIndex).Data5 = 0
        Item(EditorIndex).Data6 = 0
    End If


End of Part 1, wait for part 2.



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