• 🏆 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!

SharpCraft, a managed replacement for Reinventing the Craft

Status
Not open for further replies.
Level 4
Joined
May 25, 2009
Messages
100
And how does this work? The map is changed for one player only (the host) and the other players can join during the game?

Because the multiplayer is basicly singleplayer with emulated multiplayer you can change the map for everyone like in the rexxar campain e.g. after a cinematic. And when everyone loaded the map they connect to the host again. Or, if you don't use MapPlugins, they don't even have to reconnect.
 
Level 25
Joined
Feb 2, 2006
Messages
1,689
Could somebody make an example map? I am quite busy right now but if this works it would be really awesome. We could create massive multiplayer campaigns. Besides the 2 Player campaign of Warcraft III would not have to be rehosted everytime/save codes would be obsolete.

edit:
I'd like to use this to detect OpLimit etc. Does SharpCraft somehow support loading MPQs like JNGP with loadmpq.lua?
 
Could somebody make an example map? I am quite busy right now but if this works it would be really awesome.

You could take a look at this:

http://www.hiveworkshop.com/forums/...ultiplayer-demo-increase-player-limit-277168/

It would require some modifications to support multiple maps, but it can give you the idea.

Alternatively maybe there's a way to load a new map on battle.net with Sharpcraft, but I don't know. It would also require the other players to have Sharpcraft.

edit:
I'd like to use this to detect OpLimit etc. Does SharpCraft somehow support loading MPQs like JNGP with loadmpq.lua?

Yes you can manipulate MPQs. SharpCraft gives us access to Storm.dll.

You can basically do anything you could if you were programming an application.

Although it will require to know how to use C# otherwise you will have to rely on others to make natives for you and even then you can't accomplish everything.
 
Level 25
Joined
Feb 2, 2006
Messages
1,689
ok thx for the answers. I don't think it would be a problem if others would need SharpCraft too since I do distribute a mod anyway.

Are the JassDebugger errors printed ingame on the screen or logged on the logging window?

It would be useful to have a predefined config file where you can list MPQ archives which should be loaded. Otherwise I will have to write a plugin myself as you said.
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Are the JassDebugger errors printed ingame on the screen or logged on the logging window?
It is currently printed in-game, although I could make this a configuration detail.

It would be useful to have a predefined config file where you can list MPQ archives which should be loaded. Otherwise I will have to write a plugin myself as you said.
What would loading the MPQ do, compared to just importing the files regularly? Is it to share one MPQ between several maps?
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Yes exactly. My mod uses one custom MPQ. Therefore it would be really useful.
If I can find out how they inject high priority MPQs, I might be able to make something simple to help with this.

Can you make a tutorial about hooking into natives and creating triggers?
Hooking into natives is simple, simply add a new native with the same name. Do note that there can currently only be one hook, but I hope to improve this later. What do you mean by creating triggers?
 
Level 4
Joined
May 25, 2009
Messages
100
A while back you teased this. But it doesn't work :(

C#:
...
    private void Script_PostMain()
    {
        var trigger = JassTrigger.Create();
        trigger.RegisterPlayerEvent(JassPlayer.FromIndex(0), JassPlayerEvent.EndCinematic);
        trigger.AddAction(new Action(this.ESCAction));
    }

    private void ESCAction()
    {
        Trace.WriteLine("ESC");
    }
...
Another teaser for a long requested feature...
 
Level 8
Joined
Nov 29, 2014
Messages
191
If I can find out how they inject high priority MPQs, I might be able to make something simple to help with this.
This is what I use in my launcher:
Code:
typedef bool (CALLBACK* SFileOpenArchive)(const char* szMpqName, DWORD dwPriority, DWORD dwFlags, HANDLE* phMPQ);

