HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Grim Extension Pack

01-13-2007, 01:07 AM#1
PitzerMike
I'm glad to release this pack of three extensions to Vexorian's JASSHelper.
These require Version 0.9.5 of JassHelper or newer.
  • PathMapper post processes the pathing map. With this you can make specific tiles (un)walkable, (un)buildable, (un)flyable and so on.
  • ObjectMerger adds external object editor data to your map. It can be used to include shared object editor data and to distribute systems that require specific object editor data (for example BonusMod).
  • FileImporter imports external files. It can be used to distribute systems that require specific files imported (for example Dummy.mdx) or to mass-import files whithout having to change the path manually for every file (imp file gets correctly updated).

The extension pack is included all distributions of the Jass NewGen Pack, a separate download is not available any more.

Installation

First you'll need Grimoire or WEHelper and of course JASSHelper.

Then just put the files included in this download into your Grimoire or WEHelper directory. You don't need to overwrite SFmpq.dll if it's already there.



Configuration

If you're using Grimoire:

In the [externaltools] section of mapcompiler.conf add these lines:

Code:
"FileImporter","FileImporter.exe"
"ObjectMerger","ObjectMerger.exe"
"PathMapper","PathMapper.exe"

If you'reusing WEHelper:

In the World Editor open the WEHelper menu.
Find JASSHelper in the plugins list, click it and click configure.
Add the 3 tools by typing in their names and the path to the executable.

Now you're ready to use the external tools.



Usage

In your scripts you can now use the following syntax for the extensions:

Collapse JASS:
//! external FileImporter { hard_drive_file_path target_path_in_map }
//! external ObjectMerger w3o_file_on_hard_drive { more_w3o_files_of_same_type }
//! external PathMapper tile_list | check_flag apply_flag [check_mode] [apply_mode]

FileImporter examples:

Collapse JASS:
//! external FileImporter images\icon1.blp CommandButtons\BTNIcon1.blp
//! external FileImporter D:\war3\images\icon2.blp CommandButtons\BTNIcon2.blp icon3.blp CommandButtons\BTNIcon3.blp

Relative paths to the folders defined in [lookupfolders] in mapcompiler.conf
and the folder, where the map is, are automatically resolved.
For better performance you can import more than one file per call, like seen in the second example.
The imported file list gets correctly updated, so after reloading the map you can see the files in the import manager.
It's mainly useful for distributing systems that require files.

ObjectMerger examples:

Collapse JASS:
//! external ObjectMerger my_items.w3t
//! external ObjectMerger my_abilities.w3a D:\war3\more_abilities.w3a even_more_abilities.w3a
//! external ObjectMerger objects\units.w3u

