1x1 Casualties widget

1x1 Casualties widget

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

Moderator: Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

1x1 Casualties widget

Post by Anarchid »

So i finally made that little piece of lua that counts how much stuff you lose and how much stuff you kill. It has a lot of limits, though:

- any (enemy) unit that dies within your los counts as kill. No matter the cause.
- any kills that occur outside of los as such (i.e, on radar) don't count (i didn't try hard enough, though i think it should be possible to identify radar blips to units if those units were los-sighted before going radar-only)
- and if in ony other way you find yourself an ally, expect things to go gebork.

Also, it needs chili. So basically is limited to gundam, evo, and zk 1x1 games.

I'm just going to leave this here in case anyone wants it.
Attachments
attrition.lua
the wupget itself
(2.99 KiB) Downloaded 115 times
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 1x1 Casualties widget

Post by smoth »

why not make it a gadget, then you won't have the los restriction?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: 1x1 Casualties widget

Post by Anarchid »

Obvious, i want to use it when playing ZK games :D

It's an user-side widget, in other words, not game-designer one.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 1x1 Casualties widget

Post by smoth »

Lol, no worries, I can see that as a good reason.
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: 1x1 Casualties widget

Post by luckywaldo7 »

Sorry to keep semi-off-topic-ing this direction, but I would love you if you made a gadget version. Particularly I am interested in getting quick stats when I'm watching replays of games I lose, to see where I stand eco-wise or army-wise.

Some interesting stats would probably current resource income, total resource income, current army value, current damage dealt, and the like.

Also useful for commentators. :D
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 1x1 Casualties widget

Post by smoth »

waldo the gadget would have to be a part of said game..

gundam already has that. I just have not done the scoreboard yet.
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: 1x1 Casualties widget

Post by luckywaldo7 »

Good thing I have svn access then! :D

He could probably get access himself pretty easily if he pokes Licho.

Cool if its in Gundam though. You have a lot of nice things in there, especially chili, that I need to get around playing with anyway.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 1x1 Casualties widget

Post by smoth »

Feel free to ask for me to setup any kind of script.luaui calls for widget if you need em. I cannot promise I will add them but hey, I can try and accomodate.

Code: Select all

				-- Spring.Echo("PassStats",team, 
					-- "playerKills[team]", playerKills[team],
					-- "playerDeaths[team]", playerDeaths[team],
					-- "playerDamageTaken[team]", playerDamageTaken[team],
					-- "playerDamageDealt[team]", playerDamageDealt[team])
This is a block I eventually planned on working on sending. I have not YET covered these parts and planned on breaking them up into seperate calls but here you go, a few I have not finished yet

Code: Select all

playerScores[msg], 
playerExperience[msg], 
playerLevelRank[msg])
I have these already done and in the UI in the PassScores call if you wanted to know
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: 1x1 Casualties widget

Post by klapmongool »

luckywaldo7 wrote:Sorry to keep semi-off-topic-ing this direction, but I would love you if you made a gadget version. Particularly I am interested in getting quick stats when I'm watching replays of games I lose, to see where I stand eco-wise or army-wise.

Some interesting stats would probably current resource income, total resource income, current army value, current damage dealt, and the like.

Also useful for commentators. :D
IceUI gives those stats and more. When you are a player from your entire team, when you are a spec from everyone.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: 1x1 Casualties widget

Post by Google_Frog »

Spectators can see Widget:UnitDestroyed for all units so a spectator widget is fairly easy to do.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: 1x1 Casualties widget

Post by Anarchid »

I wonder if there is any way to determine when a ghosted building was busted outside of LOS in a non-spectator widget-based way.

Also, does anyone know if radar blips and los-sighted units share same uID? Or to detect when blips get killed?
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: 1x1 Casualties widget

Post by Niobium »

Anarchid wrote:I wonder if there is any way to determine when a ghosted building was busted outside of LOS in a non-spectator widget-based way.

