Using 2 different status bars for 2 different player classes

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
IBA
Posts: 1
Joined: Sat Jun 01, 2024 9:19 am
Preferred Pronouns: No Preference

Using 2 different status bars for 2 different player classes

Post by IBA »

Hello, I tried googling and reading on this forum and couldn’t find what I was hoping to get an answer to.

I have 2 player classes in my wad that you could choose to play as, if I wanted player class 1 to have a different status bar than player class 2 is that even possible? And if so how would I go about it?
Jarewill
 
 
Posts: 1855
Joined: Sun Jul 21, 2019 8:54 am

Re: Using 2 different status bars for 2 different player classes

Post by Jarewill »

How is your status bar written?

If you used SBARINFO, you will have to use a PlayerClass / PlayerType command to start a new block and put your status bar there, for example like this:

Code: Select all

	PlayerType Player1
	{
		DrawImage "SHOTA0", 100, 100;
	}
	Else PlayerType Player2
	{
		DrawImage "SGN2A0", 200, 100;
	}
If you used ZScript, you can just check if the player's class is the one you want and draw the status bar, like this:

Code: Select all

	If(CPlayer.mo is "Player1"){Draw();}
	Else If(CPlayer.mo is "Player2"){DrawOther();}
Now if you just have 2 player classes, then you don't need the second check and can just use Else, I put it there for the sake of completeness.
peewee_RotA
Posts: 407
Joined: Fri Feb 07, 2014 6:45 am

Re: Using 2 different status bars for 2 different player classes

Post by peewee_RotA »

The hexen status bar changes elements based on class. It's a good guide to follow:
https://github.com/ZDoom/gzdoom/blob/46 ... ar.zs#L113
Post Reply

Return to “Scripting”