Print Page | Close Window

Equipment Bonus

Printed From: Mirage Source
Category: Tutorials
Forum Name: Submitted Tutorials
Forum Discription: Tutorial submissions for MSE are posted here, waiting for approval
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=32
Printed Date: 20 December 2006 at 6:02pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Equipment Bonus
Posted By: Sync
Subject: Equipment Bonus
Date Posted: 07 February 2006 at 5:33pm
Originally posted by acfrazier2

Equipment Bonuses

Code by GSD, Ripped from Elysium Milestone Edition.

Note: This tutorial only gives you the CLIENT SIDE!

->=<- Client Side ->=<-

modTypes

In Type ItemRec, add under Data3 As Integer:
AddHP As Long
    AddMP As Long
    AddSP As Long
    AddStr As Long
    AddDef As Long
    AddMagi As Long
    AddSpeed As Long
    AddEXP As Long


Add this somewhere in Sub HandleData in modClientTCP ONLY if you have a stats panel:
' :::::::::::::::::::::::::
    ' :: Player Stats Packet ::
    ' :::::::::::::::::::::::::
    If (LCase(Parse(0)) = "playerstatspacket") Then
        Dim SubStr As Long, SubDef As Long, SubMagi As Long, SubSpeed As Long
        SubStr = 0
        SubDef = 0
        SubMagi = 0
        SubSpeed = 0
        
        If GetPlayerWeaponSlot(MyIndex) > 0 Then
             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddStr
             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddDef
             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddMagi
             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerWeaponSlot(MyIndex))).AddSpeed
        End If
        If GetPlayerArmorSlot(MyIndex) > 0 Then
             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddStr
             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddDef
             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddMagi
             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerArmorSlot(MyIndex))).AddSpeed
        End If
        If GetPlayerShieldSlot(MyIndex) > 0 Then
             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddStr
             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddDef
             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddMagi
             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerShieldSlot(MyIndex))).AddSpeed
        End If
        If GetPlayerHelmetSlot(MyIndex) > 0 Then
             SubStr = SubStr + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddStr
             SubDef = SubDef + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddDef
             SubMagi = SubMagi + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddMagi
             SubSpeed = SubSpeed + Item(GetPlayerInvItemNum(MyIndex, GetPlayerHelmetSlot(MyIndex))).AddSpeed
        End If
       
        If SubStr > 0 Then
             frmMirage.lblSTR.Caption = Val(Parse(1)) - SubStr & " (+" & SubStr & ")"
        Else
             frmMirage.lblSTR.Caption = Val(Parse(1))
        End If
        If SubDef > 0 Then
             frmMirage.lblDEF.Caption = Val(Parse(2)) - SubDef & " (+" & SubDef & ")"
        Else
             frmMirage.lblDEF.Caption = Val(Parse(2))
        End If
        If SubMagi > 0 Then
             frmMirage.lblMAGI.Caption = Val(Parse(4)) - SubMagi & " (+" & SubMagi & ")"
        Else
             frmMirage.lblMAGI.Caption = Val(Parse(4))
        End If
        If SubSpeed > 0 Then
             frmMirage.lblSPEED.Caption = Val(Parse(3)) - SubSpeed & " (+" & SubSpeed & ")"
        Else
             frmMirage.lblSPEED.Caption = Val(Parse(3))
        End If
        frmMirage.lblEXP.Caption = Val(Parse(6))
        Debug.Print frmMirage.shpTNL.Width
        frmMirage.shpTNL.Width = (((Val(Parse(6)) / 100) / (Val(Parse(5)) / 100)) * 100)
        frmMirage.lblLevel.Caption = "" & Val(Parse(7))
       
        Exit Sub
    End If

Also, be sure to remove your old stats panel packet and update this one if needed.

In modGameLogic, Sub ItemEditorOK, find If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then
Then find Item(EditorIndex).Data3 = 0
Add underneath:
Item(EditorIndex).AddHP = frmItemEditor.scrlAddHP.Value
        Item(EditorIndex).AddMP = frmItemEditor.scrlAddMP.Value
        Item(EditorIndex).AddSP = frmItemEditor.scrlAddSP.Value
        Item(EditorIndex).AddStr = frmItemEditor.scrlAddStr.Value
        Item(EditorIndex).AddDef = frmItemEditor.scrlAddDef.Value
        Item(EditorIndex).AddMagi = frmItemEditor.scrlAddMagi.Value
        Item(EditorIndex).AddSpeed = frmItemEditor.scrlAddSpeed.Value
        Item(EditorIndex).AddEXP = frmItemEditor.scrlAddEXP.Value

Find Update item packet
Find Item(n).Data3 = Val(Parse(7))
Add underneath:
Item(n).AddHP = Val(Parse(8))
        Item(n).AddMP = Val(Parse(9))
        Item(n).AddSP = Val(Parse(10))
        Item(n).AddStr = Val(Parse(11))
        Item(n).AddDef = Val(Parse(12))
        Item(n).AddMagi = Val(Parse(13))
        Item(n).AddSpeed = Val(Parse(14))
        Item(n).AddEXP = Val(Parse(15))

Change the parses if needed.

Open frmItemEditor
Note: Resize the form and controls as you wish, I'm just telling you what to add.

Add the following controls:
Horizontal Scroll Bars(8):
Names:
scrlAddHP
scrlAddMP
scrlAddSP
scrlAddStr
scrlAddDef
scrlAddMagi
scrlAddSpeed
scrlAddEXP
Labels(16):
Names - Captions:
Label18 - Add HP:
lblAddHP - 0
Label19 - Add MP:
lblAddMP - 0
Label20 - Add SP:
lblAddSP - 0
Label21 - Add STR:
lblAddStr - 0
Label22 - Add DEF:
lblAddDef - 0
Label23 - Add Magi:
lblAddMagi - 0
Label24 - Add Speed:
lblAddSpeed - 0
Label25 - Add EXP:
lblAddEXP - 0%

This concludes my client side Equipment bonuses tutorial.
 



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 5:35pm
Removed unsupported tags. This shows client side but server side would be needed to complete the tutorial ... Anyone up to the challenge?



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