• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Plugin tutorial/starter guide

Status
Not open for further replies.

eejin

Tool Moderator
Level 12
Joined
Mar 6, 2017
Messages
229
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.
 
Level 21
Joined
Aug 3, 2004
Messages
710
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