How to - Use the Object Merger

Azlier

Old World Ghost
Reaction score
462
Today I will explain how to use the Grimex Object Merger, a useful tool.

The ObjectMerger is an external program that can be used to create or move object data, the stuff you change in the Object Editor. Moving object data from map to map is useful only in very specific circumstances. I will focus on the creation of new object data, instead.

Creating new object data with the ObjectMerger is done with a one line command. To run an existing ObjectMerger command, save the map. Exit the map. Open the map. Your new data will be there.

This tutorial will teach you the basic structure of an ObjectMerger command to create new object data.

Required
Yes, that's all. ObjectMerger is best used to create stacks of abilities, for things like Bonus. Creating many similar objects and editing a small part of each at once is made simple with the ObjectMerger. It is important to note that ObjectMerger is not called dynamically. You cannot create new abilities during gameplay.

You enter an ObjectMerger command into anything that accepts and parses Jass code (the map header or a trigger paged converted to Custom Script.) This most likely works in even the GUI Custom Script action.
JASS:
//! external ObjectMerger

There. First, the //! tells Jasshelper that there is a special command to execute.

A parameter, for those who don't know, is something you input into a program or function that the program or function uses or changes internally.

The 'external' parameter tells that we need to call an external (duh) program. The name of the program? The second parameter. ObjectMerger.
In conclusion, don't bother figuring out how that part works and just type it in.

Now, what are we going to create? We need to know very badly. The next parameter tells what we're going to create. Here's a handy table.

  • w3u units
  • w3t items
  • w3b destructables
  • w3d doodads
  • w3a abilities
  • w3h buffs
  • w3q upgrades

Now, let's say we're creating a stun ability for a dummy caster.

So, begin our command and add the next parameter. w3a, ability.

JASS:
//! external ObjectMerger w3a


Doing well! Now, we need the raw code of the ability to base our ability on. Storm Bolt, it stuns. That is the next parameter.

(Simple raw code tutorial.)

JASS:
//! external ObjectMerger w3a AHtb


The next parameter is the raw code we want our new object to have. Let's call it STUN.

It is important to note that objects created via the ObjectMerger overwrite any existing ones that have the same raw code. Be careful about raw code overwriting, grasshoppah.

JASS:
//! external ObjectMerger w3a AHtb STUN


That's the hard part. Now we can edit the ability itself!
Look at the inside of Storm Bolt, in the object editor (Display Raw Data turned off).

After every field, there is a small four letter code.
Code.PNG
(Okay, I accidentally showed Aerial Shackles. Same concept.)

Let's do something simple. Let's change the name of the ability.
Scroll down to Text - Name. It should have (anam) after it. This is the important part.

JASS:
//! external ObjectMerger w3a AHtb STUN anam "My Stun"


You see what I did there? First, anam. It tells what we need to change. Then, you enter a string value (does not accept variables) as your next parameter.

If you are not sure what type of parameter a field takes, press Ctrl + D and look at that field's value in the Object Editor. Beware, some fields which take integers will cause the ObjectMerger to supply the ASCII value of the integer you meant to supply. To avoid this, you need to use "\xxx", where xxx is a three digit number. This part is very important when dealing with Channel based abilities.

And, lastly, if a field can take multiple parameters (such as Unit - Abilities), you add a comma between each argument.

That's a simple edit. Now to slightly more complicated stuff. Let's set how many levels are in the ability.
Stats - Levels has the (alev) code after it. Perfect. Let's set the max level to 1.

JASS:
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1

Yes, as you change more, it gets longer and more unreadable. Nothing I can change.

Let's edit the damage to 0. Now, this part is really important!
There are fields that multiply when you edit how many levels an ability has (damage, cooldown, etc.). When changing these with the ObjectMerger, you need to tell it which level this affects. Even on a 1 level ability. Annoying, I know.

Data - Damage's code is (Htb1). We need to modify level 1. So:
Htb1 1 0
This sets Level 1 Damage to 0.

JASS:
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1 Htb1 1 0


Excellent! Go on to set cooldown and mana cost to 0. Duration, if you want an infinite stun.

JASS:
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1 Htb1 1 0 acdn 1 0 amcs 1 0


Closer... We should've done this step earlier. You must set the model the ability uses to nothing. " " will do ("" does something weird. It gets replaced with //================).

It takes a string instead of the usual number. Exactly like the name did.

JASS:
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1 Htb1 1 0 acdn 1 0 amcs 1 0 amat " "


There! A good dummy stun! I neglected to set duration to 0, but that is easy enough to do on your own.

This command is ready to run. Save the map. Exit the map. Open the map. Delete this line of code.
Check in the object editor, and voila! A nice dummy Storm Bolt, even named My Stun!

This isn't enough. Let's create a custom buff to go with our spell!
JASS:
//! external ObjectMerger w3h BPSE STNB fnam "My Stun Buff"

