Gadget: player has taken the lead with xxx kills - Page 2

Gadget: player has taken the lead with xxx kills

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

Moderator: Moderators

msafwan
Posts: 38
Joined: 16 Dec 2010, 14:44

Re: Gadget: player has taken the lead with xxx kills

Post by msafwan »

You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death. Here's an implementation:
http://springfiles.com/spring/lua-scrip ... myallyself

For message broadcast (eg: "player A has taken lead!!") each widget could be modified to communicate with opposite team's widget to sync its value/correct-deviation... (much like how allyCursor widget communicate with each other). This ensure the value are same across player...
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Gadget: player has taken the lead with xxx kills

Post by SirMaverick »

msafwan wrote:You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death.
2 Problems:
Not all mods have visible wrecks. Wrecks can be made only visible if inside LOS.
Not all dead units leave a wreckage.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget: player has taken the lead with xxx kills

Post by knorke »

gadget to count the kills, widget for display.
i think everything else is just messing around...
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

Yes, the problem with a widget counting the kills is also that it gets reset when LuauI is reloaded, and some people do that sometimes.

Ofc there's also the spring internal method of getting kills/losses:

Code: Select all

Spring.GetTeamUnitStats(TeamID)
But I don't recommend using that method, it doesn't count all kills, it counts kills of cancelled and unfinished units and it counts it as a loss when you place a dragon teeth for instance.

So the gadget that counts kills works well, but the widget side needs to be adjusted. But how does a widget and gadget communicate with each other? They need to be in the same file?
Last edited by Jools on 07 Sep 2011, 04:29, edited 1 time in total.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

msafwan wrote:You can count enemy unit death with metal wreckage. New wreck = new unit death, so filter wreck with 'allyID' to yield enemy unit death.
Interesting: so there is information in the wrecks about what player it belonged to?

This could still be interesting to my statistics widget. It is an widget so it doesnt have information on enemy deaths, but as you become spectator it fills up that information. Maybe using this widget could be more reliable that asking spring for a start value of a players deaths and kills (when you become spec or reload luaui).

Or even better, since the killcount isnt the best measure of efficiency, I'm trying to replace it with a killed-hp count, the maximum healt points of the units you have killed. Maybe this could come in handy there. killed-hp isnt a perfect measure either, but it's better than just kills or dealt damage imo.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Gadget: player has taken the lead with xxx kills

Post by smoth »

Also wreck steps are skipped if the damage is high enough.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget: player has taken the lead with xxx kills

Post by knorke »

But how does a widget and gadget communicate with each other?
Spring.SendLuaUIMsg
this is about something else but same technic:
http://answers.springlobby.info/questio ... t-scorebox
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

There's another way to do this also: use the UnitLeftLOS/Radar callins. If the unit disappeared ( unit position is nil) but it didnt leave radar or los, then it died.

But using a gadget and UnitDestroyed is probably best way still. However, does it catch indirect kills? I mean if I have 50 crawling bombs and someone kills one of them so that the others explode too?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget: player has taken the lead with xxx kills

Post by knorke »

Jools wrote:There's another way to do this also: use the UnitLeftLOS/Radar callins. If the unit disappeared ( unit position is nil) but it didnt leave radar or los, then it died.
what happens on entering jammer, entering water, being transported, morphing?

But using a gadget and UnitDestroyed is probably best way still.
yup.
However, does it catch indirect kills? I mean if I have 50 crawling bombs and someone kills one of them so that the others explode too?
it gives you attackerID...
But yea, needs filtering ie if the unit was complete or just a construction that got destroyed or canceled.
I think dragonteeth trigger UnitDestroyed too etc
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

knorke wrote:what happens on entering jammer, entering water, being transported, morphing?
If jammed then spring will call UnitLeftLOS or -Radar, depending on where is was visible. Not sure about the others. When morphed the unit essentially dies and gets replaced by the morphed unit (new unitID).
it gives you attackerID...
But is the attackerID the enemy or one of the chain exploded bombs?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Gadget: player has taken the lead with xxx kills

Post by smoth »

added a scoring system to grts this weekend. I have added the relevant parts of your kill tracking to it. why are you checking if a unit is completed or not before kill?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Gadget: player has taken the lead with xxx kills

Post by knorke »

why are you checking if a unit is completed or not before kill?
1% build unit gets destroyed -> counts as kill
canceling build process -> counts as kill
reclaiming a nano frame -> counts as kill
etc
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

It seems we need to have a discussion about what is a kill, I didn't think there would be several views about it. Obviously, I don't think those things you mentioned are really kills.

If a tank is, say 1% complete, it's not really a tank yet, and it has no personnel, so if someone bombs it, how can that be counted as a kill? It also has no ability to defend itself (dunno if that's something we should consider).

If a planned construction is cancelled, then that's not a kill. There is no-one killing it. Same thing if something is reclaimed, then it 's reclaimed, not killed.

To me a kill happens when a unit gets destroyed in combat, be it either a military or a civilian one (although spring doesnt distiguish). But this debate is also higly philosophic, basically we need to decide when a unit is a unit. Maybe we can borrow some arguments from the abortion debate:)
Last edited by Jools on 06 Sep 2011, 21:25, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Gadget: player has taken the lead with xxx kills

Post by smoth »

Canceled counts as a kill lol that is fukt up..

So what if it was aborted(killed in the factory)instead of miscarried(canceled)?

Seriously why is that a unit destroyed?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Gadget: player has taken the lead with xxx kills

Post by zwzsg »

How is unnit formed?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

Anyway, killed units is not the best measure of a player's success. I've started to use "killed hp" instead in my other widget, which means weighting the number of kills by the hp the unit has as 100% full health.

It's not perfect, but I think it's better than just "kills" or "damage dealt".
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Gadget: player has taken the lead with xxx kills

Post by smoth »

I like kills though and plan on having that and damage dealt recorded. hell i want to record what you kill and how many, store it locally etc.

have all of it on a lol style leaderboard CUZ I CAN. etc.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Gadget: player has taken the lead with xxx kills

Post by Jools »

That's a nice idea, will be interesting so see how you lay it out graphically. Still, one life is also 1 life so kills is still a good way to count it. Or, whatever way you do it it's not gonna be perfect, because it's not better to kill 20 pyros than 1 goliath, for instance.

Here's how I formatted my kill stats:

Image
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Gadget: player has taken the lead with xxx kills

Post by zwzsg »

I updated a little my gadget:
- Not counting spectator as players anymore
- Printing faction name as well
- Printing "AI" instead of "" for external AI. But reading the proper AI shortName would require a gadget<->widget communication, making the whole thing a bit more complex than just a gadget.

Edit: Thanks to [BoS]nixtux for telling me about a bug that made it crash when playing against AI.
Attachments
taken_the_lead.lua
Tis a gadget, not a widget.
(2.63 KiB) Downloaded 114 times
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Gadget: player has taken the lead with xxx kills

Post by smoth »

bump for knuckleheads in ba subforum.
Post Reply

Return to “Lua Scripts”