equippable HUD

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

equippable HUD

Postby cortlong50 » Wed Feb 28, 2018 8:10 pm

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!
User avatar
cortlong50
editing my comments ad nauseam
 
Joined: 24 Jun 2013
Location: UT-WA

Re: equippable HUD

Postby ramon.dexter » Thu Mar 01, 2018 3:28 am

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.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia

Re: equippable HUD

Postby wildweasel » Thu Mar 01, 2018 2:16 pm

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.
User avatar
wildweasel
I love the smell of sourdough in the morning
Moderator Team Admin
 
Joined: 15 Jul 2003
Location: avatar by kurashiki

Re: equippable HUD

Postby NeuralStunner » Thu Mar 01, 2018 6:08 pm

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.
User avatar
NeuralStunner
The world has become a place
 
 
 
Joined: 21 Jul 2009
Location: traveling around inside a hug

Re: equippable HUD

Postby Matt » Thu Mar 01, 2018 9:10 pm

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.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: equippable HUD

Postby cortlong50 » Sat Mar 03, 2018 4:47 am

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.
User avatar
cortlong50
editing my comments ad nauseam
 
Joined: 24 Jun 2013
Location: UT-WA

Re: equippable HUD

Postby ramon.dexter » Sat Mar 03, 2018 11:19 am

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 allExpand view
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 allExpand view
InInventory giveHUD, 1
{
  //your HUD goes here
}
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia

Re: equippable HUD

Postby gwHero » Sat Mar 03, 2018 3:57 pm

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.
User avatar
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands

Re: equippable HUD

Postby cortlong50 » Wed Mar 21, 2018 4:36 am

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
User avatar
cortlong50
editing my comments ad nauseam
 
Joined: 24 Jun 2013
Location: UT-WA

Re: equippable HUD

Postby ramon.dexter » Wed Mar 21, 2018 5:58 am

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 allExpand view
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.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia


Return to General

Who is online

Users browsing this forum: REXMaster and 2 guests