How to use Grimext Object Merger

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
I've setup the JassHelper configuration:
[externaltools]
"ObjectMerger","grimext\ObjectMerger.exe"
But now I want a more scriptable way to create units using LUA scripts, but I'm not sure how to achieve that.

For example, what I want to do is having a function doing this: [lJASS]//! ObjectMerger createTower( unitName, typeId, etc )[/lJASS]

Could someone tell me or show me a simple example on how this?
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
But that's not really what I want, Otherwise I wouldn't have asked. I'm talking about a LUA system, with real variables, library's and other sorts of stuff which can handle this stuff much better and cleaner. I know you are able to do it, since a friend of mine uses such a system. It is perhaps self-written library's but I'll do that anytime of the year, then creating a textmacro mess.
 

Viikuna

No Marlo no game.
Reaction score
265
UnitProperties uses this kind of lua script for generating bonus abilities:

Code:
-- Specifies the highest power of 2 the property ability sets use. A Max of 8 means the system supports values of +/- 511.
Max = 8

setobjecttype("abilities")
CharFinder = "abcdefghijklmnopqrstuvwxyz"

-- Generates abilities for normal binary abilities
function BinaryAbility (source, new, name, field)
	for i = 0, Max do
		createobject(source, new.."+"..string.sub(CharFinder, i+1, i+1))
		makechange(current, "Name", name)
		makechange(current, "EditorSuffix", "(+"..tostring(2^i)..")")
		makechange(current, "Art", "")
		-- Set the stat fields to 0
		makechange(current, "Iagi", 1, 0)
		makechange(current, "Iint", 1, 0)
		makechange(current, "Istr", 1, 0)
		makechange(current, field, 1, tostring(2^i))
	end
	for i = 0, Max do
		createobject(source, new.."-"..string.sub(CharFinder, i+1, i+1))
		makechange(current, "Name", name)
		makechange(current, "EditorSuffix", "(-"..tostring(2^i)..")")
		makechange(current, "Art", "")
		-- Set the stat fields to 0
		makechange(current, "Iagi", 1, 0)
		makechange(current, "Iint", 1, 0)
		makechange(current, "Istr", 1, 0)
		makechange(current, field, 1, tostring(-1*2^i))
	end
end

BinaryAbility("AIx3", "AG", "Agility", "Iagi")
BinaryAbility("AIx3", "IN", "Intelligence", "Iint")
BinaryAbility("AIx3", "ST", "Strength", "Istr")
BinaryAbility("Arel", "LI", "LifeRegen", "Ihpr")
BinaryAbility("AItg", "DA", "Damage", "Iatt")
BinaryAbility("AId1", "AR", "Armor", "Idef")


-- Generates abilities for percentage-based binary abilities
function BinaryAbilityPercent (source, new, name, field)
	for i = 0, Max do
		createobject(source, new.."+"..string.sub(CharFinder, i+1, i+1))
		makechange(current, "Name", name)
		makechange(current, "EditorSuffix", "(+"..tostring(2^i)..")")
		makechange(current, "Art", "")
		makechange(current, field, 1, tostring(2^i/100))
	end
	for i = 0, Max do
		createobject(source, new.."-"..string.sub(CharFinder, i+1, i+1))
		makechange(current, "Name", name)
		makechange(current, "EditorSuffix", "(-"..tostring(2^i)..")")
		makechange(current, "Art", "")
		makechange(current, field, 1, tostring(-1*2^i/100))
	end
end

BinaryAbilityPercent("AIsx", "AT", "Attack Speed", "Isx1")
BinaryAbilityPercent("AIrm", "MR", "Mana Regen %", "Imrp")

-- Generates add/subtract life/mana abilities
function BinaryAbilityState (source, new, name, field)
	for i = -1, 1, 2 do
		if i == -1 then
			createobject(source, new.."+")
			makechange(current, "Name", name.." +")
		else
			createobject(source, new.."-")
			makechange(current, "Name", name.." -")
		end
		makechange(current, "EditorSuffix", "")
		makechange(current, "Art", "")
		makechange(current, "levels", "4")
		makechange(current, field, 1, tostring(i*0))
		makechange(current, field, 2, tostring(i*1))
		makechange(current, field, 3, tostring(i*10))
		makechange(current, field, 4, tostring(i*100))
	end
end

BinaryAbilityState("AIlz", "Lif", "Life", "Ilif")
BinaryAbilityState("AImb", "Man", "Mana", "Iman")


-- Generates the Evasion ability
function EvasionAbility (new, name, ability)
	createobject("ACes", new)
        makechange(current, "aite", "1")
        makechange(current, "arac", "Other")
        makechange(current, "ansf", "")
        makechange(current, "Name", name)
end

EvasionAbility("Evas", "AttackEvasion", "ACes")

Its pretty useful yea, since you can for example, change that Max constant depending how big bonuses you need.

Then you can just use ObjectMerger to generate stuff from your lua script. [lJASS]//! external ObjectMerger UnitPropertiesGenerator.lua [/lJASS]
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Thank you for the example, I used to create mods for "gary's mod" in the lua language so I'm pretty familiar with the syntax. However, there seems to be an API included in this example, for example the function setobjecttype("abilities") is not native to the language ( the ability string ). Where would I find a list of all the included functions / configuration?
 

Viikuna

No Marlo no game.
Reaction score
265
Theres some documentation and some lua samples in Grimex folder.

But yea, I couldnt find a good list of those functions either..
I guess you should that ask from PitzerMike in wc3c or something.

edit. Ill see if I find out anything about how that stuff works. I have never used it myself, so its some new learning for me too.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top