Forums » Community Projects

NationWar Announcer Plugin

Jul 30, 2011 Pizzasgood link
nationwar-1.3.zip
md5sum

This is just a simple plugin I put together to help me with running Nation War. It lets me easily give the "20 minutes to nation war, yadda yadda" announcement, has a rule-spamming function, and can provide a countdown as well. I'm posting it partly so that whoever takes over hosting Nation War when I'm done can benefit, and partly as a template for people who host other events to hack away at to make their own lives easier.

This plugin was written with my alternating valk ban in mind. If I tell it which number the current war is, it includes the number in the announcement and also automatically says whether or not valks are allowed based on whether the number is odd (allowed) or even (forbidden). It also defaults to a twenty million credit prize and uses Sedina D-2 as the location and 20:30 UTC as the time. All those things can be changed per-instance in-game via commands, though to change the defaults you'd have to edit the plugin (it doesn't bother trying to save anything).

If you simply run "/nationwar", it will give the normal spiel about how long it is until it starts etc., automatically computing the time. It also accepts the following parameters:

/nationwar number 274
* Sets which number the war is (and by extension, whether or not valks are allowed)

/nationwar loc "Sedina D-2"
* Sets the location

/nationwar start 20.5
* Sets the starting time in hours UTC. If you want to use an intermediate time, such as 20:30, consider the minutes as a fraction of the hour. So 20:30 would be given as 20.5.

/nationwar prize "20 million"
* Sets the number of credits announced as the prize. Note that it assumes the prize will be credits, so you just input a string describing how many. If you wanted to use something else as a prize (e.g. capship parts), you'd need to edit the plugin.

/nationwar valk
* Specify that this war will permit valks.

/nationwar novalk
* Specify that this war will not permit valks.

/nationwar go
* Initiate the countdown in sector chat, terminated with "GO!!!"

/nationwar abort
* Abort the countdown and notify the sector that the countdown was aborted. This can also abort the rules spam as well, though it would still say "Countdown ABORTED" to the sector.

/nationwar chan 100
* Sets which channel should be used for the announcements and rules spam (to use sector chat, give it "T"). It does not need to be your active channel, though you do need to be listening on it.

/nationwar warn
* This is the default action that happens if you don't provide any parameters.

/nationwar demo
* This works like "warn", except instead of broadcasting it over chat it simply prints it in your own chat window so that you can proofread it and what-not without bothering people.

/nationwar print
* This outputs a list of the current settings. It does not send anything over chat.

/nationwar rules
* This prints out the rules to whatever channel the plugin is set to use, 100 by default. For courtesy you may want to direct newbies to join a different channel and send them the rules on that one, because it can be rather spammy. Or get them into your local sector, and set the channel to "T" so it spams to sector chat.
Jul 30, 2011 lazypc link
Thanks a lot, more complicated then I was thinking it to be, I figured you used separate simple plugins for the different functions. But a very good base to try to build what I had in mind for the various races.

Thanks again.
Jul 30, 2011 Pizzasgood link
Yeah, eventually I'm going to need to go through my plugins and break them apart into libraries to reduce some of the cross-plugin repetition I'm beginning to get.

I forgot to document this, but the broadcast() function will interpret "\n" as a newline, or if you have text between quotes that spans actual real lines in the file, place a "\" at the end of the line as in the rules() function. It will skip empty lines, btw.
Oct 17, 2011 Pizzasgood link
Updated to 1.2. Only significant changes are a few minor fixes to the time calculation so that it doesn't say goofy things like "0 hour" or "1 minutes", and the addition of a reminder that observers are restricted to the ec-88 and ec-89, since newbies who haven't read the rules yet like to show up and observe from time to time and I get tired of yelling at them.

It does still potentially say things like "-0 minutes until....." if you run it at or after the set starting time. I'm not very concerned by that.

I probably won't be making any other upgrades to this plugin now that I'm done hosting nw, unless somebody finds some bugs. But if anybody wants to expand on the functionality or whatever and has questions, feel free to ask.

EDIT: Oh, and this is on voupr.com now as well.
Oct 17, 2011 Keller link
Now all you need to get the fighters to rig with a leader plugin to this one which provides realtime announcement updates on the progress of the fights.

The fighter's plugins send PM updates to the announcer, which determines what kind of statement to broadcast based on the level of damage, how much armor is left, which team he's on, etc.

"Oooo...that must have hurt"
"He's on the ropes now!"
"KO'd! Only 2 left now."

Things like that.
Oct 17, 2011 Pizzasgood link
I probably won't ever get around to doing a commentator plugin. I do like silly plugins, but I have enough half-finished projects as it is :)

Also, it would probably be better to just have a single plugin that watches the data targetless collects, to keep things simple for participants and leaders. It wouldn't be able to tell who dealt the damage that way, but it could still see who is taking it, as long as they're in range. It could be probability based, with higher damages, lower health, and scarcity of teammates effecting a higher probability that a comment is made...

I can't believe I just used the verb form of "effect". I probably need to get out more :|
Nov 20, 2011 Pizzasgood link
I screwed up making the zip for 1.2 and only zipped the folder, without the files. Just corrected that now.
Nov 23, 2011 Keller link
I've done this. Last time was about a year ago when I'd built something for PA and extensively tested it. Went to deploy the zip to the PA forum. Felt really good because I'd worked hard and built the thing. First response to my forum thread was basically "Umm....Keller. Where're the files?" ;)
Jul 30, 2014 Pizzasgood link
Updated to 1.3

Defaults to 20 million
Defaults to 20:30 UTC

Countdown now starts at 5

Chat delay increased to 1300 ms (therefor countdown is 6.5 seconds long)

If an announcement is made at go-time, it now says "It is now time for Nation War" instead of "-0 minutes until..."

Just ignore the valk and number feature. If you want to use the numbers, edit the plugin and either hardcode the valk setting to true, or just remove the bit that uses it. (Might be worth altering references to valks to tridents, though.)