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

[Spell] Setting unit animations with triggers : portrait issues !

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2020
Messages
875
Hello everyone.

I recently had issues with portrait animations for a Flying Balls model, and the model works perfectly so far.

For a custom ability called "Torrefaction" that is supposed to burn the target for a few seconds, preventing it to move (yes I know damage would be more sensible but I needed more single target slows ^^).

I made a "roasting flying ball" and a "roasting ball" models, and at first tried to use Polymorph to morph my normal Balls and Flying Balls into "roasted" versions. Polymorph had serious issues with the morphed unit's HP and also did not make the model's portrait update.
Then I tried to use the Chaos ability with the exact same results.

Then I went back to my models and added extra versions of their animations to add "roasted" visuals with the tag "Victory" as AlternateEx didn't seem to like being there besides Alternate.

This made my new trigger for the custom ability extremely simple as you can see in that part of the script :
Lua:
-- unrelated actions in the context of EVENT_PLAYER_UNIT_SPELL_EFFECT
        elseif (sId==SpellID[15]) then -- Torrefaction
            local t,b=CreateTimer(),GetSpellTargetUnit()
            PlayCleanSFX(SFXTor, GetUnitX(b), GetUnitY(b), 1.0, 0.0, 0, 1.5)
            SetUnitMoveSpeed(b, 0.0)
            AddUnitAnimationProperties(b, "victory", true)
            TimerData[t]={b, GetHeroProperName(b)}
            if IsFlying then
                BlzSetHeroProperName(b, "Roasting Flying Ball")
            else
                BlzSetHeroProperName(b, "Roasting Ball")
            end
            TimerStart(t, 2+2*GetUnitAbilityLevel(GetTriggerUnit(), sId), false, function()
                local t=GetExpiredTimer()
                local b=TimerData[t][1]
                DestroyTimer(t)
                BlzSetHeroProperName(b, TimerData[t][2])
                SetUnitMoveSpeed(b, 522.0)
                AddUnitAnimationProperties(b, "victory", false)
                if not(IsUnitType(b, UNIT_TYPE_DEAD)) then
                    PlayCleanSFX(SFXTor, GetUnitX(b), GetUnitY(b), 1.0, 0.0, 0, 1.5)
                    d=Destination[GetUnitUserData(b)]
                    IssueDelayedPointOrder(b, "move", WPx[d], WPy[d], 0.0)
                end
            end)
        end
-- other actions

So all I do is add the animation and change the proper name of the targets (yes my creeps are heroes for the sake of recycling).

Everything works fine except with the portrait, once again.

I know the new versions of the models work perfectly, because if I preplace units having these models with the tag "victory" in Required Animations Names, the units properly show the model and the related portrait. But it doesn't work with adding the animations ingame :(

I know I could easily replace the units with fresh ones (and yes fresh ones have a working portrait for some weird reason), but I have built my complete spawn system around recycling my creeps (Balls), and replacing them, even with a lot of care would render the recycling useless, and also would require to recreate their specific unit triggers everytime.


Does anyone know of a way to change the model of a unit, or to display the proper portrait for a specific sub-animation name like victory, without replacing the unit ?

Note that in the models, I have a portrait animation for every sub-animation, and I also tried with no animation but just a "Portrait" camera with absolutely no better success (and loosing the slight team-colored glow behind the portrait).


One could think this problem is not worth fixing, but the "Roasting" models are quite effective visually in the context, and displaying the basic portrait kind of ruins the effect of the ability (even if it doesn't render it less efficient^^).

I clearly fail to understand why this issue is there to start with...
 
Level 12
Joined
Jan 30, 2020
Messages
875
UPDATE.

Well I ended up hiding the main Ball when hit with the ability, and creating a temporary Unit with the desired model, transferring hp, position, facing angle, other properties and even triggers from the main Ball. I use a timer lasting for the duration of the ability effect, and revert the process once the timer expires.
Was very tricky considering the number of factors involved in this situation, but the fact is that it works.

It is a real pity to have to create complex operations just because Blizzard was too lazy to make some things work properly :/

Anyways, if anyone wants to have a peek at this workaround, I posted the related working "trigger" (Lua) in this thread :
[Solved] - Lua - blindness ?

If someone ever finds a better way to change a model ingame, INCLUDING the portrait, please let me know, thanks !
 
Status
Not open for further replies.
Top