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

Runtime error 9 when clicking npc


Daneta
 Share

Recommended Posts

Soooo this happens lol (Engine Prospekt Dev edition)

I did this tut http://www.eclipseorigins.com/thread-27-page-2.html

And When i click an NPC, I get RTE 9 subscript out of range in "GameLoop" "ModGameLogic"… No idea why XDD 

the code where it happens 

```
Public Sub DrawTargetDetails()

Dim I As Long, x As Long, y As Long, npcNum As Long
Dim Width As Long, Height As Long, SpriteNum As Long
Dim MapNpcNum As Long
Dim Name As String
Dim HpBar As String

   ' render the window
  Width = 256
   Height = 64
   ' render the window on screen
  x = 300
    y = 64

   ' render the details
  Directx8.RenderTexture Tex_GUI(24), x, y, 0, 0, Width, Height, Width, Height

   'ERROR HAPPENS ON THIS LINE'
  npcNum = MapNpc(myTarget).Num

   ' exists?
  If npcNum > 0 Then
       Name = Trim$(NPC(npcNum).Name)
       HpBar = Trim$(MapNpc(npcNum).Vital(HP))
       ' show the information
      RenderText Font_GeorgiaShadow, Name, x + 10, y + 4, Yellow
      RenderText Font_GeorgiaShadow, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).Num).HP, x + 66, y + 15, Yellow
      RenderText Font_GeorgiaShadow, NPC(npcNum).Level, x + 150, y + 4, Yellow
   End If

End Sub
```
Mytarget value is the npc number that im clicking, from map property order and npcnum is its number from when its made XD
Link to comment
Share on other sites

That entire section covers only YOUR index, not every player's.. Not sure what bit you copied, but that entire section seems completely pointless unless you messed up and used MyIndex instead of Index. (Also, why hardcode sprite 1 and 2? Why not use GetPlayerSprite?)
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...