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

Building birth problems

Status
Not open for further replies.
Birth "effects" as you called them are actually part of the model. It is a sequence of the models animation. Models often have several animations, i.e. attack, stand, death, birth, etc. Only some doodads and effects have only one animation. All building's in the default version of Blizzard's Warcraft III have only one birth animation which it the same for the race. So you can't "change it" without editing the model. You can, however, add animation models with triggers to create the appearance of a specific birth animation. Since it is shared, you might use it for all the buildings you want to "change."

There are 3 such models "hidden" in the game and you can use them by referencing the pathname. These pathnames are as follows:

SharedModels\NEBirth.mdl
SharedModels\UBirth.mdl
buildings\naga\TidalGuardian\NagaBirth_Small

Other models can be imported and are available in our model section:

http://www.hiveworkshop.com/forums/models-530/forgotten-one-birth-64872/?prev=search%3Dbirth%26d%3Dlist%26r%3D20
http://www.hiveworkshop.com/forums/models-530/birth-mesh-161322/?prev=search%3Dbirth%26d%3Dlist%26r%3D20
http://www.hiveworkshop.com/forums/models-530/nerubian-birth-267174/?prev=search%3Dbirth%26d%3Dlist%26r%3D20
http://www.hiveworkshop.com/forums/models-530/ne_birth_corrupt-110551/?prev=search%3Dbirth%26d%3Dlist%26r%3D20

I hope I helped answer your question.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I kind a want to do the same thing on my map.
Can you post the trigger(s) how to do this?

And some of the buildings I'm building don't have birth animation - they look "already build" when I start building them. Would doing it this way just add the birth model, or will it REPLACE their model (during building)?
 
Level 12
Joined
Jan 2, 2016
Messages
973
Yes, this helped :)
+ rep

The only thing that is bothering me now is the "building stages"
the animation has several stages, but with this trigger - it will just end before the animation is over, or it may even start another animation before the building is built... Is there any way to control the animation speed?
 
Level 12
Joined
Jan 2, 2016
Messages
973
You mean:
Event: a unit starts construction
Actions: make the structure transparent
create 1 dummy builder at temp_point (location of construction)
if Constructing Structure unit-type is equal to '1'
order last created unit to build '1(model)'
elseif constructing structure unit-type is equal to '2'
order last created unit to build '2(model)'
etc..?

Where '1(model) has build time equal to '1's build time, and the desired construction model, and locust ability.

EDIT: Actually no need to answer.. I guess I'll just try it myself. I got enough information now :p
 
This is how I did it, but I am sure there is a better way.
  • Hut Birth
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructing structure)) Equal to Pandaren Hut
          • (Unit-type of (Constructing structure)) Equal to Death Tower
    • Actions
      • Set tempp1 = (Position of (Constructing structure))
      • Unit - Create 1 Build Dummy for Neutral Passive at tempp1 facing Default building facing degrees
      • Unit - Add a 37.00 second Generic expiration timer to (Last created unit)
      • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 70.00%, 100.00%) with 0.00% transparency
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using SharedModels\NEBirth.mdl
      • Set T_Fx[(Integer((X of tempp1)))] = (Last created special effect)
      • Custom script: call RemoveLocation(udg_tempp1)
  • Birth Animation Stop
    • Events
      • Unit - A unit Finishes construction
      • Unit - A unit Cancels construction
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Pandaren Hut
          • (Unit-type of (Triggering unit)) Equal to Death Tower
          • (Unit-type of (Constructing structure)) Equal to Corruption Tower
    • Actions
      • Set tempp1 = (Position of (Triggering unit))
      • Special Effect - Destroy T_Fx[(Integer((X of tempp1)))]
      • Custom script: call RemoveLocation(udg_tempp1)
It's not perfect, but it looks alright. I used the NE birth animation to create a birth for the fishing villiage huts.

Another way I did this for a different unit was to slowly increase the size of the unit being built.

