1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Weave light to take you to your highest hopes - the 6th Special Effect Contest is here!
    Dismiss Notice
  4. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Getting help on using ObjectMerger

Discussion in 'Warcraft Editing Tools' started by yxq1122, Jun 6, 2020.

  1. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    144
    Resources:
    0
    Resources:
    0
    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:
    Code (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.
     
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,488
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    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:
    Code (vJASS):
    //! 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: Jun 6, 2020
  3. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    144
    Resources:
    0
    Resources:
    0
    Thanks for your kind reply! @IcemanBo
    However, that solution doesn't work. These are the Lua commands I used:
    Code (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 (Text):
    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.
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,488
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    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.
     
  5. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,427
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Super late to the thread, but yeah, there isn't a way to read data using the Lua/object merger tools.

    I'd recommend checking out wurst if you need more features. They had a pretty awesome set-up for creating objects dynamically.