Also, does anyone know if radar blips and los-sighted units share same uID? Or to detect when blips get killed?
You can use :UnitEntered/LeftRadar in the same manner as :UnitEntered/LeftLos to track radar dot death. You'd also need to add some unit def id storage if you want to do anything like costing when a radar dot dies.

uID = Unit Id. Specific to unit, never changes.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: 1x1 Casualties widget

Post by Licho »

Tbh i would like some sort of general "stats" like economy comparison or combat performace so far..

yes it gives away some information but i think it could improve gameplay - especially in FFA (and make people quit sooner)
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: 1x1 Casualties widget

Post by Anarchid »

uID = Unit Id. Specific to unit, never changes.
I guess then my idea was right, but i did it wrong. Less alcohol next time!

(my suspicions were that maybe blips don't have uid's of full units, or that radar-callins would not detect kills. going to try enhancement this week)

On a side note, does that mean that if an unit was once spotted by LOS and then after a long delay emerges from some other point in space as a radar blip, we get to know it's unit type?
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: 1x1 Casualties widget

Post by Niobium »

Anarchid wrote:On a side note, does that mean that if an unit was once spotted by LOS and then after a long delay emerges from some other point in space as a radar blip, we get to know it's unit type?
Yes. This is what ghost radar uses.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: 1x1 Casualties widget

Post by CarRepairer »

Before you say it, yes it's considered a bug. Here's a suggestion I once gave to fix it. I can still hope it's implemented one day. http://springrts.com/phpbb/viewtopic.ph ... 60#p411160
User avatar
Johannes
Posts: 1265
Joined: 17 Sep 2010, 15:49

Re: 1x1 Casualties widget

Post by Johannes »

The game end screen already has pretty exhaustive stats - how doable would it be to bring that screen to spectators midgame? By widget or engine change, I don't care. Players ofc shouldn't get it.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 1x1 Casualties widget

Post by smoth »

It can be done, no one wants to.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: 1x1 Casualties widget

Post by Beherith »

Code: Select all

Spring.GetTeamResources

 ( number teamID, string "metal" | "energy" ) ->
   nil | number currentLevel,
         number storage,
         number pull,
         number income,
         number expense,
         number share,
         number sent,
         number received

Spring.GetTeamUnitStats

 ( number teamID ) ->
   nil | number killed,
         number died,
         number capturedBy,
         number capturedFrom,
         number received,
         number sent

Spring.GetTeamResourceStats 0.82 and later

 ( number teamID,  string "metal" | "energy" ) ->
   nil | number used,
         number produced,
         number excessed,
         number received,
         number sent

Spring.GetTeamStatsHistory

 ( number teamID [, number startIndex [, number endIndex = startIndex ]]) ->
   nil |
   number cur_max_index |
   {
     [1] = {
       "time"             = number,
       "frame"            = number,
       "metalUsed"        = number,
       "metalProduced"    = number,
       "metalExcess"      = number,
       "metalReceived"    = number,
       "metalSent"        = number,
       "energyUsed"       = number,
       "energyProduced"   = number,
       "energyExcess"     = number,
       "energyReceived"   = number,
       "energySent"       = number,
       "damageDealt"      = number,
       "damageReceived"   = number,
       "unitsProduced"    = number,
       "unitsDied"        = number,
       "unitsReceived"    = number,
       "unitsSent"        = number,
       "unitsCaptured"    = number,
       "unitsOutCaptured" = number,
       "unitsKilled"      = number
     }, ...
  }

if called with just teamID as argument it returns the current possible range for startIndex/endIndex :={1..cur_max_index} 
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: 1x1 Casualties widget

Post by Jools »

Licho wrote:Tbh i would like some sort of general "stats" like economy comparison or combat performace so far..
Why don't you use Ecostats? It does just that: compares m and e income, army hp, buildpower ... on team basis. It even has one player mode and one spectator mode.

http://widgets.springrts.de/index.php#193

Not saying you can't make more versions of it though, more is always more.
Post Reply

Return to “Lua Scripts”