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

[Solved] Changing a unit's portrait in-game?

Status
Not open for further replies.
Hey there.

I have a unit that is able to shift his elements, resulting in a color change to the model via texture change. This texture change is made in the model itself, and works by adding in an animation tag for each of the different element (Alternate for Earth, Gold for Fire, etc etc).

Problem is, my unit does not change it's portrait despite the portrait having the exact same texture change as well as animation tags. So, I'm trying to resort into the trigger sections.
How can I change a unit's portrait? Is it possible with triggers or Jass?
 
Level 12
Joined
Jan 30, 2020
Messages
875
I have some experience with these kind of portrait issues.

I have a model called "Flying Balls" that consists of a Ball with 3 different types of wings.
The only issues I had with the portrait was when using wrong tag names in the model animations itself as you might see in this thread :
Flying Balls Model : Portrait Upgrade First not working...

But it seems you use tags with a single word, so you should not be affected there.

Then I added a new animation to transform the Flying Ball into a "Roasting Flying Ball", and wanted to apply this look by setting the animation tag with triggers :
[Spell] - Setting unit animations with triggers : portrait issues !

The only solution in your situation would be to make several versions of your unit in the unit editor, with the same model but a different animation tag and replace the unit with triggers rather than changing the animation tag.

Until Blizzard does something to fix all alternate portraits issues, replacing unit sounds like the only current fix.
Hope this helps!
 
  • Unit - Set Unit Skin of Archimonde 0000 <gen> to (FourCC(AHbh))
this maybe??

or you can use Retera Model Editor

I can't find that trigger. I don't think it exists in 1.31.

I have some experience with these kind of portrait issues.

I have a model called "Flying Balls" that consists of a Ball with 3 different types of wings.
The only issues I had with the portrait was when using wrong tag names in the model animations itself as you might see in this thread :
Flying Balls Model : Portrait Upgrade First not working...

But it seems you use tags with a single word, so you should not be affected there.

Then I added a new animation to transform the Flying Ball into a "Roasting Flying Ball", and wanted to apply this look by setting the animation tag with triggers :
[Spell] - Setting unit animations with triggers : portrait issues !

The only solution in your situation would be to make several versions of your unit in the unit editor, with the same model but a different animation tag and replace the unit with triggers rather than changing the animation tag.

Until Blizzard does something to fix all alternate portraits issues, replacing unit sounds like the only current fix.
Hope this helps!

flying balls <.<

I have tried several different animation tags on my Hero, and the only one that works is Alternate. Upgrade tag should work, but for some reason it does not work on Units. Only Buildings.
Guess I'll just have to make duplicates then.
 
Level 8
Joined
Jun 16, 2008
Messages
333
i just put search text in event and put skin and it should be the second one
search.png
 
Level 12
Joined
Jan 30, 2020
Messages
875
Yes in any case it might just work with the unit itself but not its portrait even in Reforged.

I am confident the unit replacement with triggers will solve this.
 
Level 12
Joined
Jan 30, 2020
Messages
875
Replacing a hero just requires that you save the experience and the spells levels before the replacement in order to restore them afterwards.
It is probably harder to achieve in GUI than Jass or Lua, but I don't see any reason why it couldn't be made.

@Warseeker : would the separate portrait change something ? I thought the game loaded the portrait with the same name as the model + the portrait suffix.
 
Is the portrait inside the model or in a seperate file ?

Separate file, but they have the exact same animation tags.

Replacing a hero just requires that you save the experience and the spells levels before the replacement in order to restore them afterwards.
It is probably harder to achieve in GUI than Jass or Lua, but I don't see any reason why it couldn't be made.

I'm just worried it'll cause problems with the Altars.
 
I think something like Metamorphosis or Bear Form would do very well for this. Have the unit cast a hidden Bear Form or Metamorphosis every time it needs to change. Might be tricky if all states can change to each other as that would requires a good number of replicas. Safest is Stone Form as multiple reports of Bear Form being broken is appearing since 1.32.0.

Alternatively, put a hidden Chaos, but everyone knows how buggy Chaos is.
 
Level 12
Joined
Jan 30, 2020
Messages
875
I'm just worried it'll cause problems with the Altars.

You won't, I upgrade heroes in my map several times and there are no revive issues. A removed hero does not leave an icon, nor can it be revived.

I think something like Metamorphosis or Bear Form would do very well for this

I hadn't used morphing abilities again since they tend to cause complicated issues with abilities not changing accordingly to the alternate unit.
But as the only idea here is to change the model, I just tested it.
Unfortunately, after testing quite a few settings, the best I could end up with is the proper new portrait, but other alternate animations for the unit itself.

