HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Best way to change a unit's model

02-13-2006, 07:27 PM#1
badhex
What's the easiest/best way to change a hero's model on the fly. I am working on a trigger that will change a unit's model when a unit is attacked. I tried the chaos ability but found it was very buggy.
02-13-2006, 07:30 PM#2
Jacek
you can't change model as far as I know, you must change the unit. You could use Berserk, or some morphing ability.
02-13-2006, 07:31 PM#3
TDR
Couldn't you just make 2 copies of a unit, but with 2 different models, and hide/unhide the units accordingly when needed?
02-13-2006, 07:51 PM#4
badhex
The trouble is I don't want to loose cooldown information.

When I add the chaos ability it swaps the unit's model, however, if I have any armor enhancing abilities on the hero it does funky things like add tons of armor to the hero (bug with war3 it seems).

Code:
function Morph_Tolen takes unit MORPH_ME returns nothing
    call PlaySoundOnUnitBJ( gg_snd_HPitLordYes2, 100, MORPH_ME )
    call KillSoundWhenDone( GetLastPlayedSound() )

    call UnitAddAbilityBJ( 'S003', MORPH_ME )

    call TriggerSleepAction( 20.00 )

    call PlaySoundOnUnitBJ( gg_snd_KaelWhat1, 100, MORPH_ME )
    call KillSoundWhenDone( GetLastPlayedSound() )

    call UnitAddAbilityBJ( 'S004', MORPH_ME )

    call TriggerSleepAction( 0.50 )
    call EnableTrigger(gg_trg_Spell_Dark_Frenzy)
    call EnableTrigger( GetTriggeringTrigger() )
endfunction

This is an example of me adding the chaos ability to the hero. Am I doing something wrong with it?
02-13-2006, 07:54 PM#5
Jacek
Chaos swaps unit model? No... no... it replaces units like Orc Grunts with Fel Grunts etc.
02-13-2006, 07:57 PM#6
badhex
But, for example if I copy the hero exactly and put it in a custom chaos spell it will change the model and keep the same stats. It works great as long as the hero has no armor item bonus. The nice part is it remembers the unit's cooldowns.
02-13-2006, 08:09 PM#7
Anitarf
It really is nice, the nicest thing you'll probably get, so you'll just have to code around it by removing any bonus armor/damage modifiers before morphing the unit; all you have to do is remove any aura buffs and items.
02-13-2006, 08:20 PM#8
Immoralis
so before u chaos, you remove buffs and items , then theres no funky stuff?
02-13-2006, 08:23 PM#9
badhex
the agility armor bonus buggs out also :(
02-13-2006, 08:31 PM#10
Anitarf
decrease agility to 0, morph, increase agility back.

Yeah, I know, seems like a lot of work... but I don't know of any other way to keep ability cooldowns on the unit...
02-13-2006, 08:49 PM#11
badhex
This bug has to go... There are WAY too many things that can change a unit's armor that I would have to include in the trigger. :(
02-14-2006, 06:22 AM#12
qwertyui
AFAIK Chemical Rage is able to swap unit without losing cooldown data.
Same with Metamorphosis.
02-15-2006, 02:39 PM#13
badhex
I tried both of these abilities with mixed results. Using metamorphosis caused my unit's stats to morh (but no model) for the duration. Then his model would change (stats changed back) with a new timer. Then everything would return to normal.

Chem Rage caused the unit to morph and then the game to crash for some unknown reason.

I think my main issue is I don't want an icon to control the ability. I would rather triggers morph the unit with no icon display.
02-15-2006, 02:45 PM#14
Chuckle_Brother
Chemical Rage crash is likely due to the half assed way blizzard added that hero. Half its goddamned spells bug out and are unchangeable unless you enjoy fatal crashes.

Your best bet is going to lie with Metamorphosis, and just remove the life bonuses and make the alternate form your same hero but with a different model.