Page 3 of 4

Re: How Do I SBARINFO? - A Tutorial

Posted: Sat Sep 03, 2016 7:15 am
by Silentdarkness12
Arookas wrote:You could try to simplify it by not using else/if for the ammo sprite bars and drawing only one sprite per ininventory, like this:

Code: Select all

InInventory HDSecondPistolLoaded, 15 {
  DrawImage "BULLD0",321,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 14 {
  DrawImage "BULLD0",324,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 13 {
  DrawImage "BULLD0",327,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 12 {
  DrawImage "BULLD0",330,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 11 {
  DrawImage "BULLD0",333,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 10 {
  DrawImage "BULLD0",336,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 9 {
  DrawImage "BULLD0",339,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 8 {
  DrawImage "BULLD0",342,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 7 {
  DrawImage "BULLD0",345,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 6 {
  DrawImage "BULLD0",348,88,none,8,8;
}
InInventory HDSecondPistolLoaded, 5 {
  DrawImage "BULLD0",328,95,none,8,8;
}
InInventory HDSecondPistolLoaded, 4 {
  DrawImage "BULLD0",331,95,none,8,8;
}
InInventory HDSecondPistolLoaded, 3 {
  DrawImage "BULLD0",334,95,none,8,8;
}
InInventory HDSecondPistolLoaded, 2 {
  DrawImage "BULLD0",337,95,none,8,8;
}
InInventory HDSecondPistolLoaded, 1 {
  DrawImage "BULLD0",340,95,none,8,8;
}
You could also utilize weapon primary/secondary ammo icons, as well as weapon icons so that you only draw icons for the weapons/ammo in one place. You could then set the offsets of specific icons in their respective graphic files if you need to have the positions differ.
Wouldn't that cause ALL of the ininventory sprites to get drawn? That would sort of mess things up in that regard, wouldn't it?

Re: How Do I SBARINFO? - A Tutorial

Posted: Sat Sep 03, 2016 1:41 pm
by arookas
No. The idea would be that since ininventory does equal to or larger than, you'd draw one icon per check. Going on the assumption that if you have at least, say 5 rounds loaded, the fifth bullet icon should be drawn. This is done for each number. Without the else's, the ininventories work independently instead of chaining and drawing the entire bar at that state in each block.

Re: How Do I SBARINFO? - A Tutorial

Posted: Sat Sep 03, 2016 1:42 pm
by Tapwave
Silentdarkness12 wrote: Wouldn't that cause ALL of the ininventory sprites to get drawn? That would sort of mess things up in that regard, wouldn't it?
Put an "else" before every InInventory check after the first. That's how I made prestige icons work in my own mod. If all those graphics pile up like in Black & Grey, then you don't need the elses, as it'll only draw the sprites if you have X or more of the InInventory item.

Re: How Do I SBARINFO? - A Tutorial

Posted: Thu Sep 08, 2016 1:28 pm
by Silentdarkness12
Tapwave wrote:
Silentdarkness12 wrote: Wouldn't that cause ALL of the ininventory sprites to get drawn? That would sort of mess things up in that regard, wouldn't it?
Put an "else" before every InInventory check after the first. That's how I made prestige icons work in my own mod. If all those graphics pile up like in Black & Grey, then you don't need the elses, as it'll only draw the sprites if you have X or more of the InInventory item.
Here's the thing though. It's not just one else. What if I need to do an else to the second one? And a third?

And so on and so forth. I'm trying to think this through logically, and i'm not seeing it. An example, please?

Re: How Do I SBARINFO? - A Tutorial

Posted: Thu Sep 08, 2016 1:49 pm
by Tapwave
Sure! Here is the code I use in FragTrak to display the prestige medals. It'll only display the top level one you own.
Spoiler:
The WeaponPrestige items are given via ACS after checking a CVAR, if you're wondering.

Re: How Do I SBARINFO? - A Tutorial

Posted: Mon Sep 12, 2016 3:19 pm
by Silentdarkness12
It's me again.

The rest of the forum: dear god why doesn't he just go away


So i'm trying to make a bar to measure the airburst time on the grenade launchers and such in Hideous Destructor. However, I don't want a background image for the bar, and no matter what I do, whether it's putting in nullimage, a null TEXTURE or TNT1A0, a blacked out version of the bar appears in the extreme upper left corner of the screen, seemingly independent of the X and Y coordinates. What am I doing wrong here?

Code: Select all

InInventory AirburstCount,1
{
DrawImage "BPSIA0",30,190,center,40,40;
DrawBar "AIRBA0","null",AirburstCount,horizontal,interpolate(3),90,150;
}
else
{
DrawImage "BPSIB0",30,190,center,40,40;
}

Re: How Do I SBARINFO? - A Tutorial

Posted: Mon Sep 12, 2016 3:30 pm
by wildweasel
Your back image must have the same dimensions as the front image. Try creating a Textures entry with no patches, with a canvas size equal to the size of the front image.

Re: How Do I SBARINFO? - A Tutorial

Posted: Mon Sep 12, 2016 3:43 pm
by Silentdarkness12
wildweasel wrote:Your back image must have the same dimensions as the front image. Try creating a Textures entry with no patches, with a canvas size equal to the size of the front image.
Already did that. No luck. It's still there. Also tried unchecking 'null texture'. Also no good.

Re: How Do I SBARINFO? - A Tutorial

Posted: Mon Sep 12, 2016 3:57 pm
by Tapwave
Silentdarkness12 wrote: Already did that. No luck. It's still there. Also tried unchecking 'null texture'. Also no good.
Have you tried taking the image you used to make your full bar, make it completely blank, then give it the same offsets? Normally the TEXTURES thing should do exactly that, but it shouldn't hurt to try.

Re: How Do I SBARINFO? - A Tutorial

Posted: Mon Sep 12, 2016 3:59 pm
by Silentdarkness12
Tapwave wrote:
Silentdarkness12 wrote: Already did that. No luck. It's still there. Also tried unchecking 'null texture'. Also no good.
Have you tried taking the image you used to make your full bar, make it completely blank, then give it the same offsets? Normally the TEXTURES thing should do exactly that, but it shouldn't hurt to try.
Yes, I already tried that too.

Re: How Do I SBARINFO? - A Tutorial

Posted: Tue Jun 06, 2017 3:51 pm
by artagon96
hey guys i want to know how to make status bar not showable when armor is depleted can someone help me with this

Re: How Do I SBARINFO? - A Tutorial

Posted: Tue Jun 06, 2017 3:53 pm
by wildweasel
artagon96 wrote:hey guys i want to know how to make status bar not showable when armor is depleted can someone help me with this
There's probably a more elegant way to do this now, but you'd do this by enclosing all the relevant parts of your status bar in an InInventory block. For example, this would show only if you had GreenArmor in your inventory:

Code: Select all

statusbar normal
{
   InInventory GreenArmor
   {
      [...]
   }
}

Re: How Do I SBARINFO? - A Tutorial

Posted: Fri Jun 09, 2017 10:49 am
by artagon96
Yes, it works, and now I need some help so you can change the status bar between two types of grenades when equipped with an assault rifle with a grenade launcher the grenade status bar changes to grenade ammunition and when I change the weapon it again goes back to the previous statusbar

PS: sorry for my bad english

Re: How Do I SBARINFO? - A Tutorial

Posted: Tue Aug 29, 2017 7:01 am
by olzhas1one
Thank you so much. Finally placed health and ammo on the places I wanted and managed to add scores

Re: How Do I SBARINFO? - A Tutorial

Posted: Tue Oct 17, 2017 5:05 pm
by Major Cooke
...I really need to write a tutorial on how to make 'zbarinfo' soon.

I mean, I can start making one but there's still things left unexplored.

But to give me a good refresher course, Weasel, you could point me to a mod of yours that I can convert for you and document along the way, which will be the perfect instrument for writing a tutorial down.
Unless someone beat met to the chase already.

Oh and, if you want some extra nifty features that have been floating in your head yet you couldn't do it with sbarinfo, do tell. :mrgreen:

I'll start off with a straight conversion, one to one, and then I'll add those extra ideas.