• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

any version Upgradability 1.0.0

This resource does not pertain to any specific version of Pokémon Essentials.
In this tutorial I want to showcase what I learned about keeping my project as updateable as possible.

Disclaimer


I am not claiming to be an expert in this area and what I will share here is based on my own experience and exchanges with others like Maruno.
Also, I if you have no idea how to code, this might not be entirely for you, I am afraid.

Plugins


Use them for, well, everything! What do I mean by that? Well, in the newer Essentials versions, they are loaded last, so they would overwrite scripts from base Essentials if there is a conflict.
But I am getting ahead of myself.

Plugins by others


Look at what the plugin does before throwing it in. Do you think you would be able to update it yourself when the need arises? Yes? Perfect, in the Plugin Folder it goes.
TechSkylander1518 has a great tutorial on updating scripts, which fits in nicely here: https://eeveeexpo.com/resources/961/
No? Reevaluate if you really need it. If you do, you can only pray that it will maintained when new versions of Essentials come out.

Plugins by you


Are you afraid of creating a Plugin yourself? Don't be! It is really easy!
All you need to do is to create a Folder in the Plugins Folder, put in your .rb files and a meta.txt. Just look at the meta.txt of any other Plugin to know what you need and how to format it.
What I usually go with is just Name, Version, Essentials and Credits, I need no link since I don't publish my Plugins on here, they are specifically for my projects and of no use to others in that form.

Another neat thing is that you can but folders in your Plugins folder!
For example, I am creating a custom plugin for my current project Pokémon Regrowth. In it, there are 12 folders, ranging from TechnicalChanges over ItemChanges to CompilerChanges.
Even more subfolders are possible, in PokemonChanges I have another folder for GameData for example.

Depending on how extensive your Plugin will probably be, be sure on keeping a tidy hierarchy to know where everything is!

But why do I insist on using plugins?
Of course, you can mark every new or edited script in the Essentials Scripts but wouldn't it be neat if you just open a clean copy of the newest Essentials version, pull in all your Data, Graphics, and, and, and, then just copy and paste your own Plugin in there and be done with moving your changes over?
Well, you'd be far from done completely probably, but you won't have to look for any changes you did manually and redo them. You'd know right from the get-go where you have to look: In your Plugin!

Then comes the biggest task, which would come anyways with upgrading: updating your scripts. For that, look at Marunos changelog in the Essentials wiki, resolve any Exception which pops up and test the distortion world out of your game. But I am hoping you are doing that anyways.

I am afraid since I don't know the scope of your ambitions, I can't tell you how long an upgrade will take you. But using your own, custom plugin, should help you save a lot of time.

Until now I only made suggestions on what you should do, but how? That's where the next section comes in, namely...

How to utilize your own Plugin


You can add to and modify pretty much everything in Essentials!

How?
Let's say we want to give the player a new attribute: charm and initialize it with a value of 2, we can do the following in our Plugin:
Code:
class Player < Trainer   # Just use the same class definition used in Essentials
  attr_accessor    :charm
  
  alias _charm_added_initialize initialize
  def initialize(name, trainer_type)
    _charm_added_initialize(name, trainer_type)
    @charm = 2
  end
end
Done! But what exactly did we do? We added an attribute with both getter and setter already done.
Then we renamed the existing initialize method to _charm_added_initialize, defined a new initialize method, called upon our old one with all given parameters and then set our players charm with @charm = 2.

Now let's say 31 max IV is too little for us.
We could of course change the constant IV_STAT_LIMIT in our Pokemon Script.
Or we just do the following in one of our Plugins Scripts:
Code:
class Pokemon
  IV_STAT_LIMIT = 101
end
This overwrote the constant defined in the base Pokemon script with our new value, because the Plugin is loaded after that, but we won't lose this change if we update to a new Essentials version- given there are no changes on how IVs are calculated in general in base Essentials, but that's what the changelog is for!

And what if we want to change a function drastically? Just overwrite it completely! You can copy the parts you want to keep, but if you have completely new parameters and return values so calling the old function is not useful anymore, just don't bother with aliasing the old function.

I hope this tutorial helps some people newly getting into development wanting to be able to use the boons of a new Essentials version. There is much I'd like to talk about as well, but if something stayed unclear just ask in the discussion section or contact me on Discord, I am very happy to help out!
Credits
None needed
Author
Zardae
Views
1,169
First release
Last update
Rating
4.50 star(s) 2 ratings

More resources from Zardae

Back
Top