How Do I SBARINFO? - A Tutorial

Handy guides on how to do things, written by users for users.
Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Re: How Do I SBARINFO? - A Tutorial

Postby Silentdarkness12 » Sat Sep 03, 2016 8:15 am

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 allExpand view
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?
User avatar
Silentdarkness12
Level 4: DECORATE Pupil
 
Joined: 15 Aug 2013
Location: Plains of Pride

Re: How Do I SBARINFO? - A Tutorial

Postby arookas » Sat Sep 03, 2016 2:41 pm

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.
User avatar
arookas
...but only sometimes.
 
Joined: 24 Jan 2011

Re: How Do I SBARINFO? - A Tutorial

Postby Tapwave » Sat Sep 03, 2016 2:42 pm

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.
User avatar
Tapwave
On the GREEN!
 
Joined: 20 Aug 2011
Discord: Insulting#2455

Re: How Do I SBARINFO? - A Tutorial

Postby Silentdarkness12 » Thu Sep 08, 2016 2:28 pm

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?
User avatar
Silentdarkness12
Level 4: DECORATE Pupil
 
Joined: 15 Aug 2013
Location: Plains of Pride

Re: How Do I SBARINFO? - A Tutorial

Postby Tapwave » Thu Sep 08, 2016 2:49 pm

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.
User avatar
Tapwave
On the GREEN!
 
Joined: 20 Aug 2011
Discord: Insulting#2455

Re: How Do I SBARINFO? - A Tutorial

Postby Silentdarkness12 » Mon Sep 12, 2016 4:19 pm

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 allExpand view
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;
}
User avatar
Silentdarkness12
Level 4: DECORATE Pupil
 
Joined: 15 Aug 2013
Location: Plains of Pride

Re: How Do I SBARINFO? - A Tutorial

Postby wildweasel » Mon Sep 12, 2016 4:30 pm

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

Re: How Do I SBARINFO? - A Tutorial

Postby Silentdarkness12 » Mon Sep 12, 2016 4:43 pm

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.
User avatar
Silentdarkness12
Level 4: DECORATE Pupil
 
Joined: 15 Aug 2013
Location: Plains of Pride

Re: How Do I SBARINFO? - A Tutorial

Postby Tapwave » Mon Sep 12, 2016 4:57 pm

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.
User avatar
Tapwave
On the GREEN!
 
Joined: 20 Aug 2011
Discord: Insulting#2455

Re: How Do I SBARINFO? - A Tutorial

Postby Silentdarkness12 » Mon Sep 12, 2016 4:59 pm

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.
User avatar
Silentdarkness12
Level 4: DECORATE Pupil
 
Joined: 15 Aug 2013
Location: Plains of Pride

Re: How Do I SBARINFO? - A Tutorial

Postby artagon96 » Tue Jun 06, 2017 4:51 pm

hey guys i want to know how to make status bar not showable when armor is depleted can someone help me with this
artagon96
 
Joined: 05 Apr 2017

Re: How Do I SBARINFO? - A Tutorial

Postby wildweasel » Tue Jun 06, 2017 4:53 pm

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 allExpand view
statusbar normal
{
   InInventory GreenArmor
   {
      [...]
   }
}
User avatar
wildweasel
I love the smell of sourdough in the morning
 
Joined: 15 Jul 2003
Location: avatar by kurashiki

Re: How Do I SBARINFO? - A Tutorial

Postby artagon96 » Fri Jun 09, 2017 11:49 am

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
artagon96
 
Joined: 05 Apr 2017

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests