• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Command to eliminate/kill creatures.

Level 4
Joined
Oct 9, 2024
Messages
59
I'm making a shaman hero and I'm giving him a list of totems to summon, I would like him to have several options of totems to use but only keep one totem active at a time, but I run into the problem that when I made the totem of earth and fire are different skills they do not interact with each other, I need a trigger that when using one of the totems any other existing totem is removed, an example would be when using the wind totem any earth totem that still exists is killed.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,401
I'm making a shaman hero and I'm giving him a list of totems to summon, I would like him to have several options of totems to use but only keep one totem active at a time, but I run into the problem that when I made the totem of earth and fire are different skills they do not interact with each other, I need a trigger that when using one of the totems any other existing totem is removed, an example would be when using the wind totem any earth totem that still exists is killed.
So you need to:
1) Keep track of the last created totem.
2) Detect when a totem is created.
3) Remove the tracked totem.

#1 can be achieved with various Variable types, the first that comes to mind is the Unit variable which keeps track of a single Unit.

#2 can be achieved with various Events, the first that comes to mind is "A unit Spawns a summoned unit" assuming these totems are summoned. Additionally, you'll need a Condition which checks the Unit-Type of the (Summoned unit). That way you can be certain it wasn't the Archmage's Water Elemental that was summoned but one of your Totems.

#3 can be achieved with the "Kill unit" or "Remove unit" Actions, which respectively kills the unit or poofs it from existence (skipping death).

This can be achieved with one single trigger and one single variable. I suggest trying to figure this out on your own and come back with your results:
Of course you can post any questions you have as you go.
 
Last edited:
Level 4
Joined
Oct 9, 2024
Messages
59
I'm having problems, I believe it's precisely with the variant, I've already made variants before and I may not have completely mastered them yet, if it's possible to post a map with this trigger in a functional way I would be very grateful.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,401
I'm having problems, I believe it's precisely with the variant, I've already made variants before and I may not have completely mastered them yet, if it's possible to post a map with this trigger in a functional way I would be very grateful.
By variant I assume you mean variable. Here's where and how you can create them:

Step 1: Create the Variable by clicking this green button or pressing Control + L. You can also press Control + B to open the Variables menu:
open var menu.png

Step 2: Change it's Variable Type to Unit since that's what we want to keep track of:
new var.png

Step 3: Rename it to something that makes sense to you:
final var.png

You can now reference this variable in any of your triggers:
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Unit - Create 1 Earth Totem for Player 1 (Red) at (Center of (Playable map area))
    • Set Variable MyUnitVariable = (Last created unit)
    • Wait 3.00 seconds
    • Unit - Kill MyUnitVariable
 
Last edited:
Level 4
Joined
Oct 9, 2024
Messages
59
I believe I found the problem, My text must have been confusing, I don't want it to always have an active totem, I want to set the limit of having a maximum of 1 active totem at a time, there will be times when it will have 0 totems because the base time of the totem has ended or it has died, I believe my problem is in the type of variant because my editor is not recognizing the variants that I put when doing the actions.
 
Level 4
Joined
Oct 9, 2024
Messages
59
Maybe a command so that when the ability to summon fire totem is used all air, aqua and earth totems on the map are removed.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,401
I know what you want and I explained how to do it in my first post. My second post shows how to create a VARIABLE which is part of the process.

The trigger at the bottom of my 2nd post is an EXAMPLE of using a Variable, which you can then use as a reference when trying to follow my first post.
So you need to:
1) Keep track of the last created totem.
2) Detect when a totem is created.
3) Remove the tracked totem.

#1 can be achieved with various Variable types, the first that comes to mind is the Unit variable which keeps track of a single Unit.

#2 can be achieved with various Events, the first that comes to mind is "A unit Spawns a summoned unit" assuming these totems are summoned. Additionally, you'll need a Condition which checks the Unit-Type of the (Summoned unit). That way you can be certain it wasn't the Archmage's Water Elemental that was summoned but one of your Totems.

#3 can be achieved with the "Kill unit" or "Remove unit" Actions, which respectively kills the unit or poofs it from existence (skipping death).
Try to do what I suggested here, then post your triggers if it doesn't work, and we can go from there.
 
Last edited:
Level 4
Joined
Oct 9, 2024
Messages
59
As you can see, I created the variable and defined the unit type for each number in the variable, but this variable simply does not appear in the final part of defining which unit to kill.
 
Level 28
Joined
Aug 29, 2012
Messages
1,222
That's easy enough, you are defining an unit-type variable, but the function asks for a specific unit. If you set it as "unit" instead, you can then do something like this

  • Fire Totem
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Fire Totem /// Here an unit-type is ok
    • Actions
      • Unit - Kill FireTotem /// It will remove any previously declared fire totem by this trigger
      • Unit - Kill WaterTotem
      • Unit - Kill WindTotem
      • Unit - Kill EarthTotem
      • Set VariableSet FireTotem = (Summoned unit)
And a similar trigger for other elements
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,401
As you can see, I created the variable and defined the unit type for each number in the variable, but this variable simply does not appear in the final part of defining which unit to kill.
A Unit-Type variable is not the same as a Unit variable. In my picture I literally highlighted and drew an arrow to the word the Unit.

Anyway, what Chaosium suggested is what I was hoping you would figure out, which you did get close to doing.

However, you only need one trigger and one variable to achieve this:
  • Fire Totem
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • Or - Multiple conditions are (true)
        • (Unit-type of (Summoned unit)) Equal to Fire Totem
        • (Unit-type of (Summoned unit)) Equal to Water Totem
        • (Unit-type of (Summoned unit)) Equal to Air Totem
        • (Unit-type of (Summoned unit)) Equal to Earth Totem
    • Actions
      • Unit - Kill MyTotem
      • Set Variable MyTotem = (Summoned unit)
Understand that a Unit is an individual and a Unit-Type is it's Type. The type refers to the data in the Object Editor's "Unit" tab. You can have 10 Footman on the map all with different stats, abilities, names, owners. These are all individual Units. However, they all share one thing in common -> They're all of the same TYPE, a Footman.
 
Last edited:
Top