How can I make a special button (Like in the case of a sprint button) show a stamina bar for the players current energy, such as so make the player stop running when the bar is done, and after time the bar should go filling itself until it gets full.
ps: sorry for my bad english
Stamina bar
- someoneelse
- Forum Regular
- Posts: 338
- Joined: Sat Aug 18, 2012 10:53 am
- Location: Poland
RE: Stamina bar
Button? It seems you want to make a mod with Doom3-like stamina variable, yes? Such mod would pretty much suck in classic Doom, where the speed is one of the things player like the most, so I doubt it has been done... And since I suspect you have problems with knowing what you're talking about, I doubt you'd be able to make a mod yourself. (If you're a coder, but with really bad English, sorry!)
Last edited by someoneelse on Sat Oct 13, 2012 2:18 pm, edited 1 time in total.
Shared keys will now be in Zandro! Thanks devs for their work, and users for the support!
<AlienOverlord> Do you have any friends at all
<AlienOverlord> You play Doom
RE: Stamina bar
Well your best bet would be a while loop run while movement keys are down (dunno how you would differentiate between run and walk if you have auto run on) and then using getactorproperty you can adjust the player speed. Having said that the Zdoom wiki suggests using: "Player.ForwardMove value[, value-run]" to adjust the speed and it includes a running state. It shouldn't be too hard to achieve imo.
EDIT:
And then the bar can be achieved by using a hudmessage image, and maybe perctage the stamina and show it out of 100 (maybe have 10 bars that fade away) a bit like the boss bars in Armageddon invasion. It's all there on the zdoom wiki.
EDIT:
And then the bar can be achieved by using a hudmessage image, and maybe perctage the stamina and show it out of 100 (maybe have 10 bars that fade away) a bit like the boss bars in Armageddon invasion. It's all there on the zdoom wiki.
Last edited by one_Two on Sat Oct 13, 2012 3:01 pm, edited 1 time in total.
RE: Stamina bar
Or you could just use SBARINFO which has native support for showing bars that are full when you have a maximum of an item and empty when you have none.
It's not actually all that hard, actually. Just make a sprint function, make it drain an item while in use, and prevent the player from sprinting for a while if he runs out. Then use DrawBar to draw the amount of the item he has.
It's not actually all that hard, actually. Just make a sprint function, make it drain an item while in use, and prevent the player from sprinting for a while if he runs out. Then use DrawBar to draw the amount of the item he has.
RE: Stamina bar
Spoiler: Example (Open)How it works: you need to define an alias in the KEYCONF lump to use your SprintAbility item, i. e.:
Code: Select all
addmenukey "Sprint" +sprint
...
alias +sprint "use SprintAbility"
alias -sprint "use SprintAbilityCancel"
Code: Select all
DrawBar "STAMBARA","STAMBARB",SprintPenalty,vertical,0,0;You also need to adjust the coordinates of the bar.
This code uses SprintPenalty item's count to determine how tired the player is due to sprinting. Use can alter its maximum amount in order to raise or lower the maximum duration of sprinting. The player slowly loses his tiredness when standing still. Using this method you can change almost everything in your stamina system without ACS coding.
Cheers.
[/spoiler]
