Com Counter Display

Com Counter Display

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

Moderator: Moderators

User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Com Counter Display

Post 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.
Last edited by Jazcash on 23 Dec 2012, 22:28, edited 5 times in total.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Com Counter Display

Post by Jools »

Does it count also decoys?
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Com Counter Display

Post 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.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Com Counter Display

Post 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.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Com Counter Display

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Com Counter Display

Post 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?
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Com Counter Display

Post 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
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Com Counter Display

Post 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.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Com Counter Display

Post 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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Com Counter Display

Post 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.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Com Counter Display

Post 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
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Com Counter Display

Post 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?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Com Counter Display

Post by smoth »

gadgets can speak to widgets.
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: Com Counter Display

Post by klapmongool »

Posting cos interested in more developed version.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Com Counter Display

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Com Counter Display

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Com Counter Display

Post 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.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Com Counter Display

Post 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.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Com Counter Display

Post by Beherith »

I apologize for the previous information, it looks like decoy commanders are properly hidden.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Com Counter Display

Post by Jazcash »

lol, Beh's just a big ol' troll at heart xD
Post Reply

Return to “Lua Scripts”