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

Make unit change weapon based on health

Status
Not open for further replies.
Level 5
Joined
Feb 27, 2009
Messages
115
I have a hero who needs to change his weapons based on his health level. Getting the event to trigger concerning his health level isn't an issue. My question is about the weapon changing.

The HARD way would be to totally swap the unit out with one parked in the edges of the map. This parked unit would have the new weapon.

The EASY way would be to have the hero switch to the SECOND WEAPON that is already in the object editor.

So does anyone know how to get the hero to switch to the second weapon? Does it require an upgrade or something?
 
Level 2
Joined
Mar 9, 2009
Messages
21
What exactly do you mean with "weapon"? Some kind of attatchment to the model? Or just an item? Or the (kind of) damage the unit does?
 
Level 5
Joined
Feb 27, 2009
Messages
115
Sorry, let me be more clear.

There are no model attachments. I am talking purely in the Object Editor.

The change in weapons is that the hero goes from melee to ranged. So weapon one would be a melee sword. Weapon two would be a magical fireball (or some sort of arcane power).

So when the heroes becomes low health (hits a certain percentage), he switches weapons from his melee to his ranged.

I suppose I could have triggers force him to 'morph' into another unit, but I am curious how I can switch to that second weapon in the object editor without having to use another unit.
 
Level 4
Joined
Apr 26, 2008
Messages
67
Will This work?:


  • gdfsgsdfg
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Attacked unit)) Less than or equal to ((Percentage life of (Triggering unit)) x 0.49)
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) in slot 1)
          • Item - Create Tome of Experience at (Center of (Playable map area))
          • Hero - Give (Last created item) to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Attacked unit)) Greater than or equal to ((Percentage life of (Triggering unit)) x 0.50)
            • Then - Actions
              • Item - Remove (Item carried by (Triggering unit) in slot 1)
              • Item - Create Orb of Frost at (Center of (Playable map area))
              • Hero - Give (Last created item) to (Triggering unit)
            • Else - Actions
The items can be changed and such. But I think this will work for what you need?

What it does: When the unit is 49% life or lowers it removes 1 items and give it another. If the unit it 50% life or over, it removed 1 item and gives it another.
 
Status
Not open for further replies.
Top