Mirage Source

Free ORPG making software.
It is currently Thu May 23, 2024 7:02 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [BUGFIX] RE9: SpawnItem
PostPosted: Wed Oct 22, 2008 3:41 pm 
Offline
Newbie

Joined: Wed Oct 22, 2008 2:46 pm
Posts: 3
Google Talk: shlink@shibber.net
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.

_________________
It is what it is,
therefore,
I do what I do.


Top
 Profile  
 
PostPosted: Fri Jan 09, 2009 7:16 pm 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
Necroposting bot has been banned.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group