Mirage Engine
Class-Specific Background - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Class-Specific Background (/showthread.php?tid=2010)



Class-Specific Background - Acruno - 13-08-2008

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:


Re: Class-Specific Background - Rian - 13-08-2008

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.


Re: Class-Specific Background - Acruno - 13-08-2008

Still no change, although thanks for pointing that out.


Re: Class-Specific Background - Robin - 13-08-2008

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



Re: Class-Specific Background - Acruno - 13-08-2008

Thanks Robin, it's working fine now Big Grin


Re: Class-Specific Background - Rian - 13-08-2008

The select case should run through just fine if you put it where Robin said to. Perhaps you've got the wrong graphics path?


Re: Class-Specific Background - Rian - 13-08-2008

So what was the problem? Smile


Re: Class-Specific Background - Acruno - 13-08-2008

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.


Re: Class-Specific Background - Matt - 13-08-2008

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.


Re: Class-Specific Background - Acruno - 13-08-2008

Because that would work perfectly, and teach me how to construct packets.

Thanks Wink