Page 1 of 3

Com Counter Display

Posted: 17 Dec 2012, 19:10
by Jazcash
Com Counter Display

Download the latest version from the widget database

Image

At the time of writing this, I have a good few ideas of features to implement such as warnings for last Coms and things so this is by no means the finished version, so feel free to suggest things and report bugs. This is really just the widget in its bare-bones.

Re: Com Counter Display

Posted: 17 Dec 2012, 19:13
by Jools
Does it count also decoys?

Re: Com Counter Display

Posted: 17 Dec 2012, 19:15
by Jazcash
Jools wrote:Does it count also decoys?
Not tested, but it should do because it works by just reducing com counts from initial player counts whenever it detects a new wreck, and as decoys don't have wrecks then it should work fine.

Also it doesn't work for rezzed coms yet, but I'm working on that.

Re: Com Counter Display

Posted: 17 Dec 2012, 20:24
by Beherith
Lua has always kinda made decoy commanders obsolete. I dont know if there is a method of hiding the decoy nature of things from the user in widget space, unless we override a lot of luaui.lua.

Re: Com Counter Display

Posted: 17 Dec 2012, 20:32
by Jazcash
Imo, decoy units have never been used enough to justify their presence in BA. Writing all the necessary code to ensure Lua can't tell the difference at all between decoy units and normal units would be laborious.

To counter the way my widget specifically does it would mean giving decoy Coms some sort of Lua-only wreck which Lua would see as being exactly the same as normal Com wrecks but in actuality they wouldn't have wrecks at all.

Maybe a "virtual" property which could be applied to any unit/feature which makes them invisible (in every way possible) to players but still visible to Lua would work? It'd have to be a property unreadable by Lua ofc which would mean you'd have issues with existing widgets treating virtual wrecks/units as real ones and doing silly things.

I'm no Lua expert though, there's probably a much more elegant solution.

Re: Com Counter Display

Posted: 17 Dec 2012, 21:22
by knorke
the counting of wrecks and all that is imo quite stupid.
cleanest would be to have a gadget that keeps track of living commanders. Then tell the player/widget as much as he can see.
With the hardcoded unitnames it is specific to BA anyway, so why not make it as gadget?

Re: Com Counter Display

Posted: 17 Dec 2012, 21:31
by Jazcash
knorke wrote:the counting of wrecks and all that is imo quite stupid.
cleanest would be to have a gadget that keeps track of living commanders. Then tell the player/widget as much as he can see.
With the hardcoded unitnames it is specific to BA anyway, so why not make it as gadget?
An old widget, similar to this used to be done with the widgetHandler UnitDestroyed, UnitCreated and so on but it got changed so they only work for units within ally LOS. Wrecks however, are still visible globally, with or without LOS.

If it was my decision I'd hide all wrecks not within LOS, it looks silly in games with more than 2 teams (like FFA) when you just see wrecks appearing from nowhere. If a player can't see an enemy's units without LOS then why should they be able to see their wrecks without LOS?

Anyway, regarding keeping track of alive commanders instead of dead commanders and doing it that way did occur to me but I'd already written all the code so couldn't be bothered to change it. If there's ever any reason I need to do it that way or if it breaks due to an engine/mod change then maybe I'll consider rewriting :P

Re: Com Counter Display

Posted: 17 Dec 2012, 21:36
by smoth
Beherith wrote:Lua has always kinda made decoy commanders obsolete. I dont know if there is a method of hiding the decoy nature of things from the user in widget space, unless we override a lot of luaui.lua.
What is a commander?
is it the way it is used for comm ends?
is it the income granted?

I suppose I don't follow but with some clever gadgetry you can make unit that is a decoy but not. we can chat about it later if you are interested.

Re: Com Counter Display

Posted: 17 Dec 2012, 23:31
by Jools
There is no foolproof way of making a decoy that lua cannot detect. We have the same problem as in Seinfeld in 'the contest' (about who can last longest without performing autoerotic activities). They use they honour method.

Re: Com Counter Display

Posted: 18 Dec 2012, 00:12
by smoth
Jools wrote:There is no foolproof way of making a decoy that lua cannot detect. We have the same problem as in Seinfeld in 'the contest' (about who can last longest without performing autoerotic activities). They use they honour method.
gadget tables widgets cannot access.

Re: Com Counter Display

Posted: 18 Dec 2012, 11:44
by gajop
smoth wrote:
Jools wrote:There is no foolproof way of making a decoy that lua cannot detect. We have the same problem as in Seinfeld in 'the contest' (about who can last longest without performing autoerotic activities). They use they honour method.
gadget tables widgets cannot access.
there are limits to that:
1) you must have one unitdef
2) units must have the same base stats (hp, dmg etc.)

only way to use those tables would be to create a special gadget-side modifier for dmg taken/produced by those decoy units

Re: Com Counter Display

Posted: 18 Dec 2012, 13:27
by Jools
But how will that gadget distinguish those units from each other? Or you keep a gadget table alive each game about what unit is real and what is decoy?

Re: Com Counter Display

Posted: 18 Dec 2012, 17:15
by smoth
gadgets can speak to widgets.

Re: Com Counter Display

Posted: 18 Dec 2012, 18:54
by klapmongool
Posting cos interested in more developed version.

Re: Com Counter Display

Posted: 18 Dec 2012, 19:00
by Jazcash
klapmongool wrote:Posting cos interested in more developed version.
Don't worry, I'll update the thread when there is one. I have a lot of uni work to do over Christmas too so I'm focussing more on that atm.

Re: Com Counter Display

Posted: 19 Dec 2012, 02:33
by Forboding Angel
Beherith wrote:Lua has always kinda made decoy commanders obsolete. I dont know if there is a method of hiding the decoy nature of things from the user in widget space, unless we override a lot of luaui.lua.
Not that I have a horse in this race, but I would argue that Nanoturrets are what made decoy comms obsolete.

What I mean by that is this... You coudl easily make a unit that is exactly the same as the regular comm (sans the DGun damage), and ideally it would be a coveted unit (because of the buildpower) and it's ability.

You could even entice it's usage by allowing it to build advanced structures as well, but the sad part is that it's utility is greatly diminished by nanoturrets.

It isn't useless, but it's not useful enough to bother with either.

Re: Com Counter Display

Posted: 19 Dec 2012, 03:07
by knorke
Beherith wrote:Lua has always kinda made decoy commanders obsolete. I dont know if there is a method of hiding the decoy nature of things from the user in widget space, unless we override a lot of luaui.lua.
If a decoyunit has decoyFor tag, can widgets really figure it out that it is a decoy? I would expect that GetUnitDefID and similiar return the decoyFor-ID, not the real one?
If not that is bug imo.

I think most (missing) abilities of decoyunits can be scripted.
eg if a decoy should be unable to shot and you do that by setting changing the reloadstate of the weapon, widget will be able to detect that. (eg healthbar widgets already shows reload progress)
But if you block the weapon in unitscript by returning false in AimWeapon(), widget can not figure that out.

Re: Com Counter Display

Posted: 19 Dec 2012, 14:13
by Jools
I didn't know about the decoyfor tag. That would work. Provided that other qualities are the same, and that would make the decoy a very cheap mobile radar/sonar/capturer/builder.

Re: Com Counter Display

Posted: 19 Dec 2012, 16:13
by Beherith
I apologize for the previous information, it looks like decoy commanders are properly hidden.

Re: Com Counter Display

Posted: 19 Dec 2012, 16:33
by Jazcash
lol, Beh's just a big ol' troll at heart xD