void LoadMpq(char *mpqname)
{
        UINT priority = 0x10;
	HANDLE hMPQ;

	SFileOpenArchive OpenArchive = (SFileOpenArchive)((DWORD)GetModuleHandle("game.dll") + 0x006EB57C);
	if (!OpenArchive)
		MessageBox(0, "Could not find SFileOpenArchive", 0, 0);

	if (!OpenArchive(mpqname, priority, 0, &hMPQ))
		MessageBox(0, "Could not open archive", 0, 0);
}
And you need to do this before each .mpq loading:
priority++
 
Level 25
Joined
Feb 2, 2006
Messages
1,689
It would be helpful if I use SharpCraft one day for my mod to have this feature since I would have to release one exe which loads SharpCraft and my MPQ. If all synchronization would work with SharpCraft players could login via custom servers during the game does already run. That would be awesome for an RPG!
 
Level 4
Joined
May 25, 2009
Messages
100
It would be helpful if I use SharpCraft one day for my mod to have this feature since I would have to release one exe which loads SharpCraft and my MPQ. If all synchronization would work with SharpCraft players could login via custom servers during the game does already run. That would be awesome for an RPG!

I startet making my own Server for Sharpcraft. But's is more like a proof-of-concept at this point. But feel free to try it out!



@Tinker:
Is it possible to add like a OnGameUpdate()-function in the plugins? I don't feel save with a 0.01-Timer :D
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Is it possible to add like a OnGameUpdate()-function in the plugins? I don't feel save with a 0.01-Timer :D

I've been on the lookout for this for a while, but so far without luck. The thing is, it needs to be on the same thread as the Jass VM. If it isn't, things won't work properly. But when I find it, I'll make sure to release as soon as possible.
 
Level 3
Joined
Mar 31, 2015
Messages
28
and then replace the included SharpCraft with the latest version.

Can you tell me how to exactly that in idiot-proof terms? JNGP207 has folder "SharpCraft" with files and "plugins" folder while SharpCraft-4.0.0.137 has at least four different folders and files outside them as well.

I realize it sounds like a dumb question but I can't figure it out. Can you explicitly explain what to do (like "copy contents of folder X into location Y")?

Thanks in advance.
 
Can you tell me how to exactly that in idiot-proof terms? JNGP207 has folder "SharpCraft" with files and "plugins" folder while SharpCraft-4.0.0.137 has at least four different folders and files outside them as well.

I realize it sounds like a dumb question but I can't figure it out. Can you explicitly explain what to do (like "copy contents of folder X into location Y")?

Thanks in advance.

The attached archive should work.
 

Attachments

  • jassnewgenpack207.zip
    10 MB · Views: 99
Level 3
Joined
Mar 31, 2015
Messages
28
The attached archive should work.

First of all, thank you.

I copied natives from here.

I opened map in JNGP editor, SharpCraft is set to Enabled. However when I press "Test" it doesn't start the game (just minimizes the editor).

When I start the game with SharpCraft .bat file (Start game windowed) it does start the game, but it won't open map (returns me to the map selection screen when I start game).

Although it seems to load plugins just fine.


What am I missing?
 

Attachments

  • debug.log.txt
    2.8 KB · Views: 174
First of all, thank you.

I copied natives from here.

I opened map in JNGP editor, SharpCraft is set to Enabled. However when I press "Test" it doesn't start the game (just minimizes the editor).

When I start the game with SharpCraft .bat file (Start game windowed) it does start the game, but it won't open map (returns me to the map selection screen when I start game).

Although it seems to load plugins just fine.


What am I missing?

The natives in that thread are outdated, use these ones.
 
I don't get Watchtimer to working.

JASS:
native StopwatchGet takes nothing returns integer
native StopwatchFree takes integer return nothing
native StopwatchElapsedMilliseconds takes integer returns real
native StopwatchElapsedSeconds takes integer returns real

^These from the second post natives got some syntax errors, it should be something like:

JASS:
native StopwatchGet takes nothing returns integer
native StopwatchFree takes integer id returns nothing
native StopwatchElapsedMilliseconds takes integer id returns real
native StopwatchElapsedSeconds takes integer id returns real