This was a Goblin Hut. I make it small and added a dust animation. It looks the the birth animation from the Dalaran Ruins tower birth.
  • Goblin birth animation
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructing structure)) Equal to Goblin Hut
          • (Unit-type of (Constructing structure)) Equal to Goblin Factory
    • Actions
      • Set GH_Int = (GH_Int + 1)
      • Set GH_Counter[GH_Int] = 100
      • Set GH_Hut[GH_Int] = (Constructing structure)
      • Set GH_Loc[GH_Int] = (Position of GH_Hut[GH_Int])
      • Unit Group - Add GH_Hut[GH_Int] to GH_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructing structure)) Equal to Goblin Hut
        • Then - Actions
          • Animation - Play GH_Hut[GH_Int]'s stand work animation
        • Else - Actions
      • Custom script: call RemoveLocation(udg_GH_Loc[udg_GH_Int])
      • Trigger - Turn on GH birth animation loop <gen>
  • GH birth animation loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer GH_LoopIndex) from 1 to GH_Int, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GH_Counter[GH_LoopIndex] Greater than 0
              • (GH_Hut[GH_LoopIndex] is alive) Equal to True
            • Then - Actions
              • Set GH_Fx[GH_LoopIndex] = (Last created special effect)
              • Set GH_Counter[GH_LoopIndex] = (GH_Counter[GH_LoopIndex] - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of GH_Hut[GH_LoopIndex]) Equal to Goblin Hut
                • Then - Actions
                  • Animation - Change GH_Hut[GH_LoopIndex]'s size to ((60.00 - ((Real(GH_Counter[GH_LoopIndex])) x 0.60))%, 100.00%, 100.00%) of its original size
                • Else - Actions
              • Special Effect - Create a special effect attached to the origin of GH_Hut[GH_LoopIndex] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
              • Set GH_Fx[GH_LoopIndex] = (Last created special effect)
              • Special Effect - Destroy GH_Fx[(GH_LoopIndex - 1)]
            • Else - Actions
              • Special Effect - Destroy GH_Fx[GH_LoopIndex]
              • Unit Group - Remove GH_Hut[GH_LoopIndex] from GH_Group
              • Set GH_Hut[GH_LoopIndex] = No unit
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in GH_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Set GH_Int = 0
                • Else - Actions
I hadn't learned to de-index properly back then, but that's the basic idea.

The other way would be to edit the model with a third-party model editing program.
 
Level 12
Joined
Jan 2, 2016
Messages
973
JASS:
function UT_Comparison takes integer ut returns integer
    if ut == 'n00N' then
        return 1
    elseif ut == 'n002' or ut == 'n00O' then
        return 2
    elseif ut == 'n00M' or ut == 'e005' then
        return 3
    elseif ut == 'n00P' then
        return 4
    endif
    return 0
endfunction

function Cosmetics takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local unit c
    local integer i = UT_Comparison(GetUnitTypeId(u))
    if i != 0 then
        call SetUnitVertexColor( u , 100, 100, 100, 1 )
        set c = CreateUnit( GetOwningPlayer(u), 'n01F', x , y , 0.00 )
        if i == 3 then
            call SetUnitScalePercent( c , 100, 100, 100 )
        elseif i == 4 then
            call SetUnitScalePercent( c , 160, 160, 160 )
        endif
        call SetUnitAnimation( c , "birth" )
        call SaveUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 , c)
    endif
    return false
endfunction

function Cosm_Removal1 takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local unit c
    local real x
    local real y
    local integer i = UT_Comparison(GetUnitTypeId(u))
    if i != 0 then
        set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
        call RemoveUnit(c)
        call SetUnitVertexColorBJ( u , 100, 100, 100, 0.00 )
        if i == 1 then
            set x = GetUnitX(u) - 110
            set y = GetUnitY(u) + 25
            set c = CreateUnit( GetOwningPlayer(u), 'h00F', x, y, 270.00 )
            call SaveUnitHandle( udg_Cosmetic_Table, GetHandleId(u), 0 , c )
        endif
        call SaveBoolean( udg_Cosmetic_Table, GetHandleId(u), 1, true )
        set c = null
    endif
    set u = null
    return false
endfunction

function Cosm_Removal2 takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local unit c
    local real x
    local real y
    local effect e
    local integer i = UT_Comparison(GetUnitTypeId(u))
    if i != 0 then
        if LoadBoolean( udg_Cosmetic_Table, GetHandleId(u), 1 ) then
            if i == 1 then
                set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
                set x = GetUnitX(c)
                set y = GetUnitY(c)
                call RemoveUnit(c)
                set e = AddSpecialEffect("Abilities\\Weapons\\GlaiveMissile\\GlaiveMissileTarget.mdl", x, y)
                call DestroyEffect(e)
                set e = null
            endif
        else
        set c = LoadUnitHandle(udg_Cosmetic_Table, GetHandleId(u), 0 )
        call RemoveUnit(c)
        call FlushChildHashtable(udg_Cosmetic_Table, GetHandleId(u))
        set c = null
        endif
    endif
    set u = null
    return false
endfunction

//===========================================================================
function InitTrig_Building_models takes nothing returns nothing
    local trigger t = CreateTrigger()
    local trigger r = CreateTrigger()
    set gg_trg_Building_models = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Building_models, EVENT_PLAYER_UNIT_CONSTRUCT_START )
    call TriggerAddCondition( gg_trg_Building_models, Condition(function Cosmetics) )
    call TriggerRegisterAnyUnitEventBJ( r , EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
    call TriggerRegisterAnyUnitEventBJ( r , EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL )
    call TriggerAddCondition( t , Condition(function Cosm_Removal1) )
    call TriggerAddCondition( r , Condition(function Cosm_Removal2) )
    set t = null
    set r = null
endfunction
That's what I'm doing (still got work on it, but from my tests so far - it looks nice) :)
 
Last edited:
Level 12
Joined
Jan 2, 2016
Messages
973
Okay, now I have another problem...
When I replace the night elf's building animation with human building animation - the special effect still remains - it looks like a human construction with green glow above it.. any way to get rid of this?
 
Status
Not open for further replies.
Top