Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class-Specific Background
#1
I am attempting to make a feature where the GUI changes dependent on the player's class, but I keep getting RTE9.

In my FrmMirage frmLoad sub -
Code:
If GetPlayerClass(Index) = 0 Then
        picBackground.Picture = LoadPicture(App.Path & "\gfx\gui\ingame\warrior\ingame.bmp")
    End If

When run IDE it highlights

Code:
Function GetPlayerClass(ByVal Index As Long) As Long
    GetPlayerClass = Player(Index).Class
End Function

Specifically,
Code:
GetPlayerClass = Player(Index).Class

Any help/nudges in the right direction would be greatly appreciated Wink

I don't doubt I'm missing something painfully obvious :roll:
Reply
#2
Code:
If GetPlayerClass(Index) = 0 Then
        picBackground.Picture = LoadPicture(App.Path & "\gfx\gui\ingame\warrior\ingame.bmp")
    End If

Change the if statement to:
Code:
If GetPlayerClass(MyIndex) = 0

Not sure if that's the problem exactly, but it's a start.
Reply
#3
Still no change, although thanks for pointing that out.
Reply
#4
Your MyIndex hasn't been set yet.

Find:

Code:
MyIndex = Val(Parse(1))

In modHandleData. Underneath it add:

Code:
Select Case GetPlayerClass(myindex)
Case 0 'class 0
frmMirage.Picture = LoadPicture(App.Path & "\gfx\gui\ingame\warrior\ingame.bmp")
Case 1
frmMirage.Picture = LoadPicture(App.Path & "\gfx\gui\ingame\class2\ingame.bmp")
End select
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
Thanks Robin, it's working fine now Big Grin
Reply
#6
The select case should run through just fine if you put it where Robin said to. Perhaps you've got the wrong graphics path?
Reply
#7
So what was the problem? Smile
Reply
#8
I was lazy and just directly copied and pasted it, not realizing it was only frmMirage.Picture, not frmMirage.picBackground.Picture.

Although that was probably Robins way of telling me that the picture box wasn't needed. Tongue

[EDIT] The only GUI displaying is the Case 0 one, regardless of the class of the player. Ideas?
[EDIT2] I had another look, realized that the whole Select Case was in the loginok packet, wheras it should be in the ingame packet no? Will mess around with it a little, see what happens.
Reply
#9
My guess would be that the server isn't sending the player's class in that packet. I don't see why you don't just have the server send the class in a packet to the client, in the joingame sub server side and change it there.
Reply
#10
Because that would work perfectly, and teach me how to construct packets.

Thanks Wink
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)