Editor keeps minimizing when trying to test the map with these natives declared and sharpcraft enabled.

Also with starting the game (debug) directly from SharpCraft folder and testing the demo map doesn't work. I don't know what to do.

That's the debug log, nothing interesting: Debug.PNG

Edit:

Today I realized the new natives are not even highlighted ot suggested by default, but old ones are -- I used the version TriggerHappy attached some posts above.
 
Last edited:
Level 2
Joined
Feb 22, 2015
Messages
13
How exactly natives have to be initialized? I tried both replasing common.j and writing into maps headline, neither works. Map just doesnt start, but gets saved in JNGP w\o errors.
WC3 1.26 eng, SC 4.0.0.136. I tried the same code with 1.27\137 (after recompiling with new references, of course) and got the same result.

native Time takes nothing returns string
C#:
using System;
using TinkerWorX.SharpCraft;
using MindWorX.SharpCraft.Modules.JassAPI;

namespace TestPlug
{
    [Requires(typeof(JassAPIPlugin))]
    public class MyClass : IPlugin
    {
        private delegate JassStringRet TimeProt();
        public void OnGameLoad(PluginContext context)
       {
       }
       public void Initialize(PluginContext context)
       {
           Natives.Add(new TimeProt(Time));
       }
       JassStringRet Time()
       {
           return DateTime.Now.ToString();
       }
   }
}
JASS:
function Trig_aaa_Actions takes nothing returns nothing
local string msg = Time()
call DisplayTextToForce(GetPlayersAll(),msg)
// Doesnt work without local variable either, just added it so I can easier turn it on\off
endfunction

//===========================================================================
function InitTrig_aaa takes nothing returns nothing
  set gg_trg_aaa = CreateTrigger(  )
  call TriggerRegisterAnyUnitEventBJ( gg_trg_aaa, EVENT_PLAYER_UNIT_ATTACKED )
  call TriggerAddAction( gg_trg_aaa, function Trig_aaa_Actions )
endfunction

