• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Plugin tutorial/starter guide

Status
Not open for further replies.

eejin

Tool Moderator
Level 12
Joined
Mar 6, 2017
Messages
221
Ok, i managed to write a basic plugin template with that, thank you. Now I'm wondering if there is some additional documentation anywhere. I would like to add a new menu item to the menu bar of the main window. I suppose I need to use the hooks library part of SharpCraft, but I couldn't find any info on that, neither on the official subforum, nor the gitlab page.
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
I am slowing working on a tutorial. I might make a small "Hello World" example just to get people started, and then some better tutorials when I have the time.

I'm adding the same steps as I did in the private message, just so other people can see it.

First off, I would download a fresh copy of WEX.
In Visual Studio, you need to create a C# Library Project, since you need to make a DLL file.
You need to make sure this project is set to only build for x86 and not AnyCPU.
After you've done that, you need to add a reference to the SharpCraft.Framework.dll, which is in the root of the WEX bundle.
You also need a reference to the MindWorX.War3Editor plugin dll, which you can find in "profiles\Warcraft III - World Editor (WEX)\plugins".
With those things in place, you're ready to create your own plugins. You'll need to add the following piece of code.
C#:
internal class MyPlugin
{
    [Export(typeof(InitializeDelegate))]
    public void Initialize()
    {
        /* this gets called when the plugin is loaded, immediately after the editor starts */
        Log.Information("Hello from MyPlugin"); // you can find this in the logs afterwards
    }
}
Once you've built your plugin, just place the resulting dll in the "profiles\Warcraft III - World Editor (WEX)\plugins" folder, and it should work.
 
Status
Not open for further replies.
Top