• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Correct usage of a model with variations

Status
Not open for further replies.
Level 4
Joined
Mar 23, 2009
Messages
78
I try to place a decoration, that uses blizzards' model of rocks (Doodads\Terrain\RockChunks\RockChunks.mdl), but can't make it use different variations (e.g. Doodads\Terrain\RockChunks\RockChunks1.mdl). What's the problem?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The object's model path should be Doodads\Terrain\RockChunks\RockChunks without the .mdl. However, when you change that field, the editor actually demands the format with .mdl, therefore automatically morphs it into. Your chances are to directly base your object off that one with the right original path or you change the value with another tool like ObjectMerger in JNGP.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Okay, because of the other possibility, this one actually makes more sense for customized variation sets. I recently wrote a tutorial about it but this was not here and not in english.

As said, you need the JNGP. You open your map and go in trigger editor. Create some page where you can unload following script:

JASS:
//! textmacro SetDoodadModel takes id, path
    //! externalblock extension=lua ObjectMerger $FILENAME$
        //! i setobjecttype("doodads")

        //! i modifyobject("$id$")

        //! i makechange(current, "dfil", "$path$")
    //! endexternalblock
//! endtextmacro

//! runtextmacro SetDoodadModel("D000", "Doodads\\Terrain\\RockChunks\\RockChunks")

You need to edit the parameters for the last runtextmacro-line. The first one represents the id of your doodad, which you can see in object editor by raw data display (CTRL+D). Take the first four letters that are shown for your object on the left tree like ATtr for standard Ashenvale. Pay attention to case sensitivity. The other parameter is the desired model path, Doodads\\Terrain\\RockChunks\\RockChunks in this case. Backslashes are doubled. Then save the map once, it will run the external script/tool. Afterwards, reload the map to update the editor and remain the changes. You can then remove the script again or comment it out.

If your object is not a doodad but a destructable (when you say it's a decoration only, it would more likely be a doodad), you need to replace //! i setobjecttype("doodads") by //! i setobjecttype("destructables") and //! i makechange(current, "dfil", "$path$") by //! i makechange(current, "bfil", "$path$").
 
Level 4
Joined
Mar 23, 2009
Messages
78
thank you.
oh, tested the code, jngp returnes this error on compilation
 

Attachments

  • 2.png
    2.png
    18.7 KB · Views: 66
Level 4
Joined
Mar 23, 2009
Messages
78
after some street magic with nod's quarantine ive made this code compile. but still green blocks both in we and game, and when i try test map from we (newgen we) war3 crashes.
 
Level 4
Joined
Mar 23, 2009
Messages
78
so, i need to open the map, delete macro code except call of the function, disable rtc and umswe and test this?
maybe i need to set correct options in grimoire?

Edit: whoa, i got something, not related with scripts and maybe a kind of perversion, still better than nothing.
you'll need to set all the required parameters of your object (doodad, destrusctible, etc.) and set a model with variations in object editor. save and close your map. then, open your map in mpq archiver (mpq master, for example), find in a root of archive file war3map.w3d. extract it and open in hex editor (i used hex editor neo). find a path, spoiled by the editor, and remove '.mdl' (maybe it will be easier to find it in notepad first, but don't save file in notepad!)Don't forget to remove point separating filename and extension!

Checked it in we, models look like should, all is fine. Seems it will be ok until you will touch 'Model' field in object manager.
 
Last edited by a moderator:
Level 4
Joined
Mar 23, 2009
Messages
78
just spent too much time trying to make scripts work) WaterKnight, thank you for help. It would be great if you'll translate your article into english and post it here.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
That's also a reason why I broached the subject. To know whether I need to add special requirements or configurations. The ObjectMerger however is useful for a lot of other things. You can practically use it to dynamically create/modify objects and save a lot of work. So maybe you will be good with it at some later point.
 
Status
Not open for further replies.
Top