Trade plugin from scratch

Unturned Plugin Development #4

MCrow • 2 months ago

Trade plugin is a plugin that allows players to trade items with each other. I recorded the whole process of creating it from scratch. The video course is more than 6 hours long and covers everything from start to finish.

Before starting the course here are a few things you need to know.

Prerequisites

  • Basic knowledge of C# programming language - without it, you probably won't be able to follow along, but if you have experience with other programming languages, you should be fine
  • Basic knowledge of RocketMod plugin development - although I try to explain everything in detail so you can follow along even if you are new to RocketMod
  • Knowledge of Unturned game - obviously, you need to know how to play the game to understand the plugin development process
  • Visual Studio on your computer - check out first episode of the series to learn how to set up the development environment
  • Unturned Templates for Visual Studio - you can learn about them in the first episode of the series as well

Terms used in the course

I use some terms in the course that you might not be familiar with. Here is a short list of them:

  • Trade Box - I call the storage component and a storage which opens like vault when player uses /trade send or /trade accept commands.
  • Subcommand - A command that is a part of another command. For example, /trade send is a subcommand of /trade.

I will try to expand this list as I receive feedback from you.

Topics covered

The course covers a wide range of topics, including:

  • Harmony patches - For the Trade plugin, I needed to override some game methods like ReceiveDragItem to know what item did the player drag into the trade box and to prevent the player from taking it back.
  • Unity components - I use Unity MonoBehaviour which is a base class for Unity components. I use it to create a trade box and to handle player interactions with it.
  • Unity coroutines - I use Unity coroutines to handle expiration of the trades.
  • RocketMod commands - Although there is only one IRocketCommand in the plugin, it has a lot of subcommands and parameters.

How to ask questions

If you need help feel free to ask questions on Restore Monarchy Discord server in the #forum-discussion channel. Me and other members will be happy to help you.

Video course

Now you are ready to start the course. Find the first episode below and enjoy the learning process. If you have any questions, feel free to ask them on Restore Monarchy Discord server.