Forums » Community Projects

The Honk Plugin

Aug 13, 2010 Pizzasgood link

1.6: Added workaround for honking while flying a named Trident.
1.5: New audio for Greyhound, Teradon, HAC, and Connie.
1.4: New audio for Trident.
1.3: New audio for Valks, slightly tweaked audio for Proms and Vults.
1.2: Added audio for all ships, made minor improvements to code.
1.1: Fixed bug when ship name is not visible.
1.0: Initial version.

So, the other day I was flying an XC, and thinking about how it has no weapons. I thought that it really ought ought to have something goofy hooked up to the triggers to make up for it, such as a horn.

Not being the type to sit around waiting for things that probably won't happen on their own, I got my hands dirty, and now we have what I imaginatavely named "The Honk Plugin".

Now the cool thing is that this isn't just for the person using it. I have it set up so that when you honk (by either using /honk or emoting "/me honks" (in sector chat)), anybody in the sector who has this plugin installed will hear you. Interestingly, you don't technically need the plugin to send a honk, only to hear it. I.e. the trigger is simply anybody emoting "honks" in sector chat. The plugin watches for that string to come up as an emote, and plays the sound.

The volume of the honk will be attenuated based on the distance to the honking person, so that when you or somebody up close to you honks, it will sound louder than when that random guy who drifted out of radar range honks.

The specific honk sound is dependent on the ship piloted by the honker. Currently there are only three of them - one for moths, one for centaurs, and one (annoying) one for everybody else. I eventually intend to get more of them, and hopefully also a fog-horn to use for when you're inside a capship. But right now, my short attention span says that I need to go make explosions before doing any more work.

(If you have or find good honks that are free to use, great, let me know. Be sure to include a link to their source website to confirm they're legit though, or I won't consider bundling them with the plugin. Of course you can still use them yourself, that's all up to you.)

If you look at the code you'll see it's fairly simple. There are some variables up near the top that you can use to adjust the volume levels. There is also an alternate attenuation scheme (asymptotic vs. the current linear) that can be swapped in. This isn't the most elegant code I've ever written, and will be improved when I get around to it.

(Yes I do eventually intend to add a GUI so that you don't have to manually edit the code to adjust settings. But like I said above, my attention span says I have to do other things first.)

One potential problem is that people might spam the honk, which could be pretty annoying, especially with the one for non moths/taurs. I haven't used ignore, so I don't know if it also works for sector chat or only global, but if it works for sector, it ought to block those people from honking at you as well. If not, let me know and I'll add some code to this to have it pull from your ignore list to block them.

Please do make comments and suggestions and stuff.
Aug 29, 2010 Pizzasgood link
Updated to 1.2: Added audio for all ships, made minor improvements to code.

I tried to choose audio files that have character matching the ships they represent. Some worked out pretty well. Some are rather bland, just another car honk. Maybe someday I'll replace them.

The audio for the Valkyrie in particular is crappy. What I want to do is get a musical honk that does a few notes from "Ride of the Valkyries". I intend to install a midi editor in the next week or two, so when I do I'll see if I can put something together.

The prom's also feels a little underpowered. I might have to play with it a little bit.

Have fun.
Aug 29, 2010 meridian link
The reason your searches fail when the ship name has a hyphen is because it is a special character for pattern matching. To search for a hyphen, use: "%-". You can also disable pattern matching by passing a value of TRUE as the fourth argument to string.find()
Aug 30, 2010 Pizzasgood link
Yeah, I figured it was something like that. Tried escaping it with \ but it didn't work, so I just used 88 instead of 'EC-88'. I was going to go back and look up how to make it treat the hyphen as a normal character but then I forgot. Thanks.
Sep 16, 2010 Pizzasgood link
Version 1.3 is up. It has a more appropriate honk for the Valkyrie. I also beefed up the honk for the Prometheus, and reduced the delay between honks for the Vulture. I wanted something more vulture-like for the Vulture, but couldn't find anything that fit with the rest, so this will have to do for now. Otherwise I'm pretty satisfied with these now.

Of course if anybody has any issues with them, let me know and we can try to find more interesting alternatives.

Probably the main thing left that's bugging me besides the lack of a gui to adjust volume and attenuation (which I'll do once I figure out how to make VO guis) is that each honk is always the same. Maybe I'll use sox to make some variations of them so that it can have a bit more variety.
Dec 10, 2011 Pizzasgood link
Uploaded 1.4, which adds a honk for the Trident.
Jan 21, 2012 Maxiom link
Kinda silly but could you add party whistles for turrets with pilot able to enable/disable. ;)
Jan 21, 2012 Pizzasgood link
So that gunners could /whistle? Maybe. I'm not sure if I can determine which ship the turret pilot is inside, to find the distance and use the right amount of attenuation. Can't make the captain enable/disable either, not in a practical way. It could be optional on the player side, as to whether you hear people doing it. You'd still see them doing it though, but I think I could add an optional filter to let you not see them (and I could make one for the normal honks as well, for people who just want to hear it without seeing who actually did it).

I just started playing Skyrim though, so I might not get around to it for a while ;)
Mar 30, 2012 look... no hands link
the hound should have the general lee horn
Jun 08, 2013 raybondo link
Jun 08, 2013 Pizzasgood link
This has been updated to 1.5. It now has a unique honk for the Greyhound, and I preemptively added honks for the Teradon, HAC, and Connie. I'm not entirely satisfied with them so they might get altered sometime, but now at least it will have something to play if, say, a dev is piloting a HAC and tries to honk.
Jan 24, 2014 jordanmorgan14f link
How do you make a custom honk? I tried swapping the sounds for my own ogg but the honk I silent.
Jan 24, 2014 Pizzasgood link
Make sure the file is named honk.ogg (all lowercase) and that the bitrate is 44.1k. If those are both correct and it's still not working, post the file somewhere and I'll see if I can figure out what's up.
Jan 26, 2014 jordanmorgan14f link
I figured it out. I wish there was a way for the honk to be the same on everyone else's but I know that they would have to have the same sound. Aw well. Still cool.
Feb 02, 2014 Pizzasgood link
Updated to 1.6. The devs changed the functions for getting the name of the ship you're in, so that now they return the custom name if you're flying a named Trident. This of course broke Honk. I added a workaround for now, until the devs get around to adding a new function to let us get the actual name of the type of ship.

The workaround I used is that if Honk can't figure out what ship you're in, it now just assumes you're in a Trident.