Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

EO 3.0/2.0 Gift Item with multiple rewards


Guest
 Share

Recommended Posts

Hello this is my first Tutorial so go easy on me
You can make a Gift and when it's double clicked it will open and give you items.
You can make Probability between 0-100% (Chances to get the item)
And Multiple item Rewards
And items Amount
Sorry for my english i'm japanese  :sad:
Client Side

(search cmbType (Properties) and at List add "Gift" and at Item Data add another "0" )

Make a new Frame ,call it fraGifts

Add this things in this order to look better

On fraGifts add a label called "lblGiftNum"  with Caption : Gift Number:
Below add a HscrollBar called "scrlGiftNum"   
Double click it and add this code in
```
Private Sub scrlGiftNum_Change()
    GiftIndex = scrlGiftNum.Value
    lblGiftNum.Caption = "Gift: " & GiftIndex
    txtGiftChance.text = Item(EditorIndex).gchance(GiftIndex)
    scrlGift.Value = Item(EditorIndex).gift(GiftIndex)
    scrlGiftAmount.Value = Int(Item(EditorIndex).gvalue(GiftIndex))
End Sub
```
Make the 2nd label and call it "lblGift"  with Caption:  Item:
Bellow add a HscrollBar called "scrlGift"
Double click it and add this in
```
Private Sub scrlGift_Change()
    If scrlGift.Value > 0 Then
        lblGift.Caption = "Gift #" & scrlGiftNum & ": " & Trim$(Item(scrlGift.Value).name)
        Item(EditorIndex).gift(GiftIndex) = scrlGift.Value
    Else
        lblGift.Caption = "Gift #" & scrlGiftNum & ": None"
        Item(EditorIndex).gift(GiftIndex) = 0
    End If
End Sub
```

Make the 3rd label call it "lblGiftAmount" with Caption: Amount
Below add a HscrollBar called "scrlGiftAmount"
Double Click it and add this in
```
Private Sub scrlGiftAmount_Change()
    lblGiftAmount.Caption = "Amount: " & scrlGiftAmount
    Item(EditorIndex).gvalue(GiftIndex) = scrlGiftAmount
End Sub
```

Make a label with Caption: Change to get :
In the "Right" of it add a TextBox called "txtGiftChance"
Double click it and add in
```
Private Sub txtGiftChance_Change()
    If IsNumeric(txtGiftChance.text) Then
        Item(EditorIndex).gchance(GiftIndex) = Val(txtGiftChance.text)
    End If
End Sub
```

In the "Right" of that TextBox add a Label with Caption: out of 100

(and it will look like this  Chance to get ( a number,example 50 ) out of 100 )

Make a CheckBox called "chkGifts" with Caption : Multiple Rewards
Double click it and add in
```
Private Sub chkGifts_Click()
    If chkGifts.Value = 1 Then
        Item(EditorIndex).multigift = True
    Else
        Item(EditorIndex).multigift = False
    End If
End Sub
```
In the end it will look like this

>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/63bcdd93374f32bd45afe46f38b8d404.png)
In modConstants  under```
Public Const ITEM_TYPE_SPELL As Byte = 8
```
Add

```
Public Const ITEM_TYPE_GIFT As Byte = 9
```
Search in ItemEditorInit    Under```
frmEditor_Item.fraSpell.Visible = False
        End If
```
Add

```
If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_GIFT Then
            frmEditor_Item.fraGifts.Visible = True
            frmEditor_Item.scrlGiftNum.Value = 1
            If .multigift = True Then
                frmEditor_Item.chkGifts.Value = 1
            Else
                frmEditor_Item.chkGifts.Value = 0
            End If
        Else
            frmEditor_Item.fraSpell.Visible = False
        End If

```
On Declarations  Under   ```
instaCast As Byte
```
Add

```
gift(1 To 10) As Long
    gchance(1 To 10) As Byte
    gvalue(1 To 10) As Long
    multigift As Boolean

```
On Option Explicit    Under
```
Private LastIndex As Long
```
Add
```
Private GiftIndex As Long
```In Form_Load  Under
```
scrlPaperdoll.Max = NumPaperdolls
```Add
```
Add scrlGift.Max = MAX_ITEMS
```
Server Side

In modConstants  Add

```
Public Const ITEM_TYPE_GIFT As Byte = 9
```
On Declarations  Under   ```
instaCast As Byte
```
Add

```
gift(1 To 10) As Long
    gchance(1 To 10) As Byte
    gvalue(1 To 10) As Long
    multigift As Boolean

```
In UseItem modPlayer  we make a Case, better put this Above another case like Case ITEM_TYPE_SPELL

>! ```
Case ITEM_TYPE_GIFT

                ' stat requirements
                For i = 1 To Stats.Stat_Count - 1
                    If GetPlayerRawStat(index, i) < Item(itemnum).Stat_Req(i) Then
                        PlayerMsg index, "You do not meet the stat requirements to use this item.", BrightRed
                        Exit Sub
                    End If
                Next

                ' level requirement
                If GetPlayerLevel(index) < Item(itemnum).LevelReq Then
                    PlayerMsg index, "You do not meet the level requirement to use this item.", BrightRed
                    Exit Sub
                End If

                ' class requirement
                If Item(itemnum).ClassReq > 0 Then
                    If Not GetPlayerClass(index) = Item(itemnum).ClassReq Then
                        PlayerMsg index, "You do not meet the class requirement to use this item.", BrightRed
                        Exit Sub
                    End If
                End If

                ' access requirement
                If Not GetPlayerAccess(index) >= Item(itemnum).AccessReq Then
                    PlayerMsg index, "You do not meet the access requirement to use this item.", BrightRed
                    Exit Sub
                End If
                            TakeInvItem index, itemnum, 1
                            If Item(itemnum).multigift = True Then
                                For i = 1 To 10
                                    If Item(itemnum).gift(i) = 0 Then Exit For
                                    If Rnd * 100 <= Item(itemnum).gchance(i) Then
                                        If Item(itemnum).gift(i) > 0 Then
                                            If FindOpenInvSlot(index, Item(itemnum).gift(i)) = 0 Then
                                                Exit Sub
                                            End If
                                        End If
                                        GiveInvItem index, Item(itemnum).gift(i), Item(itemnum).gvalue(i)
                                    End If
                                Next
                            ElseIf Item(itemnum).multigift = False Then
                                For i = 1 To 10
                                    If Item(itemnum).gift(i) = 0 Then Exit For
                                    If Rnd * 100 <= Item(itemnum).gchance(i) Then
                                        If Item(itemnum).gift(i) > 0 Then
                                            If FindOpenInvSlot(index, Item(itemnum).gift(i)) = 0 Then
                                                Exit Sub
                                            End If
                                        End If
                                        GiveInvItem index, Item(itemnum).gift(i), Item(itemnum).gvalue(i)
                                        Exit For
                                    End If
                                Next
                            End If
>! ```

Here is a Copy of it wich have Gift System Included !
[http://www.mediafire.com/?v1ny43sm4whpeku](http://www.mediafire.com/?v1ny43sm4whpeku)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...