Power Bar

Power Bar

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Power Bar

Post by Argh »

I'd like to have a "power bar", that only allows a given Weapon to be used when the bar fills up again. Basically, just a visual representation of the reload speed, for special weapons in my game. Should be really easy to code, any pointers?
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

LuaCOB in COB aim scripts to check if there's power and jam weapon when there isn't I guess. Bars could be drawn by a gadget/widget. That's my shot, I wonder what CA guys will suggest.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh, terribly sorry, I don't mean Energy requirements (although that might be nice, too). I mean just a simple, visual representation of the reload time. Reason why I want this, is for weapons with a very long reload (20 seconds or more) that are very powerful, commandfire weapons- the player needs to manually use them, and they need a visual cue as to when they're reloaded.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

imo this should just be another widget to throw around, I can see it having many uses in many mods. Infact its a standard part of supcom for static weapons with a longer reload time and silos.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Yup, that's pretty much my thoughts on this as well.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Code: Select all

Spring.GetUnitWeaponState(unitID, weaponNum) -> nil | 
  boolean angleGood,
  boolean ready,
  number reloadReadyFrame,
  number salvoLeft,
  number numStockpiled
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Cool, so I just have to look at the Gadgets for health, change a few things, and it'll work- thanks :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I'd advise this be done via widget rather than gadget so we can use it in any mod
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I think it'll probably be a Gadget, with a config, because you're not going to want it on every Unit, but conversion to a more general-purpose Widget is probably painless. I certainly don't have anything working yet, I'm working on models right now, no time for code.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

Argh wrote:I think it'll probably be a Gadget, with a config, because you're not going to want it on every Unit, but conversion to a more general-purpose Widget is probably painless. I certainly don't have anything working yet, I'm working on models right now, no time for code.
It makes absolutely no sense as a gadget. Something which is purely UI should be a widget. It doesn't need to be synced and whether it is shown should be user choice. It's also applicable to every mod.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

It's also applicable to every mod.
Not really- the way I was intending to use it, some Units would have this enabled, some won't. It doesn't make sense, at least to me, to have this for a PeeWee- that seems like a huge waste of CPU and graphical resources. However, you might very well want it for a MRPC, LRPC, Nuke, etc. In my game, I have a Unit with a 10-second firing delay, and I will probably have another one (speculative, don't even have a model yet) with an even longer delay, and I think players will want to know, down to the half-second, when it's going to reload, for pinpoint aiming at moving targets.

So, I kind've envision this as a selective UI tool, not a blanket tool. However, if a blanket Widget gets written before I get to this issue, and people really like it, I will re-evaluate my opinion- we don't have it yet, so I'm mainly speculating on the probable best use of this concept.[/quote]
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Post by ginekolog »

I would suggest to make it a widged with first line specifying for which units it shows the bar. That would be very usefull for snipers, fatboy, banisher,nuke etc.

That way it would work for all mods and many would use it (if its not too cpu hungry)

ty
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Post by MelTraX »

You mentioned three times it's for units with a longer reload delay.. So why not just display it only for units with a long reload time and you're done.. ie everything longer than 5 seconds.. No configuration needed.. I think jK should just add another bar to the health bars widget..
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

That would be very nice, and I agree entirely, then it'd be config-less, and a neater package overall :-)
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

I disagree, it should be a (free for any mod to use) gadget. If you want to play Baranced Annihilation (or any other mod, that pun was just the best) bug the mod dev to implement the gadget. Anyone who can fiddle with numbers can add unitnames to a config file. Having it apply to all units with x reload time isn't ideal, since there are sometimes units with longer reload times like that which are really irrelevent to the player.

For example, SWS has anti-air infantry with shoulder-mounted rockets with a reload time of 8, but this reload value isn't important to the player. And there's no way we can police or maintain widgets like this which become annoying in that situation.

There's a point where some things just need to be decided by the mod creator. This is one of them. Health, build progress, and paralyzation are certainly universal, but reload time is something that should always be defined by the mod, not by the user.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Gnome, if the widgets annoying the user turns it off.

I personally would like to see the reload time on that raider or that zipper, but not on that peewee. If its annoying then the timing settings aren't done properly or the bar is too large and interfering.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Ok, so I have a a new player in SWS. He's playing the game and posts feedback saying it would be nice to have a reload bar for x unit with a long reload time.

So we direct him to this lua widget and tell him it'll put in reload time bars. He downloads it. He has no clue what to do with this lua file since he is new and posts again for help.

We explain to him that you just put the lua file in the LuaUI/Widgets directory. Then you load up a game, press F11, search the list for the widget, and enable it. He does this.

Worst case scenario: the widget conflicts with some other widget he found in the process and installed at the same time and crashes luaui entirely, creating an entirely seperate troubleshooting problem.

Somewhat less worse scenario: he then has to open the lua file, muck around in the code, find the configuration line, and define which units should have the reload bar. And let's pray to god he only plays SWS, otherwise he might very well have to dick with the config for every mod.

Best case scenario: the widget works, and is set to automatically display on reload times of x seconds. However, this timer includes the aforementioned rocket troopers. He doesn't need or what a reload bar on them. He asks how to remove it on them. Best scenario: he can by raising the defined time threshold (again dicking with the lua code). Worst scenario: he can't, because the reload time of x unit(s) he wants is still shorter than the unit(s) he doesn't want.

Repeat this dozens and dozens of times because no new player uses the search function or even reads topics a quarter of the way down the page in a forum. And no doubt there'd be those who don't use the forum and instead go through the process on IRC or in lobby chat instead.

All of this, or the reload bar could be a gadget with pre-defined units by the modder. The user might have to request the bar be added to another unit in the next version, and then wait for it. The system works from the beginning with no configuration on the user's part or conflicts with other things packaged in the mod.

Long story short: Lua widgets are a nightmare for us, we can't predict what a user is using or how he's going to do it or how things are going to react/conflict with each other, and NO widget of this nature can be predefined to work with every mod's balance.

It should be a gadget.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

widgets can be included in the mod package and be auto activated, but they can still be turned off by the user in the widget selector menu

gadgets no, since they are synced, they need to have the same state for everyone

i guess everybody here is saying the same thing, but there is a lil misunderstanding
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh, so Widgets aren't synched? That's fairly decisive, then, I'm in favor of that.

However, there probably needs to be a UI presented, where users select the reload times, in float--->seconds, so that people can adjust all the way down to PeeWees, if they just really like the power bar effect... or just things that fire extremely slowly. As Gnome rightly pointed out, this won't make everybody everywhere happy all the time, but it's better than having yet-another chunk of sync code, especially for something that's fairly trivial.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The rocket troopers could be handled by an exclusion list.
Post Reply

Return to “Lua Scripts”