• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

passive abilities help

Status
Not open for further replies.
Level 3
Joined
Jun 7, 2016
Messages
21
Hi Guys, i need some help with my passive ability trigger,

what i have currently is a passive ability that create dummy unit like "feral spirit" to attack, but i do not know how to make the trigger stop once it summon 2 units as it keep summon more units each time the Hero is attacked.

Thank for the Help.
 
Level 20
Joined
May 16, 2012
Messages
635
Add a condition to the trigger. Go to the condition part of the trigger and under the integer comparison choose "Count Living Units Owned By Player" and change the operator from "Equal To" to "Less Than" and the value to "2", of course set the unit type in the condition to your unit.

  • Cond_Example
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Number of living "Your Unit Here" units owned by (Owner of (Triggering unit))) Less than 2
    • Actions
      • Create Your Unit
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I think that the condition "number of living units owned by player" leaks a group. You would want to create a group and set it to "number of living wolves owned by player" and then use an If Then Else Statement to check the number of units in that newly created group, then destroy the group after you're done with it.

Anyway, I attached a map with two examples of how you could do this using Integers and a Unit Indexer. The first example is MUI and uses a Unit Indexer and the other example is very basic and works for only one player.

The Unit Indexer version is great because it keeps track of each individual Hero's "wolf count". So you could have multiple Heros out at once and it will work for all of them.
 

Attachments

  • Summon Wolf.w3x
    23.1 KB · Views: 41
Last edited:
Level 3
Joined
Jun 7, 2016
Messages
21
I think that the condition "number of living units owned by player" leaks a group. You would want to create a group and set it to "number of living wolves owned by player" and then use an If Then Else Statement to check the number of units in that newly created group, then destroy the group after you're done with it.

Anyway, I attached a map with two examples of how you could do this using Integers and a Unit Indexer. The first example is MUI and uses a Unit Indexer and the other example is very basic and works for only one player.

The Unit Indexer version is great because it keeps track of each individual Hero's "wolf count". So you could have multiple Heros out at once and it will work for all of them.


I am unable open the attached map.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
You must be using an older version of warcraft that isn't compatible with the unit indexer.

All you need to do is recreate these 2 triggers and then import a Unit Indexer into your map. I was using Bribe's Unit Indexer so maybe try to find an older version of it.
variables:
CV = Integer
TempPoint = Point
WolfCount = Integer (Array)
WolfOwner = Unit (Array)
  • Summon Wolf MUI
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Wolf Summoner
    • Actions
      • Set CV = (Custom value of (Attacking unit))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WolfCount[CV] Less than 2
        • Then - Actions
          • -------- Increase the summoning unit's wolf count by 1 --------
          • Set WolfCount[CV] = (WolfCount[CV] + 1)
          • -------- --------
          • Set TempPoint = (Position of (Attacking unit))
          • Unit - Create 1 Wolf for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
          • Set CV = (Custom value of (Last created unit))
          • Custom script: call RemoveLocation (udg_TempPoint)
          • -------- --------
          • -------- Link the summoned wolf to it's owner (the summoning unit) --------
          • Set WolfOwner[CV] = (Attacking unit)
        • Else - Actions
  • Wolf Death MUI
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Wolf
    • Actions
      • Set CV = (Custom value of (Triggering unit))
      • Set CV = (Custom value of WolfOwner[CV])
      • -------- --------
      • -------- We get the custom value of the dying wolve's owner (the summoning unit) and with that we can decrease the owner's wolf count --------
      • Set WolfCount[CV] = (WolfCount[CV] - 1)
 
Last edited:
Status
Not open for further replies.
Top