I ordered ObjectMerger to copy BPSE (Stunned (Paused)), set the new buff's raw code to STNB, and changed the name to My Stun Buff. Let's add this buff to our custom stun.
The order in which you type the commands does not matter one bit.
JASS:
//! external ObjectMerger w3h BPSE STNB fnam "My Stun Buff"
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1 Htb1 1 0 acdn 1 0 amcs 1 0 amat " " abuf 1 STNB


You can do this with units, doodads, destructables, whatever. It's just handiest to use with abilities and buffs, for there is no need to make masses of unit types.


Grimex is well coupled with textmacros. A textmacro to make an item, an ability, and give the ability to the item can greatly speed things up. Here's a textmacro to make a ring of protection, an armor ability to go with it, and ties the ability to the ring.

For information on how to use textmacros, see the Jasshelper Manual (World Editor Bible).
JASS:
//! textmacro MakeArmorRing takes AMOUNT, NAME
  //! external ObjectMerger w3a AId1 AR$AMOUNT$ Idef 1 $AMOUNT$ anam "$NAME$" ansf "($AMOUNT$)"
  //! external ObjectMerger w3t rde1 AR$AMOUNT$ iabi AR$AMOUNT$ unam "$NAME$"
//! endtextmacro

Now, making new rings is cake!
JASS:
//! runtextmacro MakeArmorRing ("01", "Crude Armor Ring")
//! runtextmacro MakeArmorRing ("02", "Minor Armor Ring")
//! runtextmacro MakeArmorRing ("04", "Lesser Armor Ring")
//! runtextmacro MakeArmorRing ("06", "Moderate Armor Ring")
//! runtextmacro MakeArmorRing ("08", "Armor Ring")
//! runtextmacro MakeArmorRing ("12", "Greater Armor Ring")
//! runtextmacro MakeArmorRing ("16", "Superior Armor Ring")
//! runtextmacro MakeArmorRing ("22", "Superb Armor Ring")
//! runtextmacro MakeArmorRing ("30", "Perfect Armor Ring")

This one was rather simple. It's perfectly possible to make the tooltips change depending on the input. Icons, too!

Imagine an RPG where you need ~12 of a certain potion, only slightly varying between types. Wouldn't it be a nightmare to manually make every single potion? Once you make a good textmacro you can do...
JASS:
//! runtextmacro MakeHealingPotion ("100", "Simple Healing Potion")



Lua with ObjectMerger

Now, onto more complex, possibly more readable, and more flexible usage of the ObjectMerger. Feel free to disregard this section if you do not need more advanced ObjectMerger tools.

Good use of this method compiles much faster than the above methods, but takes a bit of time to learn.

It is possible to make an ObjectMerger lua script right in the trigger editor. The first thing we need is the external block. You may ignore the syntax and just see it as "heddur" and "fuder". It would be wise to look for an lua tutorial.

JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$

//Lua goes here.

//! endexternalblock


Now, we choose what type of object we are going to deal with. This is simpler than the w3u and w3a madness the previous method requires. Lines of lua script should be prefixed with [lJASS]//! i [/lJASS].

JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$

//! i setobjecttype("units") //"items", "upgrades", etc.

//! endexternalblock


And now we can finally get to the modification or creation of objects. One difference between this and one line ObjectMerger calls is that this can modify and create objects.

This is an example of modifying units.
JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$

//! i setobjecttype("units") //"items", "upgrades", etc.

//! i modifyobject("hpea")  //Let's proceed to modify the peasant. We can refer to the peasant with 'current'.
//! i makechange(current, "usca", 1.25)  //Set peasant scale to 1.25.
//More modifications here.

//! i modifyobject("hfoo")  //Now footman.
//! i makechange(current, "usid", 1000)  //Set day sight radius to 1000.
//More modifications.

//! endexternalblock


And that's how it's done! Creating objects is only slightly more complex.

JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$

//! i setobjecttype("units") //"items", "upgrades", etc.

//! i createobject("hpea", "h000")  //Copy the peasant, and give the new unit type the rawcode h000.
//As before, we can refer to it with 'current'.
//! i makechange(current, "usca", 1.25)  //Set our new unit's scale to 1.25.
//More modifications here.

//And just to show you that multiple object types in one block is perfectly valid...
//! i setobjecttype("items")
//! i createobject("afac", "i000") //Flute of Accuracy cloned.

//! endexternalblock


Combined with textmacros, this becomes rapid compiling gold.

But wait! There's even more!

It is possible to modify every WC3 object of a type at once! I think I'll let the script explain itself

JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$

//! i setobjecttype("units")

//! i makechange(custom, "usca", 1.25)  //Set the scale of all custom units to 1.25.
//! i makechange(original, "usca", 1.25)  //Set the scale of all original units to 1.25.
//! i makechange(modded, "usca", 1.25)  //Set the scale of all modified original units to 1.25.
//! i makechange(unmodded, "usca", 1.25)  //Set the scale of all unmodified original units to 1.25.


//! endexternalblock
 
This is useful, and original.
I haven't seen a tutorial about this before.

Let's wait for some more comments. :)
 
