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

[EO 2.0][Fixed] Multiple Item Drops and Percentile Chances


Scott
 Share

Recommended Posts

  • Replies 139
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
  • 3 weeks later...
  • 2 weeks later...
lol no problem man im just happy i saved a buncha my old backups ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

so im adding this tut for a friend anyway and i figure ill just write up all the form changes for you as i go along.

**Client Side**

frmeditor_npc

First add a scrollbar and call it ScrlDrop **Make sure you set the minimum value to 1!**

Double click ScrlDrop and paste```
DropIndex = scrlDrop.Value

fraDrop.Caption = "Drop - " & DropIndex

txtChance.text = NPC(EditorIndex).DropChance(DropIndex)

scrlNum.Value = NPC(EditorIndex).DropItem(DropIndex)

scrlValue.Value = NPC(EditorIndex).DropItemValue(DropIndex)
```
now double click Scrlnum and replace the sub with this

```
' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

lblNum.Caption = "Num: " & scrlNum.Value

If scrlNum.Value > 0 Then

lblItemName.Caption = "Item: " & Trim$(Item(scrlNum.Value).Name)

End If

NPC(EditorIndex).DropItem(DropIndex) = scrlNum.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlNum_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub
```
Double Click ScrlValue and replace the sub with this

```
' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

lblValue.Caption = "Value: " & scrlValue.Value

NPC(EditorIndex).DropItemValue(DropIndex) = scrlValue.Value

' Error handler

Exit Sub

errorhandler:

HandleError "scrlValue_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub
```
Replace the code in TxtChance with

```
On Error GoTo chanceErr

If Not IsNumeric(txtChance.text) And Not Right$(txtChance.text, 1) = "%" And Not InStr(1, txtChance.text, "/") > 0 And Not InStr(1, txtChance.text, ".") Then

txtChance.text = "0"

NPC(EditorIndex).DropChance(DropIndex) = 0

Exit Sub

End If

If Right$(txtChance.text, 1) = "%" Then

txtChance.text = Left(txtChance.text, Len(txtChance.text) - 1) / 100

ElseIf InStr(1, txtChance.text, "/") > 0 Then

Dim i() As String

i = Split(txtChance.text, "/")

txtChance.text = Int(i(0) / i(1) * 1000) / 1000

End If

If txtChance.text > 1 Or txtChance.text < 0 Then

'Err.Description = "Value must be between 0 and 1!"

'GoTo chanceErr

End If

NPC(EditorIndex).DropChance(DropIndex) = txtChance.text

Exit Sub

chanceErr:

MsgBox "Invalid entry for chance! " & Err.Description

txtChance.text = "0"

NPC(EditorIndex).DropChance(DropIndex) = 0
```

scroll to the very top just under option explicit and paste this

```
Private DropIndex As Byte
```
lastly go to Sub form load and paste this under Scrlanimation.max = MAX_ANIMATIONS

```
DropIndex = scrlDrop.Value

scrlDrop.Max = MAX_NPC_DROPS

scrlDrop.Min = 1

fraDrop.Caption = "Drop - " & DropIndex
```
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...
It seems like I get this error

When I ever mess with the scroll bars I it gives me A Runtime Error '9' Please Help

[http://imageshack.us…/captureep.png/](http://imageshack.us/photo/my-images/23/captureep.png/)

EDIT: nvm Got it Working ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
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...