Another NC_HudBar Question

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Another NC_HudBar Question

Post by Mayhem666 »

Hey, I would like to know something about the Hud Bar,

If a Weapon as a Reload animation like a shotgun, does a counter of the Ammo before reloading can exist ?

Like 8/8 Ammo in charge, and the Total like usually 100.

Let me know, thanks :)
User avatar
revo794
Posts: 158
Joined: Sun Dec 30, 2012 9:33 am

Re: Another NC_HudBar Question

Post by revo794 »

It is possible, but you'll need to create two ammo types.
On this piece, the bullet counter is seen below, and the clips counter is above.
Image
So you have to type kind of this:

Code: Select all

Weapon.AmmoType MyShell
Weapon.AmmoType2 TotalShells
And in the reload piece:

Code: Select all

WEAP A 0 A_TakeInventory("TotalShells",1)
WEAP A 0 A_GiveInventory("MyShell",1)
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Another NC_HudBar Question

Post by Mayhem666 »

revo794 wrote:It is possible, but you'll need to create two ammo types.
On this piece, the bullet counter is seen below, and the clips counter is above.
Image
So you have to type kind of this:

Code: Select all

Weapon.AmmoType MyShell
Weapon.AmmoType2 TotalShells
And in the reload piece:

Code: Select all

WEAP A 0 A_TakeInventory("TotalShells",1)
WEAP A 0 A_GiveInventory("MyShell",1)
Okay thanks for this, But i was also asking for the Hud Himself,

About spawning these 2 ammos type in the Hud, the Total Ammo like usually and the Charge for the Nc_Hud

Like to see both bar.

Thanks
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Another NC_HudBar Question

Post by Blue Shadow »

You mean something like this? The HUD supports weapons with primary and secondary ammo since v1.6. The procedure to include them is the same as with one-type ammo weapons.
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Another NC_HudBar Question

Post by Mayhem666 »

Blue Shadow wrote:You mean something like this? The HUD supports weapons with primary and secondary ammo since v1.6. The procedure to include them is the same as with one-type ammo weapons.
Oh Yes thats actually what i wanted,

But does these graphics are included in the Hud ?

Also, though i added my custom ammo type for new weapons, but to add the reload ammunation i'm not really sure how to proceed,
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Another NC_HudBar Question

Post by Blue Shadow »

Mayhem666 wrote:But does these graphics are included in the Hud ?
Of course, they are. In fact, there is a test weapon* included in the HUD itself that uses two ammo types. To test it, you can give it to yourself by typing the following in the console:

Code: Select all

give nc_dualammotestpistol
* It is not a fully functional weapon with reload and stuff; it is just a weapon with fire and altfire modes and an ammo type for each mode.
Also, though i added my custom ammo type for new weapons, but to add the reload ammunation i'm not really sure how to proceed,
Again, it is practically the same as a one-type ammo weapon, except you require to specify the secondary ammo in the array (in the ACS library) as well as the primary. Check to see how the test weapon is implemented.
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Another NC_HudBar Question

Post by Mayhem666 »

Blue Shadow wrote:
Mayhem666 wrote:But does these graphics are included in the Hud ?
Of course, they are. In fact, there is a test weapon* included in the HUD itself that uses two ammo types. To test it, you can give it to yourself by typing the following in the console:

Code: Select all

give nc_dualammotestpistol
* It is not a fully functional weapon with reload and stuff; it is just a weapon with fire and altfire modes and an ammo type for each mode.
Also, though i added my custom ammo type for new weapons, but to add the reload ammunation i'm not really sure how to proceed,
Again, it is practically the same as a one-type ammo weapon, except you require to specify the secondary ammo in the array (in the ACS library) as well as the primary. Check to see how the test weapon is implemented.

When i use a Alt Fire with the Shotgun for exemple... A Square is spawning each time i shoot.

U can see in the screenshot below :

Image
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Another NC_HudBar Question

Post by Blue Shadow »

That "square" is the background on which the selected portable inventory item is drawn. It is supposed to show up if you have at least one item in your possession. Does the weapon give you such item(s) as a part of its code, by any chance?
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Another NC_HudBar Question

Post by Mayhem666 »

Blue Shadow wrote:That "square" is the background on which the selected portable inventory item is drawn. It is supposed to show up if you have at least one item in your possession. Does the weapon give you such item(s) as a part of its code, by any chance?
Is there a way to not make the Square appearing whatever the thing is appearing in the inventory?
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Another NC_HudBar Question

Post by Blue Shadow »

If your mod does not make use of portable items (like in Heretic or Hexen), then I guess you don't need it. In that case, remove or comment out the following code (it is at the very bottom) to prevent it from showing up:

Code: Select all

  // Inventory Box --------------------------------------------------------------------------------------

  // If "Reserve ammo toggle" option is set to on, draw the artibox next to the reserve ammo display

  InInventory NC_ToggleAmmo
  {
    drawselectedinventory alternateonempty, center, NC_CONFDIGITS, -130, -84, -113, -71, untranslated {}
    else { drawimage "ARTIBOX", -148, -100; }
  }

  // Otherwise, move it into its place

  else
  {
    drawselectedinventory alternateonempty, center, NC_CONFDIGITS, -29, -84, -12, -71, untranslated {}
    else { drawimage "ARTIBOX", -47, -100; }
  }
However, if the case is that your weapon "gives" you an item (my guess would be a custom inventory for tracking something) as a part of its code, then it probably can be solved from that side, and not bother about messing with the HUD itself.
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Another NC_HudBar Question

Post by Mayhem666 »

Blue Shadow wrote:If your mod does not make use of portable items (like in Heretic or Hexen), then I guess you don't need it. In that case, remove or comment out the following code (it is at the very bottom) to prevent it from showing up:

Code: Select all

  // Inventory Box --------------------------------------------------------------------------------------

  // If "Reserve ammo toggle" option is set to on, draw the artibox next to the reserve ammo display

  InInventory NC_ToggleAmmo
  {
    drawselectedinventory alternateonempty, center, NC_CONFDIGITS, -130, -84, -113, -71, untranslated {}
    else { drawimage "ARTIBOX", -148, -100; }
  }

  // Otherwise, move it into its place

  else
  {
    drawselectedinventory alternateonempty, center, NC_CONFDIGITS, -29, -84, -12, -71, untranslated {}
    else { drawimage "ARTIBOX", -47, -100; }
  }
However, if the case is that your weapon "gives" you an item (my guess would be a custom inventory for tracking something) as a part of its code, then it probably can be solved from that side, and not bother about messing with the HUD itself.
I don't think it use such a thing, But it use Alt fire in wish it need to give some item ''kind'' for Reload purpose and all that stuff.

So i'm not sure if it's useful to have this in that case.
Locked

Return to “Editing (Archive)”