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

How to make unit switch between animations trigger help

Status
Not open for further replies.
Level 2
Joined
Dec 16, 2021
Messages
4
Custom model: Treasure Guardian

So I’m trying to make this custom model use alternate animations when the player enters specific region.
I have 4 players and I want for custom unit to use it’s stand animation when there are no players in the region, and if there are players in the region to use alternate animations and morphs. So basically I want it to stay in its pile shape when no one is around and when someone gets close to change into fight form.
Not good at triggers so can anyone help me do it?
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
I would try to do this via morph ability like Bear Form.
  • Create your guardian twice - one version will be the active version, the other will be the pile version
  • In Object editor, set the following fields for the pile version:
    • Movement - Speed Base: 0.0
    • Movement - Type: 'None' (this will prevent the unit from moving)
    • Combat - Attacks Enabled: 'None' (this is optional)
    • Abilities - Normal: Add the 'Invulnerable' ability (this will make the pile version invulnerable even during the transition to active version)
  • In Object editor , set the following fields for the active version:
    • Art - Required Animation Names - add the 'alternate' string here
  • At this point if you put the pile and active version in your map, you should see both of them with correct animations
  • Next, create a spell based off the Bear Form ability
    • Clear the 'Techtree - Requirements' field of any research
    • Set Mana Cost to 0.0
    • Set 'Data - Alternate Form unit' to your active version
    • Set 'Data - Normal Form unit' to your pile version
    • Give this ability to both versions of your unit
  • At this point, if you place the pile version in your map and control it, you should be able to use the custom Bear Form ability to switch between the pile and active versions
Next is the trigger part. You can detect when any unit detects and check who the entering (triggering) unit is.
In the trigger below, I order a Druid of the Claw to cast the Bear Form if a unit enters the region and the triggering unit is not the Druid himself.
This trigger will execute just once and then turn off.
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to Druid of the Claw (Night Elf Form)
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order Druid of the Claw (Night Elf Form) 0000 <gen> to Night Elf Druid Of The Claw - Bear Form.
Note: If you based off the morphing ability off the Bear Form, then you will also want to order your unit to cast "Bear Form" (since that is the order id of your custom ability that is based off Bear Form).
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
I made an example map based on what Nichilus said.

Regions are actually broken (not a lot of people realize this), so I provided a fix to this in my map.
The issue is discussed after my first post:

You're going to want to filter which units cause the Treasure Guardian to wake up/sleep. You can do this here in the Check Treasure Region trigger:
  • Unit Group - Pick every unit in TreasureGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ((Picked unit) is alive) Equal to False
              • (Owner of (Picked unit)) Equal to Neutral Passive
              • (Owner of (Picked unit)) Equal to Neutral Hostile
        • Then - Actions
          • Unit Group - Remove (Picked unit) from TreasureGroup.
        • Else - Actions
I'm ignoring Dead units, Neutral Passive units, and Neutral Hostile units. Every other unit will "wake up" the Treasure Guardian. The Treasure Guardian can wake itself up, so make sure to filter it out (I made mine owned by Neutral Passive which solves this).
 

Attachments

  • Treasure Morph.w3m
    64.3 KB · Views: 7
Last edited:
Level 2
Joined
Dec 16, 2021
Messages
4
Thank you both so much! I didn’t expect I’d get such detailed responses. Will add this to my map and read through the triggers carefully to finally learn how to set them up properly, thank you again, both of you.
 
Status
Not open for further replies.
Top