Custom Model Morph Problem

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

X-Angel
Junior Member
Posts: 29
Joined: October 19th, 2007, 1:41 am

Custom Model Morph Problem

Post by X-Angel »

I have this custom model, and it has another "morph" unit built into it, meaning that whenever I cast an ability such as avatar or metamorphosis with it, it will turn into this specific unit. I want to be able to morph this unit with a spell other than avatar, because its scaling value changes with avatar. Metamorphosis is unable to work because since it is only one model, I cannot pick an "alternate form" for it.

Thanks in advance
User avatar
Risen
Forum Staff
Posts: 811
Joined: January 1st, 2008, 12:58 am

Re: Custom Model Morph Problem

Post by Risen »

I think this can be triggered.. h/o 1 second..
Spoiler:

Code: Select all

//native SetUnitAnimation takes unit whichUnit, string whichAnimation returns nothing

function Morph takes nothing returns nothing
  local unit u = GetTriggerUnit()
  
       call SetUnitAnimation( u, "morph" )//the string of your animation
  call RemoveUnit( u ) //no leaks
  set u = null//do this if you want
endfunction

function init takes nothing returns nothing
  local trigger t = CreateTrigger()
  local integer i = 0
    
       loop
       exitwhen i > bj_MAX_PLAYER_SLOTS //Change this to 1 less than your maximum players, E.G 12 players == 11
             
             call TriggerRegisterPlayerUnitEvent( t, Player ( i ), EVENT_PLAYER_UNIT_SPELL_EFFECT )
             
       set i = i + 1
       endloop
             call TriggerAddAction( t, function Morph )
             
endfunction
That should do it.
Image
Wanna learn to hack maps? --> Guide