====== Change already existing Wolfpack scripts without touching standard scripts ======
I guess you always want to keep updated to Wolfpack script changes (due to bugfixes etc.), but also implement your own changes in standard scripts. So if you edit the standard scripts, there'll be probably an problem everytime you try to update your scripts by using SVN. And to implement these updates in your heavily costumized scripts by hand is always difficult and takes much time.
I'll try to show you this on an example. \\
Let's examine you have a vampire race. This race should not be able to eat normal food. So what would you do? Of course, open your food.py script and implement your code in the onUse function. This would work of course, but as mentioned this could lead to errors when updating your scripts (or you could lose your changes when overwriting this file). There's a better way to do this.
===== First step: Creating needed directory and files =====
Create a new directory in the Wolfpack root, e.g. "myownscripts". In this new directory, create a file named "preload.xml". This file will include all scripts we load before the standard Wolfpack scripts. In your "preload.xml" write the following:
Now we need a file named "overrides.py", also in our "myownscripts" directory. This is our python script, where we will implement our changes done in already existing standard Wolfpack scripts. **(NOTE: You will also need an "__init__.py" file in order to run your scripts successfully (can be empty).)**
===== Second step: Load our new files =====
Now that we have our scripts created (still without function), we need to implement the "overrides" script, so Wolfpack can read it. Script changes (which we want to implement in our "overrides.py") must be loaded before the standard Wolfpack scripts. In order to reach this, you must edit your "wolfpack.xml". Search for the option key "Definitions". You must add your "preload.xml" before the standard "index.xml". So this line should look like that:
This works and you didn't touch the Wolfpack scripts. That's all. Sounds easy, doesn't it?
**Summary:**\\
If you want to change functions, the script including your new functions which overwrites the existing one must be loaded **before** the Wolfpack scripts.
You can implement all your changes in "overrides.py", but in my opinion it would be difficult to differentiate all your changes.
You can easily create more "override" scripts, but don't forget to include them in your "preload.xml"
**Note:**\\
There often need to be functions changed in the Wolfpack scripts in order to implement your own changes (e.g. your change would be simple, but the function is very long). So don't be shy to contact a developer (forum, e-mail) who can split a function into two, so you can implement your changes easily. Don't forget to tell him what you want to change, so he knows what he has to do!