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

is it possible to change 2d avatar in game?

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
hi, im using 2d avatars for my units. i did them with blp files and with the mdx file that has name of hero model_portrait so for example if name of my model is warrior the name of portrait mdx file is warrior_portrait.

what i would like is to give the warrior a new portrait with triggers. is it even possible? i wanna avoid having to create a multiple copied models.
 
Level 5
Joined
Jul 31, 2020
Messages
103
So, if I understand you correctly, you want the unit to remain the same unit, but change its portrait into something else. As far as I'm concerned this can be achieved by changing the unit's skin, but you will still need another unit with a different portrait to use its skin, so to speak.

I'm gonna be honest, I couldn't find an easy-clicky way of finding a unit's skin ID, but you can find it out like so:

  • Events
    • Player - Player 1 (Red) types a chat message containing skin as An exact match
  • Actions
    • Game - Display to (All players) the text: (String((Skin ID of Knight 0001 <gen>)))
However, it'll give you a rather large integer, such as 1751871081 for a Knight, which you will not be able to set manually using the Unit - Set Unit Skin action, therefore you want to feed it using the Unit - Skin action, the one I used to get it to display up there.

Without better ideas, I guess you can spawn your secondary unit for just as long as you need its skin ID so you can change your primary one, like so:

  • Events
    • Your event
  • Conditions
    • Your condition
  • Actions
    • Set VariableSet pos = (Center of (Playable map area))
    • Unit - Create 1 YOUR_SECONDARY_UNIT for Neutral Hostile at pos facing Default building facing degrees
    • Unit - Set Unit Skin of YOUR_PRIMARY_UNIT to (Skin ID of (Last created unit))
    • Unit - Remove (Last created unit) from the game
    • Custom script: call RemoveLocation(udg_pos)
If this is not what you were looking for, I misunderstood you.
 
Level 11
Joined
Jul 17, 2013
Messages
544
So, if I understand you correctly, you want the unit to remain the same unit, but change its portrait into something else. As far as I'm concerned this can be achieved by changing the unit's skin, but you will still need another unit with a different portrait to use its skin, so to speak.

I'm gonna be honest, I couldn't find an easy-clicky way of finding a unit's skin ID, but you can find it out like so:

  • Events
    • Player - Player 1 (Red) types a chat message containing skin as An exact match
  • Actions
    • Game - Display to (All players) the text: (String((Skin ID of Knight 0001 <gen>)))
However, it'll give you a rather large integer, such as 1751871081 for a Knight, which you will not be able to set manually using the Unit - Set Unit Skin action, therefore you want to feed it using the Unit - Skin action, the one I used to get it to display up there.

Without better ideas, I guess you can spawn your secondary unit for just as long as you need its skin ID so you can change your primary one, like so:

  • Events
    • Your event
  • Conditions
    • Your condition
  • Actions
    • Set VariableSet pos = (Center of (Playable map area))
    • Unit - Create 1 YOUR_SECONDARY_UNIT for Neutral Hostile at pos facing Default building facing degrees
    • Unit - Set Unit Skin of YOUR_PRIMARY_UNIT to (Skin ID of (Last created unit))
    • Unit - Remove (Last created unit) from the game
    • Custom script: call RemoveLocation(udg_pos)
If this is not what you were looking for, I misunderstood you.
Yes but this way requires creating a second copied model in import editor, i would like to avoid it.
 
Level 5
Joined
Jul 31, 2020
Messages
103
I was thinking about the "Unit - Set String Field" and what fields that are possible to set that way (I don't have access to the editor atm).
Maybe worth checking, but likely one can only set the model path and not the portrait path.

It won't allow you to change the unit's model path.

Yes but this way requires creating a second copied model in import editor, i would like to avoid it.

Yeah, I understand you asked for that, but unless there's a native for it someone knows of, I don't think there is a way to change a unit into another unit that basically doesn't exist in your map. Changing a unit's skin the way I showed up there is meant for this, but it requires the unit you want to change into to actually exist.
 
Status
Not open for further replies.
Top