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

this is what it should look like

```
' Drop the goods if they get it
        For n = 1 To MAX_NPC_DROPS
            If Npc(Victim).DropItem(n) = 0 Then Exit For
            If Rnd <= Npc(Victim).DropChance(n) Then
                Call SpawnItem(Npc(Victim).DropItem(n), Npc(Victim).DropItemValue(n), MapNum, MapNpc(MapNum).Npc(Victim).x, MapNpc(MapNum).Npc(Victim).y)
            End If
        Next
```
I think you are using a custom version like starlight or omega… The pet system for those are buggy anyways you probably shouldn't use it if you are...
Link to comment
Share on other sites

@Justn:

> this is what it should look like
>
> ```
> ' Drop the goods if they get it
>         For n = 1 To MAX_NPC_DROPS
>             If Npc(Victim).DropItem(n) = 0 Then Exit For
>             If Rnd <= Npc(Victim).DropChance(n) Then
>                 Call SpawnItem(Npc(Victim).DropItem(n), Npc(Victim).DropItemValue(n), MapNum, MapNpc(MapNum).Npc(Victim).x, MapNpc(MapNum).Npc(Victim).y)
>             End If
>         Next
> ```
> I think you are using a custom version like starlight or omega… The pet system for those are buggy anyways you probably shouldn't use it if you are...

Error…
[![](http://www10.pic-upload.de/thumb/14.03.12/qnf4jjthzvb.png)](http://www.pic-upload.de/view-13345131/Unbenannt.png.html)

I use the Starlight files…
Which are then the best files ??

I heard many about CS:DE but its really so good ?
Link to comment
Share on other sites

Well considering you moved from petattacknpc to playerattacknpc the variable changed try looking around for clues you don't have to be good at coding, in that sub it is npcNum not victim.  It tells you exactly what is wrong, in this case variable not defined this means that the variable does not exist and how can you use something that does not exist?
Link to comment
Share on other sites

@Scott:

> Well considering you moved from petattacknpc to playerattacknpc the variable changed try looking around for clues you don't have to be good at coding, in that sub it is npcNum not victim.  It tells you exactly what is wrong, in this case variable not defined this means that the variable does not exist and how can you use something that does not exist?

Oh oh! I know! You make it :'D
Link to comment
Share on other sites

Hi, I have the altars quest system and upon compiling I get this error.

Within **modGameEditors**:
```
' ////////////////
' // Npc Editor //
' ////////////////
Public Sub NpcEditorInit()
Dim i As Long
Dim SoundSet As Boolean

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

    If frmEditor_NPC.Visible = False Then Exit Sub
    EditorIndex = frmEditor_NPC.lstIndex.ListIndex + 1

    ' populate the cache if we need to
    If Not hasPopulated Then
        PopulateLists
    End If
    ' add the array to the combo
    frmEditor_NPC.cmbSound.Clear
    frmEditor_NPC.cmbSound.AddItem "None."
    For i = 1 To UBound(soundCache)
        frmEditor_NPC.cmbSound.AddItem soundCache(i)
    Next
    ' finished populating

    With frmEditor_NPC
        .txtName.text = Trim$(NPC(EditorIndex).Name)
        .txtAttackSay.text = Trim$(NPC(EditorIndex).AttackSay)
        If NPC(EditorIndex).Sprite < 0 Or NPC(EditorIndex).Sprite > .scrlSprite.Max Then NPC(EditorIndex).Sprite = 0
        .scrlSprite.Value = NPC(EditorIndex).Sprite
        .txtSpawnSecs.text = CStr(NPC(EditorIndex).SpawnSecs)
        .cmbBehaviour.ListIndex = NPC(EditorIndex).Behaviour
        .scrlRange.Value = NPC(EditorIndex).Range
        .txtChance.text = CStr(NPC(EditorIndex).DropChance(1))
        .scrlNum.Value = NPC(EditorIndex).DropItem(1)
        .scrlValue.Value = NPC(EditorIndex).DropItemValue(1)
        .txtHP.text = NPC(EditorIndex).HP
        .txtEXP.text = NPC(EditorIndex).EXP
        .txtLevel.text = NPC(EditorIndex).Level
        .txtDamage.text = NPC(EditorIndex).Damage

        'ALATAR
        .chkQuest.Value = NPC(EditorIndex).Quest
        .scrlQuest.Value = NPC(EditorIndex).QuestNum
        '/ALATAR

        ' find the sound we have set
        If .cmbSound.ListCount >= 0 Then
            For i = 0 To .cmbSound.ListCount
                If .cmbSound.List(i) = Trim$(NPC(EditorIndex).Sound) Then
                    .cmbSound.ListIndex = i
                    SoundSet = True
                End If
            Next
            If Not SoundSet Or .cmbSound.ListIndex = -1 Then .cmbSound.ListIndex = 0
        End If

        For i = 1 To Stats.Stat_Count - 1
            .scrlStat(i).Value = NPC(EditorIndex).Stat(i)
        Next
    End With

    Call EditorNpc_BltSprite
    NPC_Changed(EditorIndex) = True

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "NpcEditorInit", "modGameEditors", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
Apparently Altars requires me to overwrite the same file as this **frmEditor_NPC,** so is there a solution to combine both form edits?
Link to comment
Share on other sites

Justn is exactly right you need to copy and paste the controls(label/slider ect…) from this tutorials frmEditor_NPC to the one from altars system,  you will then need to find all the snippets of code that make those controls work and transfer those as well.  They will all be named after the controls you transferred so it should be pretty easy let me know if you need any more help.
Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
You forgot to perform the first step.

In modType in both CLIENT/SERVER replace NpcRec with this one

```
Private Type NpcRec
    Name As String * NAME_LENGTH
    AttackSay As String * 100
    Sound As String * NAME_LENGTH

    Sprite As Long
    SpawnSecs As Long
    Behaviour As Byte
    Range As Byte
    DropChance(1 To MAX_NPC_DROPS) As Double
    DropItem(1 To MAX_NPC_DROPS) As Byte
    DropItemValue(1 To MAX_NPC_DROPS) As Integer
    Stat(1 To Stats.Stat_Count - 1) As Byte
    HP As Long
    EXP As Long
    Animation As Long
    Damage As Long
    Level As Long
End Type
```
Link to comment
Share on other sites

  • 3 weeks later...
Worked perfectly, only problem I had was that when my friend tried to edit NPCs, his client crashed, although I tested on his client and worked fine so it's probably just that his account is bugged xD  Oh and you shouldn't have to delete all of your NPCs, just re-enter their values like the post above said.
Link to comment
Share on other sites

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