Preparing folders . . .
Done! (0,05 ms)
Loading plugins from 'E:\Games\Warcraft III\plugins' . . .
Locating plugins . . .
File: TestPlug.dll
Type: TestPlug.MyClass
Requires: MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin
File: MindWorX.Modules.Stopwatch.dll
Type: MindWorX.Modules.Stopwatch.StopwatchPlugin
Requires: MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin
File: MindWorX.SharpCraft.Lidgren.Network.dll
Type: MindWorX.SharpCraft.Lidgren.Network.NetworkPlugin
File: MindWorX.SharpCraft.Modules.InputAPI.dll
Type: MindWorX.SharpCraft.Modules.InputAPI.InputAPIPlugin
Requires: MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
File: MindWorX.SharpCraft.Modules.InterfaceAPI.dll
Type: MindWorX.SharpCraft.Modules.InterfaceAPI.InterfaceAPIPlugin
Requires: MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
File: MindWorX.SharpCraft.Modules.JassAPI.dll
Type: MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin
Requires: MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
File: MindWorX.SharpCraft.Modules.JassDebugger.dll
Type: MindWorX.SharpCraft.Modules.JassDebugger.JassDebuggerPlugin
Requires: MindWorX.SharpCraft.Modules.InterfaceAPI.InterfaceAPIPlugin
Requires: MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin
Requires: MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
File: MindWorX.SharpCraft.Modules.WarAPI.dll
Type: MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
Done! (95,95 ms)
Loading plugin assemblies and instanciating types. . .
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Lidgren.Network.dll' for type 'MindWorX.SharpCraft.Lidgren.Network.NetworkPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Modules.WarAPI.dll' for type 'MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Modules.InputAPI.dll' for type 'MindWorX.SharpCraft.Modules.InputAPI.InputAPIPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Modules.InterfaceAPI.dll' for type 'MindWorX.SharpCraft.Modules.InterfaceAPI.InterfaceAPIPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Modules.JassAPI.dll' for type 'MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\TestPlug.dll' for type 'TestPlug.MyClass'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.Modules.Stopwatch.dll' for type 'MindWorX.Modules.Stopwatch.StopwatchPlugin'
Loading assembly 'E:\Games\Warcraft III\plugins\MindWorX.SharpCraft.Modules.JassDebugger.dll' for type 'MindWorX.SharpCraft.Modules.JassDebugger.JassDebuggerPlugin'
Done! (28,40 ms)
Initializing plugins . . .
Initializing MindWorX.SharpCraft.Lidgren.Network.NetworkPlugin
Initializing MindWorX.SharpCraft.Modules.WarAPI.WarAPIPlugin
Initializing MindWorX.SharpCraft.Modules.InputAPI.InputAPIPlugin
Initializing MindWorX.SharpCraft.Modules.InterfaceAPI.InterfaceAPIPlugin
Initializing MindWorX.SharpCraft.Modules.JassAPI.JassAPIPlugin
Initializing TestPlug.MyClass
Native added: Time()S
Initializing MindWorX.Modules.Stopwatch.StopwatchPlugin
Native added: StopwatchGet()I
Native added: StopwatchFree(I)V
Native added: StopwatchElapsedMilliseconds(I)R
Native added: StopwatchElapsedSeconds(I)R
Initializing MindWorX.SharpCraft.Modules.JassDebugger.JassDebuggerPlugin
Done! (11,60 ms)
Done! (142,53 ms)
Installing LoadLibraryA hook @ 0x75C14BF0 . installed!
OnGameLoad plugins . . .
Initializing addresses . . .
Base: 0x0C060000
Done! (1,83 ms)
Initializing functions . . .
Done! (0,48 ms)
Initializing game api . . .
Unknown__SetState: 0x0C221F20 . hook installed!
Jass__Constructor: 0x0C83B4B0 . hook installed!
Done! (2,11 ms)
Initializing input api . . .
WndProc: 0x0C14C940 . hook installed!
Unknown__UpdateMouse: 0x0C3C4C40 . hook installed!
CGameUI__DisplayChatMessage: 0x0C3B5CF0 . hook installed!
Done! (2,85 ms)
Initializing interface api . . .
CGameUI__Constructor: 0x0C6E9D70 . OnGameLoad: System.NotSupportedException: STATUS_NOT_SUPPORTED: (Code: 0)
в EasyHook.LocalHook.Create(IntPtr InTargetProc, Delegate InNewProc, Object InCallback)
в TinkerWorX.SharpCraft.Utilities.Memory.InstallHook[T](IntPtr address, T newFunc, Boolean inclusive, Boolean exclusive)
в MindWorX.SharpCraft.Modules.InterfaceAPI.Interface.Initialize()
в MindWorX.SharpCraft.Modules.InterfaceAPI.InterfaceAPIPlugin.OnGameLoad(PluginContext context)
в TinkerWorX.SharpCraft.PluginSystem.OnGameLoad()
Done! (20,34 ms)
Installing Unknown_SetState hook @ 0x0C402EC0 . installed!
Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'scripts\common.j'
Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'scripts\common.j'
Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'scripts\common.j'


Edit 1: Tried to launch map with clean common.j inserted - everything is okay. Added Time native at the end (without using it in triggers) - map doesnt work. So I definitely add natives the wrong way...

Edit 2: Tried to do it like here, making it local to the map and initialized new native in headline. Trigger is not used. Didnt work either.

Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'plugins\TestPlug.dll'
Native added: Time()S
Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'plugins\TestPlug.dll'
Native added: Time()S
Files
* 'war3map.w3e'
* 'war3map.w3i'
* 'war3map.wtg'
* 'war3map.wct'
* 'war3map.wts'
* 'war3map.j'
* 'war3map.shd'
* 'war3mapMap.blp'
* 'war3map.mmp'
* 'war3map.wpm'
* 'war3map.doo'
* 'war3mapUnits.doo'
* 'war3map.w3r'
* 'war3map.w3c'
* 'war3map.imp'
* 'plugins\TestPlug.dll'
Native added: Time()S

