Page 1 of 1

equippable HUD

Posted: Wed Feb 28, 2018 7:10 pm
by cortlong50
is there any way to give a player a custom hud through a pickup?

i cant really figure it out in my head, if anyone has an idea let me know!

Re: equippable HUD

Posted: Thu Mar 01, 2018 2:28 am
by ramon.dexter
Well, the easiest way i can imagine is some sort of ACS script with Hudmessage, or some inventory item with overlay...

Or some zscript trick.

Re: equippable HUD

Posted: Thu Mar 01, 2018 1:16 pm
by wildweasel
The way I'd have done it back in the SBARINFO days is to enclose the entire HUD in an InInventory [tokenitem] block. For multiple HUDs, use multiple blocks and different token items.

You could presumably do this a lot more cleanly using CVARs and Zscript now, but that's not something I can easily explain.

Re: equippable HUD

Posted: Thu Mar 01, 2018 5:08 pm
by NeuralStunner
wildweasel wrote:The way I'd have done it back in the SBARINFO days is to enclose the entire HUD in an InInventory [tokenitem] block.
This was how I implemented a ROTT-like gasmask overlay for one thing, because I hate HUDMessage for images so much.

Re: equippable HUD

Posted: Thu Mar 01, 2018 8:10 pm
by Matt
wildweasel wrote:You could presumably do this a lot more cleanly using CVARs and Zscript now, but that's not something I can easily explain.
Not sure if this is more clean, but...

In any event, if you need to completely replace the hud with this pickup you'll have to override the existing HUD anyway, so where ZScript really shines compared to SBARINFO is that you can just say "else super.draw();" and that should get you the regular hud if the item is absent.

Re: equippable HUD

Posted: Sat Mar 03, 2018 3:47 am
by cortlong50
Matt wrote:
wildweasel wrote:You could presumably do this a lot more cleanly using CVARs and Zscript now, but that's not something I can easily explain.
Not sure if this is more clean, but...

In any event, if you need to completely replace the hud with this pickup you'll have to override the existing HUD anyway, so where ZScript really shines compared to SBARINFO is that you can just say "else super.draw();" and that should get you the regular hud if the item is absent.
hey thanks for the link *clicks link....stares at it for like ten minutes...closes link. eye balls bleeding* i think its safe to say ive got a ways to go before figuring out zscript...because that looks like japanese to me man. i seriously cant wrap my head around it. im barely getting there with ACS. getting there, but could be better. but the info is super appreciated. i wish it was easer to get realtime results from zscript like you can in ACS just starting out.
NeuralStunner wrote:
wildweasel wrote:The way I'd have done it back in the SBARINFO days is to enclose the entire HUD in an InInventory [tokenitem] block.
This was how I implemented a ROTT-like gasmask overlay for one thing, because I hate HUDMessage for images so much.
i guess thats kinda what im asking...if i give them a "giveHUD" token or whatever...would it actually work? lets say they walk over and equip it...will they actually be given it, and could they in theory take it off at any time? (thats another one i havent figured out...like jonny5s weeather how you can toggle it...ive never been able to toggle scripts with key presses for some reason.

because if so i can definitely do that.

im just huge on not forcing anything on anyone. like i LOVED dead air...but man i really wish i could play it with vanilla assets.

Re: equippable HUD

Posted: Sat Mar 03, 2018 10:19 am
by ramon.dexter
cortlong50 wrote:
i guess thats kinda what im asking...if i give them a "giveHUD" token or whatever...would it actually work?
Yep, that will work.

Take a look at this part of my SBARINFO:

Code: Select all

InInventory GrenadeExplosive, 1 || GrenadeFire, 1 //check if one of the two types of grenades in inventory; if so, draws whats in {}
	{
		Alpha 0.5
		DrawImage "GRNBCK", -54, 0; //background of grenade display
		DrawImage "GRNFRM", -54, 0; //frame of grenade display
		
		InInventory GrenadeExplosive, 1 //actual grenade icon&amount display
		{
			DrawImage "IGRAP", -54, 0;
			//number
			Drawnumber 3, HUDFONT_STRIFE_YELLOW, yellow, "GrenadeExplosive", 367, 95;
		}
		
		InInventory GrenadeFire, 1
		{
			DrawImage "IGRIN", -54, 0;
			//number
			Drawnumber 3, HUDFONT_STRIFE_YELLOW, yellow, "GrenadeFire", 367, 114;
		}
	}
So, based on this example, you can do your HUD this way:

Code: Select all

InInventory giveHUD, 1
{
  //your HUD goes here
}

Re: equippable HUD

Posted: Sat Mar 03, 2018 2:57 pm
by gwHero
cortlong50 wrote: hey thanks for the link *clicks link....stares at it for like ten minutes...closes link. eye balls bleeding* i think its safe to say ive got a ways to go before figuring out zscript...because that looks like japanese to me man. i seriously cant wrap my head around it.
LOL
cortlong50 wrote:i wish it was easer to get realtime results from zscript like you can in ACS just starting out.
Don't worry about ZScript. Yes with ZScript you have more control, more possibilities, but what you say here is true - if you wanna start learning it's simply not as easy as with ACS. Like Wildweasel and Ramon say this can be done with SBARInfo and InInventory too. It's more limited than ZScript but if it can be done there's nothing wrong with that, I've used it for years. Perhaps it's a good thing to keep ZScript just for stuff that's really not possible with ACS and when that occurs I'm sure there are enough people here that wanna help you out.

Re: equippable HUD

Posted: Wed Mar 21, 2018 3:36 am
by cortlong50
does anyone have any info on how to add and take things away with a keypress?

its weird, i have an example from J5s weather...but i seriously cant get it to work for anything else.

Like a keypress that gives them a token (or removes it) and takes the hud away?

thats my REAL struggle even though id think it was the easiest part

Re: equippable HUD

Posted: Wed Mar 21, 2018 4:58 am
by ramon.dexter
cortlong, you can always bind a script to key. And then define the rest in the script. So basically. the keypress will cal the script, which will do the rest.

edit: Allright, here is some little example (I was writing on tablet, where I dont have any doom stuff):

Code: Select all

addmenukey "Toggle Flashlight" toggleflashlight_bind //adds new key to be used
alias toggleflashlight_bind "pukename toggleflashlight"  //binds action to the key. In this case, an acs script called by the console command pukename.
defaultbind "F" toggleflashlight_bind //default bind of the key. Not neccessary.