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

Getting help on using ObjectMerger

Status
Not open for further replies.
Level 7
Joined
Jun 5, 2018
Messages
180
Hello everyone!
The original ability list of an unit will be replaced by a single value of "A001" when I use the following Object Merger Lua command:
vJASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i setobjecttype("units")
//! i createobject("hmpr", "h005")
//! i makechange(current, "uabi", "A001")
//! endexternalblock

Actually, I hope the ability "A001" could be appended into the original list of unit's abilities. Unfortunately, I will get a single one of "A001" that will replace the original ability list of the unit. I also checked the manual of Grimex which says that the Object Merger has the "Merge mode" by default. I really get confused. I don't know how to get it work properly to append an ability into the ability list of an unit.

I would be very grateful if someone could help me.
 
Hardcoding the ability list and seperating with commas yourself is no good option?

I might be wrong, but as far as I know there's sadly no function to retrieve a field's data. Else one could probably append it to the existing list like:
JASS:
//! i modifyobject("hmpr")
//! i local abilities = getObjectFieldValue(current, "uabi")
//! i modifyobject("h005")
//! i makechange(current, "uabi", abilities .. ",A001")
I believe the default merge mode is meant to be for object creation itself, not for "makechange". By default it would be weird for almost all fields, if for example "makechange unam" would append the name to the already existing name.

@PurgeandFire maybe you know something?
 
Last edited:
Level 7
Joined
Jun 5, 2018
Messages
180
Hardcoding the ability list and seperating with commas yourself is no good option?

I might be wrong, but as far as I know there's sadly no function to retrieve a field's data. Else one could probably append it to the existing list like:
JASS:
//! i modifyobject("hmpr")
//! i local abilities = getObjectFieldValue(current, "uabi")
//! i modifyobject("h005")
//! i makechange(current, "uabi", abilities .. ",A001")
I believe the default merge mode is meant to be for object creation itself, not for "makechange". By default it would be weird for almost all fields, if for example "makechange unam" would append the name to the already existing name.

@PurgeandFire maybe you know something?

Thanks for your kind reply! @IcemanBo
However, that solution doesn't work. These are the Lua commands I used:
vJASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i setobjecttype("units")
//! i createobject("hmpr", "h005")
//! i modifyobject("hmpr")
//! i local abilities = getObjectFieldValue(current, "uabi")
//! i modifyobject("h005")
//! i makechange(current, "uabi", abilities .. ",A001")
//! endexternalblock

I got an error when I used the Lua commands above.
无标题.png

I checked the error log in logs\grimex.txt:
Code:
setobjecttype units
createobject h005
modifyobject hmpr
C:\Users\vsus\AppData\Local\Temp\VF92C.tmp.lua:4: attempt to call global 'getObjectFieldValue' (a nil value)

It seems that the global call "getObjectFieldValue" doesn't work.
 
there's sadly no function to retrieve a field's data. Else one could probably append it to the existing list like
Yeh, the code doesn't work. It was just attempting to use such function, if it existed. :peasant-tongue-out:
In @PurgeandFire's tutorial I could also not really find something, so then I hoped he might know something, if it's possible.
 
Status
Not open for further replies.
Top