December 15, 2021

My First Plugin (Part 1)

My First Plugin (Part 1)
Some thri

Hey, it's me Jay!

"Whuhhhh?" I hear you all cry as you double take that it's not a post from Therily! Don't click away just yet, as I've got an update on what's been worked on behind the scenes. Peaked your interest? Read on, valiant Sunset Valleyian (working title)!

Guy coding
This is a not a photo of me (Photo by Mohammad Rahmani / Unsplash) for one his desk is super tidy, for two he looks like he knows what he's doing

When we decided to go modded we noticed that there were a few issues with plugins written by different developers - I guess they all have their own clubs, cults or circles that they code in - and the biggest was getting them to talk to one another (the plugins, not the devs... they can do that on their own time). I raised my hand as a wannabe coder and took the mantle to see if we could get something to work. 20,000 lines of going through C# and JSON and I finally have my own plugin to show for it!

So what's my contribution to the betterment of the Valley? Well first we need to look at the two plugins that we needed to co-exist harmoniously: Raidable Bases and Player Challenges. In this multi part post, I'll give you some insight as to what's going on behind the scenes. On with the show!

Player Challenges by k1lly0u (and Smoosher)

You've all seen the much sought after titles popping up in chat, swapping hands between a number of players (usually a few in particular), we thought this would be a fun way for players to track their progress through the wipe.

Obviously Chill has been very busy so far this wipe!

You can pull up the leaderboard by typing /pc into chat, and scroll through the different categories with the buttons at the top. Out of the box there are quite a few, which we went through, and edited the titles for and either enabled or disabled -  Who wants to know about the number of bladed PVP kills on a PVE server anyway?

Currently there are 14 challenges running up for grabs a few of the titles are listed below along which leaderboard you need to top to unlock the title.

  • 420 - Plants Gathered
  • CHAD - APC Kills
  • PETA - Animal Kills
  • Gunsmith - Weapons Crafted
  • Boom Bitch - Bases Raided**

Bases Raided is one of the custom additions I've added as we thought it would be an interesting statistic to track given this wipe's use of Raidable Bases. This required adding a number of elements to the original plugin and it's associated data files to facilitate the triggers from Raidable Bases when you kill the TC.

public void CompletedRaid(Baseplayer player)
	AddPoints(player, Challenges.BasesRaided, 1);
Called when a Raid Base's TC is successfully killed

I hope to be able to move these updates out of the Player Challenges and into a standalone plugin in their own right, but that will be a challenge for another day!

So that's it for my first blog post (ever?!), hopefully you enjoyed the glimpse into what's going on behind the scenes and stick around for the 2nd part of this series on Sunset Valley's plugins where we'll take a look into the absolutely huge Raidable Bases plugin by nivex.

In the meantime, feel free to let us know on the discord if there are any other challenges (and, more importantly, titles) you think would be fun to implement and we'll certainly take a look!