It really is - I never knew how to use it and the day when you posted it I was in real need to understand its functionality since I wanted to create lots of units but with different stats and copy/paste wasn't really a great option. Good job!
 
Awesome!
How fast is adding units this way?
You know, it takes hours to save in object editor. Is this one faster?

PS: Love it <3
 
> How fast is adding units this way?
When you save a map, it creates the objects in the Object Editor.
Then you can remove the objectmerger line, and the map will have those objects.
 
> How fast is adding units this way?
When you save a map, it creates the objects in the Object Editor.
Then you can remove the objectmerger line, and the map will have those objects.

Y, but how long does this process take ^^
EDIT:
I mean, like how many seconds will the save process additionally take per w3u entry of the ObjectMerger=?
 
> Y, but how long does this process take ^^
Why don't you try it?
IIRC, it most certainly isn't instant. Takes a few seconds minimum (on my crappy computer). But you only ever wait once anyway.
 
>create lots of units but with different stats
Hmm. Somebody actually wanted to use the ObjectMerger for units. The only real use I see in that is a Footman Frenzy map, to be honest. ;)

>How fast is adding units this way?
If you're making only one or two objects, this is actually slower. You still need to go into the Object Editor and look up those little 4 letter codes. However, with things that require switching between Object Editor menus and such (Armor Rings, Healing Potions), it's much faster.

Processor-wise, it's about 2x as slow. The time is takes to process (The armor rings took about 10 seconds) is nothing to worry about, though.

>When you save a map, it creates the objects in the Object Editor.
Then you can remove the objectmerger line, and the map will have those objects.
Yes, that's in the tutorial.

The thing is, what more is there to add (besides the whole porting object data between map stuff. I've never needed that.)? Is there anything else to cover?

Edit: Huh. Two more posts while I was typing. Haven't had this happen in quite a while.
 
Wow, this looks cool. I have never even notcied that feature before :eek:
 
> The only real use I see in that is a Footman Frenzy map, to be honest.
Or a summoning spell that requires ~20 units with increasing strength ... Something like that. I used the ObjectMerger for my Invoker spellpack to create those Spirits. :p
 
Its useful. I think people could use object merger more when submitting stuff.

And, for me it took something like 20 minutes to generate all 150 UnitProperties spells with object merger.

( Wonder how long it would have taken to create those 150 spells with object editor.. luls )
 
(Before the explanation) said:
Creating new object data with the ObjectMerger is done with a one line command. To run an ObjectMerger command, save the map. Exit the map. Open the map. Your new data will be there.
Oh, that's it? I just think of a spell and save? :p

> Grimex commands are entered directly into the trigger editor.
Wut commands?

> First, you need to know what program to call.
How will I know that? :(
In fact, you could remove the whole "program to call", and just start with "//! external ObjectMerger". And explain what it is as a whole.

> //! external ObjectMerger
Where do I put that?

You don't actually explain the whole 'parameter' thing either. :)
 
Kay, did some tweaking. Not much. Oh, and there are links. Links are fun. Except rickroll links. Those are awesome, not fun.
 
Nice tutorial.

Once I got to the part where you say "does not accept variables" I started to think how awesome it would be if ObjectMerger could be used in conjunction with textmacro. I kept reading, the bang! textmacro with ObjectMerger, very awesome :).

Once again, nice tutorial. Very original.
 
Approved. Good job. :)

Though, one last thing, what happens if someone uses parameters that shouldn't be available for the base spell?
For example, giving critical strike a "chance to bash"?
 
Yay!

>For example, giving critical strike a "chance to bash"?
What sort of idiot would- the ObjectMerger would give you an error. Something about an invalid field. The ObjectMerger doesn't exactly give the best errors.
 
Very nice tutorial! And like Romek said: Very original! <3

Your example of making 12 potions at the end of the tutorial os the one im looking for!

EDIT:
Will it create abilities/items/etc. like in the Object Editor and will it increase the map's size?
 
>Will it create abilities/items/etc.
Yes. Exactly like in the Object Editor.

>will it increase the map's size?
The same amount of size it would take to make the stuff manually.
 
Do we have to delete the lines of code after we create the objects? Or can we just leave them in the map (assuming that our finished version will be optimized and have all those comments removed).
 
General chit-chat
Help Users
  • Varine Varine:
    And since almost all of my programming experience is with defunct shit now, I figure my best place is helping preserve legacy stuff. Which I don't know how to do necessarily, but I need some kind of a hobby and figuring out how older things worked is the only shit that really interests me. Well soldering and restoration is fun too, but no one is bringing me new stuff to fix and restore, so it's mostly old shit, and I LOVE OG Xbox so much. I want to make sure it can function as long as possible, until someone can effectively emulate it at least. I have like 15 I was going to fix over the winter and didn't get to.
    +1
  • Varine Varine:
    I also have a couple OG gameboys, but idk if I can do that without like, manufacturing new parts that no one makes anymore and I can't do that right now
  • tom_mai78101 tom_mai78101:
    Currently in the middle of getting the probate process going. We're doing the informal probate process.
    +3
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top