A simple widget for self-d alert

A simple widget for self-d alert

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

Moderator: Moderators

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

A simple widget for self-d alert

Post by Jools »

A simple widget for playing a sound when commander is about to self destruct. Plays a "pop" sound when self-d is cancelled. Tested with xta.

Where have the self-d countdown sounds gone anyway?

(NB: it plays a soundfile called siren3.ogg ands pop-wav in folder LuaUi/sounds. Can be changed.)

Edit: changed to filetype to ogg to save space, and to enable stopping the soundstream if self-d is cancelled.
Attachments
siren3.rar
alert sound
(126.94 KiB) Downloaded 11 times
pop.rar
pop sound
(7.09 KiB) Downloaded 14 times
tp_autodestruction_alert.lua
Autodestruction alert
(1.3 KiB) Downloaded 110 times
Last edited by Jools on 12 Jul 2011, 19:11, edited 1 time in total.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: A simple widget for self-d alert

Post by manolo_ »

missing pop-file
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: A simple widget for self-d alert

Post by Jools »

Here it is. I had one already included with spring so I thought it was present by default.

I'd like to set the volume a bit higher, but didn't immediately find out how to. Even tried amplifying the sample with audacity, but no change.
Last edited by Jools on 12 Jul 2011, 19:12, edited 1 time in total.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: A simple widget for self-d alert

Post by Jools »

Hmmm, I didn't test whether every player can hear the sound, I hope not :)
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: A simple widget for self-d alert

Post by Google_Frog »

Jools wrote:Hmmm, I didn't test whether every player can hear the sound, I hope not :)
It's a widget. They can't.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: A simple widget for self-d alert

Post by manolo_ »

i wanted to upload it on the wddb, thats why i asked fot the pop.wav (just to make it complete, dunno if this wave file is included in a blank install-pack)
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: A simple widget for self-d alert

Post by knorke »

instead of manually adding all commander unit names to the list:

Code: Select all

local commDefs =	{
					UnitDefNames["arm_commander"].id,
					UnitDefNames["arm_ucommander"].id,
					UnitDefNames["arm_u0commander"].id,

...
...
you could loop through unitDefs and do

Code: Select all

if (unitDef.isCommander==true) then add to list end
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: A simple widget for self-d alert

Post by Jools »

Yup, that would have been better, then it would work for any mod.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: A simple widget for self-d alert

Post by FLOZi »

Actually it wouldn't, start units don't need to have iscommander.

You could use GetTeamInfo + GetSideData to find the start unit or just catch the first unit spawned for each team using UnitCreated
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: A simple widget for self-d alert

Post by knorke »

start units don't need to have iscommander.
in *A mods, they usually are.

Actually, thinking about it instead of playing a sound it should prevent you from blowing up the commande accidently. ie make you confirm the command a second time.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: A simple widget for self-d alert

Post by Jools »

But sometimes you want to commbomb, and then you don't have time to confirm stuff. No matter how cowardous it is to do so, we can't deny that in some situations it's a smart choice.

But OTA had countdown sounds on self-d, like this: choop, choop, cheep, chiip, chiiip, BOOM.
Post Reply

Return to “Lua Scripts”