Now there might be some specific settings with link names and bone names, but I have no idea if that would solve the issue.
IN all fairness i would love that, especially as metamorphosis has an integrated countdown progress bar, and that i had to script a quite complex one with UI frames and selection events, and if I could use a built in method, I would be delighted. I suppose this is also the case for @xYours Trulyx
 
Level 12
Joined
Jan 30, 2020
Messages
875
Ok well as I only came back to modding in December 2019 after 16 years, I was not aware of the situation before.

IIRC, in my old 2004 map, I was indeed using metamorphosis to change hero models, but yes I failed to make this to work in Reforged.
It might still be possible with proper link and bone names and maybe some adaptations on the model with multiple alternate forms, but thats a bit beyond my modeling knowledge tbh :)

Thanks for the information though!

@xYours Trulyx : as you are using patch 1.31, this might indeed be the perfect answer for your problem.
 
Level 12
Joined
Jan 30, 2020
Messages
875
I'll try to go with Stone Form

Yes it should work for you too.

I have just tried to make Stone Form work in Reforged, but with a lot of tinkering around, i always ended up with one issue or another.

This said, I nearly completely managed to get it to work with a single custom version of the Storm Crow Form unit ability.
For some reasons, making a different version to switch back created issues.
So what I did basically is use the same tag, attachment and bone names as the Crow Form of the Druid of the Talon and replaced them with the animation tag my model uses for the desired "look". This tag is "victory".

Then I removed requirements, mana cost, zeroed all duration fields.
With just this, only the portrait was showing the proper animation, and as trying to change the model animation tag in my previous tests had the opposite problem, i just play the "stand victory" animation and it seems to work.
As the vertex coloring and the Proper Name of the Flying Ball that needed to change did not follow the model change, i fixed that with a couple of actions.
As I can only use a single ability for both transformations, i just check the Unit ID and it seems to do the job.

I made a GUI version of the trigger I used just to show for anyone interested to get this to work in Reforged but who would not be familiar with Lua :
  • ChangeModelWithPortrait
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Roast
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Flying Ball Test
        • Then - Actions
          • Animation - Add the victory animation tag to (Casting unit)
          • Animation - Play (Casting unit)'s stand victory animation
          • Animation - Change (Casting unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Hero - Set Name of (Casting unit) to Roasting Flying Ball
        • Else - Actions
          • Animation - Remove the victory animation tag to (Casting unit)
          • Animation - Play (Casting unit)'s stand animation
          • Animation - Change (Casting unit)'s vertex coloring to (47.00%, 78.00%, 100.00%) with 0.00% transparency
          • Hero - Set Name of (Casting unit) to Flying Ball
The only small issue I have is that the stand animation does not seem to work properly when the Roasting Flying Ball changes back to Flying Ball.
But it does not matter much as the model starts to change back properly again as soon as the Flying Ball starts moving (strange as the walk animation should have no effect on the tag).

@Daffa +rep to you for leading me to tinker with this (when the 24h will expire lol)
I didn't manage to get a countdown progress bar working with Stone Form or Storm Crow Form, but I guess I can still use the one I made out of UI Frames.

Note that if you have any idea about getting the progress bar to work, let me know : I tried adding a generic expiration timer but the progress did not show, only the generic progress bar looking frozen (the unit indeed expired though).

I quite like my custom UI progress bar, but it is quite complex, so anything that I could replace with features integrated in the game engine would be really welcome.
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
This tutorial may help you : Change Model Texture Using Alternate Animations (Unless this is one you're using already)

Anyway, If you look at the goblin alchemist hero portrait animation, you will see that he uses alternate tags when switching forms.

I also looked at Grom and the Mountain King but I can't seem to figure out how it works.
 

Attachments

  • 1.png
    1.png
    328.5 KB · Views: 31
Level 12
Joined
Jan 30, 2020
Messages
875
Yes thats an interesting point there.

How can you be sure it replaces the unit ? I also noticed some unit fields I tend to setup via triggers were reset after using Storm Crow Form on my creeps (Ball attackers are heroes as I use revive hero to recycle them). Such as base attack and bounty, then I had to replace them.

This said, the fact that I managed to change model animation entirely (that didn't work with sole animations as you said), made my code much more simple and stable, because when I was replacing them (temporarily), I had to transfer all the specific attributes to the temporary form, as well as all the triggers attached to them.

I suppose that if the engine does all this internally, it can't be a bad thing.
 
Level 12
Joined
Jan 30, 2020
Messages
875
Well nice to hear that, really strange considering I have the exact opposite issue as it's the model itself for me that does not update before moving :D
 
Status
Not open for further replies.
Top