C#:
using System;
using TinkerWorX.SharpCraft;
using MindWorX.SharpCraft.Modules.JassAPI;

namespace TestPlug
{
    [Requires(typeof(JassAPIPlugin))]
    public class MyClass : IMapPlugin
    {
        private delegate JassStringRet TimeProt();
     
        private JassStringRet Time()
        {
            return "kek"; //DateTime.Now.ToString();
        }
       public void OnMapStart()
        {
            Natives.Add(new TimeProt(Time));
        }
        public void OnMapEnd()
        {
     
        }
    }
}
Also your forum doesnt like manual copy-pasting and removes all spaces in code. Forced to use editor feature, which is slower for users like me.
BTW, do I need to use "[Requires(typeof(JassAPIPlugin))]" if I'm using IMapPlugin? JassAPI is initialized by the time map is loaded...
 
Last edited:

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
I admit, it looks like you're doing everything correctly. I'm not sure why it isn't working. Injection can be finicky at times, but the log doesn't indicate that it has run into any problems.

I'm in the middle of rewriting a few core features because of some crashes that have started coming up with some users, including myself, so I can't even try and run the code myself. sorry.

You're right that the Requires attribute isn't needed if it's a map plugin requiring a regular plugin.

I'll get the updated version out ASAP, so you can give it a try.
 
Level 2
Joined
Feb 22, 2015
Messages
13
Tried to use files downloaded by TriggerHappy's MMO launcher, everything works now. There was something wrong with either my warcraft or libraries. Now I only need to make it work on translated wc3.
Unrelated question, does anyone know what files are different between 1.26 and 1.27? I heard that those are only war3.exe and game.dll, is this true?

Edit 1: for some reason, this code crashes the game:
CSS:
string meg = Natives.GetPlayerName(Natives.Player(0));
Any ideas?
 
Last edited:

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Tried to use files downloaded by TriggerHappy's MMO launcher, everything works now. There was something wrong with either my warcraft or libraries. Now I only need to make it work on translated wc3.
Unrelated question, does anyone know what files are different between 1.26 and 1.27? I heard that those are only war3.exe and game.dll, is this true?

Edit 1: for some reason, this code crashes the game:
CSS:
string meg = Natives.GetPlayerName(Natives.Player(0));
Any ideas?
If I remember correctly, it's storm.dll and patch.mpq mostly, but it's been a long time since I checked, since I only work with storm.dll. war3.exe really is just a loader for the most part. Where is that code located? Inside a custom native? Using natives inside the constructor or during Initialize or OnGameLoad doesn't work.
 
Level 2
Joined
Feb 22, 2015
Messages
13
It was in non-native function, which is used by custom native.
Is there any documentation on creating trigger events? I've seen custom native events somewhere, but nothing about creating them.
Also is there a way to look at all possible functions of .dll file?
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
It was in non-native function, which is used by custom native.
Should work, but like I mentioned earlier, it seems something have broken. I suspect an update or security feature in Windows might be the culprit.
Is there any documentation on creating trigger events? I've seen custom native events somewhere, but nothing about creating them.
There really isn't much to it. Make a native that takes a JassTrigger argument and save it in a List and then call the list when you need to.
Also is there a way to look at all possible functions of .dll file?
If you're using Visual Studio, then you can simply right-click the reference and browse it.
 
Level 2
Joined
Feb 22, 2015
Messages
13
I remember there was a big win10 update nearly a month ago, despite my disabled auto-updater. Dunno if it is important.

I'm using SharpDevelop. It takes only 40 Mb (the last time I tried VS it took 4 Gb), it is free and has everything I need (I have noticed only lack of library browsing and automatic interface implementation yet).

