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

@Spiked:

> I can't confirm the always drop thing, but I've set an item at item slot 2 and it saved from the npc.

When you reopen the editor is that data still showing the same or different?

The drop item part is definately bugged.. The percentages dont work right
Link to comment
Share on other sites

  • Replies 139
  • Created
  • Last Reply

Top Posters In This Topic

I have not really tested this tutorial to hard I just ripped it from my game since people where posting about it.  If there is something wrong it must be something simple I left out because mine works fine and I have not edited it since I made this tutorial.
Link to comment
Share on other sites

@Scott:

> I have not really tested this tutorial to hard I just ripped it from my game since people where posting about it.  If there is something wrong it must be something simple I left out because mine works fine and I have not edited it since I made this tutorial.

Okay… Well, when you put the chance at lets say 1 out of 4 on a second item does that item spawn only 1 out of 4 times or everytime? You say there must not be anything wrong, and at the same time that you have not tested it fully. If you want to help try replicating the error instead of being no help at all, thanks.
Link to comment
Share on other sites

@Murdock:

> Okay… Well, when you put the chance at lets say 1 out of 4 on a second item does that item spawn only 1 out of 4 times or everytime? You say there must not be anything wrong, and at the same time that you have not tested it fully. If you want to help try replicating the error instead of being no help at all, thanks.

The editor saved the info even after I reclosed it and such. I have not tested the drop 100% bug yet. I can work on that now =]
Link to comment
Share on other sites

Use .25 for 25% thats how the orignal script was made to work its not a 1 out of 4 chance like it was before.  All I can say is when I tested I made 4 items 10%,25%,50%,100% and there drop rate was the same as there name and it seemed to work fine to me.
Link to comment
Share on other sites

@Scott:

> Use .25 for 25% thats how the orignal script was made to work its not a 1 out of 4 chance like it was before.  All I can say is when I tested I made 4 items 10%,25%,50%,100% and there drop rate was the same as there name and it seemed to work fine to me.

Okay, I didnt know that was the format. Ill test it out again. Thanks.
Link to comment
Share on other sites

I deleted all my previous npc and started with new ones
I have been testing the chance of droping
when the NPC is saved it keeps changes

now lets say:
Drop 1                                                  Drop 2
chance: 2                                            chance:10
item: Gold      num:1                            item: HP potion        num:2
value: 10                                              value:1

when the NPC is killed it drops everything everytime

another minor thing is that when you set the animation for the NPC and hit save, it saves the changes but the next time you open that NPC the animation is set to 0 BUT it does have the animation
Link to comment
Share on other sites

the animaton error is not related to this tut, and has been covered before i belive.
http://www.touchofdeathforums.com/smf/index.php/topic,74391.msg797956.html#msg797956
as for the drops.  your droping all the time because 2 = 100%  10 = 100%

.2 = 20%  .02 = 2% .002 = .2% ect.  they wont drop every time if you set it right.
Link to comment
Share on other sites

Noticed a small error. If more than one item is dropped, the character picks up the bottom items before the ones on top. I'm not sure if this is a rendering bug or what. Anyone else notice this?

Edit: I tested to see if after dropping items from the inventory it did the same thing, and it does. So I dont think its related to this mod..
Link to comment
Share on other sites

  • 3 weeks later...
Its says the Script is out of range
here's is my frmEDITOR_NPC:

```
Option Explicit
Private DropIndex As Byte

Private Sub cmbBehaviour_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    NPC(EditorIndex).Behaviour = cmbBehaviour.ListIndex

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmbBehaviour_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmdDelete_Click()
Dim tmpIndex As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ClearNPC EditorIndex

    tmpIndex = lstIndex.ListIndex
    lstIndex.RemoveItem EditorIndex - 1
    lstIndex.AddItem EditorIndex & ": " & NPC(EditorIndex).Name, EditorIndex - 1
    lstIndex.ListIndex = tmpIndex

    NpcEditorInit

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdDelete_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub Form_Load()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    DropIndex = scrlDrop.Value
    scrlDrop.Max = MAX_NPC_DROPS
    scrlDrop.Min = 1
    fraDrop.Caption = "Drop - " & DropIndex

    scrlSprite.Max = NumCharacters
    scrlAnimation.Max = MAX_ANIMATIONS
    'ALATAR
    scrlQuest.Max = MAX_QUESTS
    '/ALATAR

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "Form_Load", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmdSave_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Call NpcEditorOk

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdSave_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmdCancel_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Call NpcEditorCancel

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdCancel_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub lstIndex_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    NpcEditorInit

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "lstIndex_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub scrlAnimation_Change()
Dim sString As String
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If scrlAnimation.Value = 0 Then sString = "None" Else sString = Trim$(Animation(scrlAnimation.Value).Name)
    lblAnimation.Caption = "Anim: " & sString
    NPC(EditorIndex).Animation = scrlAnimation.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlAnimation_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub scrlSprite_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    lblSprite.Caption = "Sprite: " & scrlSprite.Value
    Call EditorNpc_BltSprite
    NPC(EditorIndex).Sprite = scrlSprite.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlSprite_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
Private Sub scrlDrop_Change()
    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)

End Sub

Private Sub scrlRange_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    lblRange.Caption = "Range: " & scrlRange.Value
    NPC(EditorIndex).Range = scrlRange.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlRange_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub scrlNum_Change()
    ' 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 = scrlNum.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlNum_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub scrlStat_Change(Index As Integer)
Dim prefix As String
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Select Case Index
        Case 1
            prefix = "Str: "
        Case 2
            prefix = "End: "
        Case 3
            prefix = "Int: "
        Case 4
            prefix = "Agi: "
        Case 5
            prefix = "Will: "
    End Select
    lblStat(Index).Caption = prefix & scrlStat(Index).Value
    NPC(EditorIndex).Stat(Index) = scrlStat(Index).Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlStat_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub scrlValue_Change()
    ' 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 = scrlValue.Value

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "scrlValue_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtAttackSay_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    NPC(EditorIndex).AttackSay = txtAttackSay.text

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtAttackSay_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtChance_Change()
    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
End Sub

Private Sub txtDamage_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Not Len(txtDamage.text) > 0 Then Exit Sub
    If IsNumeric(txtDamage.text) Then NPC(EditorIndex).Damage = Val(txtDamage.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtDamage_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtEXP_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Not Len(txtEXP.text) > 0 Then Exit Sub
    If IsNumeric(txtEXP.text) Then NPC(EditorIndex).EXP = Val(txtEXP.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtEXP_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtHP_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Not Len(txtHP.text) > 0 Then Exit Sub
    If IsNumeric(txtHP.text) Then NPC(EditorIndex).HP = Val(txtHP.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtHP_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtLevel_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Not Len(txtLevel.text) > 0 Then Exit Sub
    If IsNumeric(txtLevel.text) Then NPC(EditorIndex).Level = Val(txtLevel.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtlevel_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtName_Validate(Cancel As Boolean)
Dim tmpIndex As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If EditorIndex = 0 Then Exit Sub
    tmpIndex = lstIndex.ListIndex
    NPC(EditorIndex).Name = Trim$(txtName.text)
    lstIndex.RemoveItem EditorIndex - 1
    lstIndex.AddItem EditorIndex & ": " & NPC(EditorIndex).Name, EditorIndex - 1
    lstIndex.ListIndex = tmpIndex

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtName_Validate", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub txtSpawnSecs_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If Not Len(txtSpawnSecs.text) > 0 Then Exit Sub
    NPC(EditorIndex).SpawnSecs = Val(txtSpawnSecs.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "txtSpawnSecs_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub cmbSound_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If cmbSound.ListIndex >= 0 Then
        NPC(EditorIndex).Sound = cmbSound.List(cmbSound.ListIndex)
    Else
        NPC(EditorIndex).Sound = "None."
    End If

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "cmdSound_Click", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

'ALATAR
Private Sub scrlQuest_Change()
    lblQuest = "Quest Num: " & scrlQuest.Value
    NPC(EditorIndex).QuestNum = scrlQuest.Value
End Sub
'/ALATAR

```
Link to comment
Share on other sites

whats wong with this lines:

Private Sub scrlDrop_Change()
    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)

End Sub

im getting an subscript out of range on the fourth(4) line…
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...