Mirage Source
http://miragesource.net/forums/

[BUGFIX] RE9: SpawnItem
http://miragesource.net/forums/viewtopic.php?f=193&t=4608
Page 1 of 1

Author:  shlink [ Wed Oct 22, 2008 3:41 pm ]
Post subject:  [BUGFIX] RE9: SpawnItem

Miniscule, but annoying.

Code:
Sub SpawnItem(ByVal ItemNum As Long, ByVal ItemVal As Long, ByVal MapNum As Long, ByVal x As Long, ByVal y As Long)
Dim i As Long

    ' Check for subscript out of range
    If ItemNum < 0 Or ItemNum > MAX_ITEMS Or MapNum <= 0 Or MapNum > MAX_MAPS Then
        Exit Sub
    End If
   
    ' Find open map item slot
    i = FindOpenMapItemSlot(MapNum)
   
    Call SpawnItemSlot(i, ItemNum, ItemVal, Item(ItemNum).Data1, MapNum, x, y)
End Sub

As commented, there is a check for this runtime error. But if an NPC doesn't drop an item, it will still cause this error. I'm sure there is a more appropriate fix towards this, perhaps somewhere in the NPC coding. But the following fix works 100% to my knowledge.

In the Sub above, replace:
Code:
ItemNum < 0

with:
Code:
ItemNum < 1


That's it. Now you truely shouldn't get the dreaded runtime error 9. If there is a more appropriate fix, post it or thou shalt be smited! ...or not... :evil:
And if this fix is wrong in some way, by all means, let me know and consider this a bug report rather than a fix. But from testing, it fixes the error 100% with no problems to the rest of the game that I've seen.

Author:  Rian [ Fri Jan 09, 2009 7:16 pm ]
Post subject:  Re: [BUGFIX] RE9: SpawnItem

Necroposting bot has been banned.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/