Is editor's "On Map Initialization" the same as "OnMapStart"? I noticed that if "OnMapStart" takes some time then the loading screen doesnt show up until OnMapStart end. Native functions work there too. Just curious if default editor works that way too.
Is there a limit for amount of time to finish "OnMapStart" function or I can hold it as much as I want?
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Is editor's "On Map Initialization" the same as "OnMapStart"? I noticed that if "OnMapStart" takes some time then the loading screen doesnt show up until OnMapStart end. Native functions work there too. Just curious if default editor works that way too.
No, OnMapStart is internal. If you want to get something like OnMapInitialization, you can use the Script.OnPreMain/Script.OnPostMain events, they run right before and right after the maps own main function and are in the same thread as the Jass Virtual Machine, so they should be 100% safe.

Is there a limit for amount of time to finish "OnMapStart" function or I can hold it as much as I want?
Nothing that I know of, but Warcraft III will look unresponsive if held too long.
 
Level 2
Joined
Feb 22, 2015
Messages
13
With all of that I can write 0 triggers\code in editor and focus on filling one .dll file with all scripts and it will launch itself, cant I? Or there are still some kind of limitations for that?
 
Last edited:

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
With all of that I can write 0 triggers\code in editor and focus on filling one .dll file with all scripts and it will launch itself, cant I? Or there are still some kind of limitations for that?
The only limitation is reacting to events. I've tried to solve this for a while, but I haven't found a way to do it properly. What I've done in the past is simply replace the Cheat native with my own and then added a tiny bit of JASS code which calls Cheat. So you could have a trigger with the event Unit Enters Playable Area and this trigger just calls Cheat("Unit Enters Playable Area"). In your DLL, you check if the string is equal to "Unit Enters Playable Area", then you know which event it was.

I really hope to add proper event handlers so you can avoid JASS entirely, but so far I haven't been able to.
 
Level 2
Joined
Feb 22, 2015
Messages
13
Is there a way to change item data the same way as ability data? CItem has a bunch of fields but I have no idea what to do with them.
 
Last edited:

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
Tooltips I might be able to do. The thing with tooltips are that they look up a global resource file inside the map, and the data isn't actually attached to the object (item, unit, ability) itself. If I recall correct I did have some successful experiments with overriding this lookup and showing some custom information. The problem however, was that you don't get a handle to the actual owner of the object, like the item handle of the item you're mousing over. At the time my workaround was to check which unit was selected. It wasn't perfect, but it did work for abilities. Not sure how it'd work for items though since one unit could have the same item up to 6 times.
 
Level 2
Joined
Feb 22, 2015
Messages
13
I cant convert JassUnit\Item\Destr into JassWidget and vise versa, so I cant, for example, add special effect on target using previously stored JassUnit. Bug or it is impossible to implement or I have to use the other way?

I'm currently using translated 1.26 warcraft with replaced game.dll and storm.dll from English 1.27 version. Works fine by now. Are there any problems I should expect in future using such approach?

By the way, thanks for answering to my posts.
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709
I cant convert JassUnit\Item\Destr into JassWidget and vise versa, so I cant, for example, add special effect on target using previously stored JassUnit. Bug or it is impossible to implement or I have to use the other way?
What TriggerHappy is suggesting should work. However, there is an implicit conversion operator that should allow you to just pass a JassUnit to a method which takes a JassWidget. I'm not sure this conversion exists for items or destructables though, but then the suggestion TriggerHappy made should work fine.

I'm currently using translated 1.26 warcraft with replaced game.dll and storm.dll from English 1.27 version. Works fine by now. Are there any problems I should expect in future using such approach?
Nothing I can think of, however, it would be great if you mention it if you ever make any bug reports.

By the way, thanks for answering to my posts.
No problem, I'm just happy to see my project being used. :)
 
Last edited:
Level 2
Joined
Sep 17, 2015
Messages
13
Is there any way to access map resources in code (not in jass, in C#/C++)?
I mean like this

I know there are some ways to extract resources from MPQ archives and then use them, but my main point is to use the "current" map (loaded map).

Thanks in advance.
 
Status
Not open for further replies.
Top