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

[EA 3.0.13+] Event System TakeItem


Ertzel
 Share

Recommended Posts

In any version of EA above 3.0.13 that uses Deathbeam's edited event system. The TakeItem does not check if the user actually has the correct amount of the item.

It allows you to set an amount, but the code just takes away all of the item even if its a stackable item that you have more of then the event wants.

The following is a quick bugfix so it will only take the correct amount of the item, and warn you if you don't have enough.

Server-Side

Find```
Public Sub TakePlayerItems(ByVal Index As Long, ByVal itemID As Long, ByVal itemCount As Long)
```

and replace the whole sub with:```
Public Sub TakePlayerItems(ByVal Index As Long, ByVal itemID As Long, ByVal itemCount As Long)

If HasItem(Index, itemID) >= itemCount Then

TakeInvItem Index, itemID, itemCount

Else

PlayerMsg Index, "You need [" & itemCount & "] of [" & Trim$(Item(itemID).name) & "]", AlertColor

End If

End Sub
```

Find:```
Case Evt_Branch
```then replace:```
If HasItem(Index, .Data(2)) Then
```
With:```
If HasItem(Index, .Data(2)) >= .Data(5) Then
```

Save/Compile your server because this part is done.

- Client Side -

in frmEditor_Events go to the fraBranch and beside cmbBranchItem add a new text box called txtBranchItemAmount with the text of 0.

Now double click the txtBranchItemAmount and replace the sub with:```
Private Sub txtBranchItemAmount_Change()

If EditorIndex = 0 Or ListIndex = 0 Then Exit Sub

Events(EditorIndex).SubEvents(ListIndex).data(5) = Val(txtBranchItemAmount.Text)

End Sub
```

Find:```
cmbBranchItem.Enabled = False
```and under it add:```
txtBranchItemAmount.Enabled = False
```

Then under:```
cmbBranchItem.Enabled = True
```add:```
txtBranchItemAmount.Enabled = True
```

Find```
cmbBranchItem.ListIndex = .data(2) - 1
```under it add:```
txtBranchItemAmount.Text = .data(5)
```

Then save/compile your source and its done!
Link to comment
Share on other sites

  • 4 weeks later...

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...