Relative paths to the folders defined in [lookupfolders] in mapcompiler.conf
and the folder, where the map is, are automatically resolved.
You can merge as many files of the same type as you wish, like in the second example.
Allowed object types are w3u, w3t, w3b, w3d, w3a, w3h and w3q.
All files of one call must have the same type, you can't mix w3u and w3a for example.
This is used to distribute systems that require object editor data.
Use the export function of WE to create files that can be merged,
using an MPQ viewer to extract those files is bad because it won't resole TRIGSTR references.
You'll have to close and reopen your map to see the imported data in the object editor.
This one requires VB 6 runtime files (http://www.wc3campaigns.net/tools/weu/RuntimeFiles.exe)
The tool is also capable of id renaming as seen in the Widgetizer before.
An ability with the name Lightning Bolt::Albt for example will be imported with the id 'Albt'. Its name will be changed to just Lightning Bolt.

PathMapper examples:

Collapse JASS:
//! external PathMapper LdrtLgrsLgrd 2 |
//! external PathMapper Ldrt 40 !

The first example makes the map unwalkable where Lordaeron Dirt, Lordaeron Grass or Lordaeron Dark Grass is.
The second example sets the pathing to normal ground where tiles other than Lordaeron Dirt are.
You can look up the tile-ids in TerrainArt\Terrain.slk which can be extracted from War3Patch.mpq.
To be able to use this you will need the following flags table and a few examples:

Code:
0x01: unused
0x02: 1=no walk 0=walk ok
0x04: 1=no fly 0=fly ok
0x08: 1=no build 0=build ok
0x10: unused
0x20: 1=blight 0=normal
0x40: 1=no water 0=water
0x80: 1=unknown unpathable 0=normal

00 bridge doodad
08 shallow water
0A deep water
40 normal ground
48 water ramp, unbuildable grounds, unbuildable parts of doodads
CA cliff edges, solid parts of doodads
CE map boundaries

As you can see the parameter after the tilelist is the flag value and then there's a paramter to
change the check mode and/or the apply mode. Apply modes can be:
  • |: binary or
  • &: binary and
  • ^: binary xor

So in the first example only the no-walk-bit is set with a binary or and nothing else is changed.
If you don't specify an apply mode, the old values are completely replaced by the value you specify.
Like in the second example where it's set to normal ground. Check modes here can be:
  • !: not

In the second example ! is used to change the pathing for all tiles that are NOT in the list.
If you don't set this parameter the normal mode will apply the change for all tiles in the list.

Collapse JASS:
//! external PathMapper CE FD 1 &
//! external PathMapper A F5 0 &

It's also possible to update the path map independant of the tiles.
In the above examples the current pathing value of each point is compared to a mask (the first parameter).
The second parameter again is the new flag value that will be applied. In this case the following check modes are available:
  • 1: all bits that are set in the mask must be set for a point to be updated, other flags may be set too
  • 0: all bits that are set in the mask can be set, but don't have to, other flags must not be set for a point to be updated

The default check mode is that the pathing value of a point must exactly match the specified mask
in order to have the change applied. Change modes are like above and, or, xor, or set by default.
In example one map boundaries are made walkable by removing the no-walk-bit with a binary and.
In the second example areas that have either the no-walk or the no-fly bit set, are made walkable and flyable.



Examples

Collapse JASS:
//! external FileImporter images\icon1.blp CommandButtons\BTNIcon1.blp
//! external FileImporter D:\war3\images\icon2.blp CommandButtons\BTNIcon2.blp icon3.blp CommandButtons\BTNIcon3.blp

//! external ObjectMerger my_items.w3t
//! external ObjectMerger my_abilities.w3a D:\war3\more_abilities.w3a even_more_abilities.w3a
//! external ObjectMerger objects\units.w3u

//! external PathMapper LdrtLgrsLgrd 2 |
//! external PathMapper Ldrt 40 !

//! external PathMapper CE FD 1 &
//! external PathMapper A F5 0 &



Known Issues

You need to close and reopen your map in the editor for the import manager and object editor to update.
But you don't need to, it really doesn't matter if the imported data is displayed or not.

There might be missing TRIGSTR references in your object data, if the object files that the merger
imported had been extracted with an MPQ tool instead of the export function of WE.

01-13-2007, 01:10 AM#2
Av3n
First 1 to know. I'll give it an shot. Oh and fix you vb code abit

-Av3n
01-13-2007, 01:47 AM#3
shadow1500
When it merges the object data does it change rawcode in the script to reference the new generated rawcodes?
01-13-2007, 02:00 AM#4
Vexorian
Nope, It shouldn't either. I think that what pitzermike wants instead is for you to use your own rawcodes since it is possible, for example Abm1 would be bonus mod attack +1, aka you can customize the rawcodes with a hex editor. I actually think that you can use things like 'bma1' or '_bma1'
01-13-2007, 08:48 AM#5
PitzerMike
Vex is right, you should use your own raw-codes in the first place. That's why it also does the id-renaming.
Like when you have an object named Something::Abcd in the external file, it'll
be changed to the id 'Abcd' while being merged. Then you don't need to use a HexEditor. In the script you'd use 'Abcd' in the first place.

The merger will never generate new ids. If an object with the id already exists, it'll add the changes from the external file to the existing object.
11-20-2008, 03:58 PM#6
XieLong
Also if this thread is quite old I hope it's ok if I ask my Grimex question here:

Is there a possibility to export only one specific file from the imports with an "//! external" call?
11-20-2008, 04:51 PM#7
PitzerMike
It is not possible out of the box.
However, you should be able to set up MPQ2k as an external tool properly in the jasshelper.config file.
MPQ2k


PS: I've also updated the ObjectMerger so that it works with channel based abilities. Simply copy the files from the attached zip over the old ones in NewGen\grimext\
Attached Files
File type: zipGrimexHotfix.zip (449.2 KB)
08-01-2009, 06:21 AM#8
masda70
Bug in grim?: Using the "Import Object Data" function can create objects containing a double quote character ( " ), which might break maps if you run widgetizer on them afterwards. Apparently " is a string delimiter in the SLK format so this causes the ability to be broken and cause fatal errors when it is loaded ingame. The game doesn't crash if the object is never loaded.

In my case I had an ability whose id was A!!" .

EDIT: Removing the ability in question causes WorldEditor to crash so the Widgetizer is not necessary to trigger the problem! I am proceeding to change the ability id in the w3a file itself.

EDIT2: It worked! It appears that maps affected by this issue might need a special 'fix'.
08-26-2009, 09:54 AM#9
Anachron
How can I, for example, do this:
  1. Import icons:
    • BTNSpells_Hawk_Aspect.blp
    • DISBTNSpells_Hawk_Aspect.blp
  2. Create Spell Hawk Aspect
  3. Create Unit Cleric

???

I did
Collapse JASS:
//! external FileImporter "PATH\BTNSpells_Hawk_Aspect.blp" "ReplaceableTextures\CommandButtons\BTNSpells_Hawk_Aspect.blp"
//! external FileImporter "PATH\DISBTNSpells_Hawk_Aspect.blp" "ReplaceableTextures\CommandButtons\DISBTNSpells_Hawk_Aspect.blp"

so far.
12-20-2009, 02:31 PM#10
Barade
Read this as my reply content (couldn't find this thread when I wrote it).
At the moment I still can not use TileSetter with custom tileset ids and I still don't know how the "costs" for one tileset are calculated or defined.
09-11-2011, 09:31 PM#11
SerraAvenger
Is there some functionality to get the current value of a field?

something along the lines of:
Collapse JASS:
makechange(current,"istr",getvalue(current,"istr") .. ",I000")
09-12-2011, 04:47 AM#12
PurgeandFire111
I haven't found a function that does that yet. (although, there may be one I just don't know about) If you need it, you can try using GMSI instead:
http://www.wc3c.net/showthread.php?t=106485
09-12-2011, 11:05 PM#13
SerraAvenger
Hm. Not desperatly enough. However there was this thread (by the AMHS guy - yes, this one: ) with a short reply from PitzerMike. I have to admit I didn't understand it 100%, but it said this:
Quote:
None of the grimex tools allows to scan the script for units.
Noted, but:

Quote:
Getting and resetting the unit editor properties is possible with the ObjectMerger.

So I'm assuming the functionality exists - somewhere. Where did you learn about the grimex API?
10-07-2011, 04:36 AM#14
PurgeandFire111
Quote:
So I'm assuming the functionality exists - somewhere. Where did you learn about the grimex API?

I only learned it from the samples + normal lua + the manual. However, they don't completely cover all of the functions as far as I know (it would be awesome if mike made a list). So for now, you would probably want to look elsewhere to get object data. :\ (or ask pitzermike directly)
10-16-2011, 02:36 PM#15
PitzerMike
Hello SerraAvenger, I have just checked the source code.
There is currently no function exposed to lua that allows you to get the current value of a field.
However I guess the tool could be extended to provide that.

If anyone is interested, the source coude is available here: http://tools.assembla.com/svn/war3to.../ObjectMerger/
The functions exposed to lua are those that are passed to the lua_register function in main.cpp