Gadget: player has taken the lead with xxx kills

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

User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Gadget: player has taken the lead with xxx kills

Post by Jools »

In OTA there was a message when a player had taken the lead with anumber of kills. Any way to make a similar functionality here? Is this information stored globally?

It was a fun info, because it reminds you to be offensive (most kills wins) and it gives a good picture of what's happening in the game.

Edit: link to gadget
Attachments
ding.zip
A ding sound.
(281.54 KiB) Downloaded 32 times
gui_announce_kills.lua
The lua gadget
(1.97 KiB) Downloaded 121 times
Last edited by Jools on 11 Jul 2011, 16:04, edited 3 times in total.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget request: player has taken the lead with xxx kills

Post by manolo_ »

hi jools,

there is an option in iceui, where u have this player bar (with ressurces,...), there is a tab where u could see the kills and losses. so i assume it should be really easy to generate a message for it
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Widget request: player has taken the lead with xxx kills

Post by Caydr »

Haha, I just remembered this! :mrgreen:

Personally I would love to see an actual textual announcement every time a player takes the lead, with a 5sec or so spam guard. These little touches are what make a game look polished.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Widget request: player has taken the lead with xxx kills

Post by Niobium »

Spring.GetTeamUnitStats
( number teamID ) ->
nil | number killed,
number died,
number capturedBy,
number capturedFrom,
number received,
number sent
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Widget request: player has taken the lead with xxx kills

Post by Jools »

Here, whoever wants can include it in his mod or map. It only needs a global variable called leader, and it should be called from unitDestroyed function.

http://pastebin.com/4pvRDrdv
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Widget request: player has taken the lead with xxx kills

Post by Jools »

It doesnt have a spamguard yet, because I dont remember it to have been spammy in ota, since it only announces when leader changes, not on every kill. Of course in a long standoff it may be spammy.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Widget request: player has taken the lead with xxx kills

Post by zwzsg »

This is very wrong:

Code: Select all

for i,v in pairs(Spring.GetTeamList()) do
	tID = Spring.GetTeamList()[v]
	if v > 0 then  -- a check because for some reason when i = 1, then v = 0 and teamID = nil
It should just be:

Code: Select all

for _,tID in ipairs(Spring.GetTeamList()) do
Because in for i,v in pairs(...)
i is the key and v is the value
So you don't Spring.GetTeamList()[v] but Spring.GetTeamList()
Except Spring.GetTeamList() is already stored in v, so simply use v

Also, table returned by the engine often gets an extra field .n that store their size,
So better use ipairs, which only loops through field indexed by 1 to n, instead of pairs, which would loops through all field and would catch that weird n field.


Anyway, since you also had trouble getting the player names, I retyped the whole gadget (faster than explaining, but less helpful.)
Attachments
taken_the_lead.lua
It's a gadget! It must be included in a mod!
(1.42 KiB) Downloaded 186 times
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Widget request: player has taken the lead with xxx kills

Post by MidKnight »

I have an improvement request! :o

Player has taken the lead messages should also play a random sound file from Quake!
DOMINATING!
WICKED SICK!
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Widget request: player has taken the lead with xxx kills

Post by Jools »

There's nothing wrong with zwzsg's version, but I wanted it to be exactly like in ota, and I added a sound too, so here's a little bit more refined version.
Attachments
gui_announce_kills.lua
It's a gadget and not a widget.
(1.83 KiB) Downloaded 130 times
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Widget request: player has taken the lead with xxx kills

Post by aegis »

that's a gadget
and we can't turn it off
and you want to put it in maps?! D:
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget request: player has taken the lead with xxx kills

Post by manolo_ »

why not as widget?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Widget request: player has taken the lead with xxx kills

Post by zwzsg »

Because widgets can not know when units die out of player's view.
User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: Widget request: player has taken the lead with xxx kills

Post by Karl »

MidKnight wrote:I have an improvement request! :o

Player has taken the lead messages should also play a random sound file from Quake!
DOMINATING!
WICKED SICK!

"TROLLING ACTION!"
"M-M-M-MEGA TROLL!"
"C-C-C-OMBO BREAK!"

That one should better on the current spring players...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget request: player has taken the lead with xxx kills

Post by smoth »

I'll consider adding it to gundam jools.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Widget request: player has taken the lead with xxx kills

Post by Jools »

Go ahead.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget request: player has taken the lead with xxx kills

Post by smoth »

I have not had the chance to look at your code but I can look into adding a type of unit breakdown for the list if you would like :)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Widget request: player has taken the lead with xxx kills

Post by zwzsg »

smoth wrote:a type of unit breakdown
o_O

It just count kills, dude, rambling about unit breakdown list is irrelevant.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget request: player has taken the lead with xxx kills

Post by smoth »

Why not? People love pictures and numbers.

It opens up things like end of game stuff like ZAKU BUTCHER as an award kids love shit like that. My college buddies used to lol about the bs stats and awards at the end of smash brothers matches. So why not!?!
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Widget request: player has taken the lead with xxx kills

Post by Jools »

Only the imagination is the limit of what we can achieve.

My next step would be to make a rank list, like when you pressed F4 in OTA. The counts are already there, all that's needed is a GUI. Someone requested this also.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Widget request: player has taken the lead with xxx kills

Post by smoth »

That will be easy. (no worries I am a huge fan of the kill board as well mang :)
Post Reply

Return to “Lua Scripts”