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

Remove hero trigger?

Status
Not open for further replies.
Level 7
Joined
May 21, 2009
Messages
289
I need a trigger that does something similar to this-

Events
Player 1 types -repick as an exact match
....ect

Actions

Unit Group- Pick all units in (playable map area) owned by (triggering player)
-loop actions
--Remove Hero?

OR

Remove Hero from (triggering player)?

I need an action that "REMOVES" one hero owned by the the triggering player? Is there such an action? I cannot remove all units on the map, and the hero could be anywhere on the map.
 
Level 13
Joined
Jun 22, 2004
Messages
783
This would randomly remove 1 hero from the player that typed the string, I wouldn't really recommend this action too much but it does what you ask.
  • Events
    • Player - Player 1 (Red) types a chat message containing remove as An exact match
  • Conditions
    • Actions
      • Unit - Remove (Random unit from (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) from the game
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
This would randomly remove 1 hero from the player that typed the string, I wouldn't really recommend this action too much but it does what you ask.
  • Events
    • Player - Player 1 (Red) types a chat message containing remove as An exact match
  • Conditions
    • Actions
      • Unit - Remove (Random unit from (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) from the game

This would cause leaks :/ (though it's not serious)
A method that always works and doesn't cause any leaks is this:

Whenever a player chooses a hero, set the variable "Hero[Player number of Owner of (Triggering unit)]" (Variable type: unit, array: yes) to the last created unit (which is the hero that the player has chosen, though it can be something else if you use another system to choose heroes).

When a player types -repick, simply use this action:
  • Unit - Remove Hero[Player number of (Triggering Player)]
You can use the same variable for every trigger where you want to pick a specific hero (e.g.: when you want a hero to enter an arena).

This variable is actually highly recommended for every map where a player can choose a hero (such as an AoS, RPG, Hero Arena, ...).
 
Level 7
Joined
May 21, 2009
Messages
289
Okay so- Tried the trigger, didn't work, I must have something wrong- The "hero" part of the array is the variable, I set it to "unit" variable type, Array, Ive tried array sizes 1, and 10, and Intial value is "no unit"

Here is the whole trigger set...

  • Remove and Teleport
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Set hero[(Player number of (Owner of (Triggering unit)))] = (Sold unit)
      • Unit - Remove (Random unit from (Units in New Player Start <gen> owned by (Owner of (Sold unit)))) from the game
      • Unit - Move (Sold unit) instantly to (Center of Palace Exit Outside <gen>)
      • Camera - Apply White Gold Outside <gen> for (Picked player) over 0.00 seconds
      • Dialog - Clear Race_Dialog
      • Dialog - Change the title of Race_Dialog to Choose Race Bonus
      • Dialog - Create a dialog button for Race_Dialog labelled Argonian - 20% Evas...
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Giant - 200 Bonus H...
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled High Elf - 200 Bonu...
      • Set DialogButton[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Imperial - +50 Gold...
      • Set DialogButton[4] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Khajiit - 25% Attac...
      • Set DialogButton[5] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Nord - 35% Spell Re...
      • Set DialogButton[6] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Orc - 20% Bonus Dam...
      • Set DialogButton[7] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Redguard - 200% HP ...
      • Set DialogButton[8] = (Last created dialog Button)
      • Dialog - Create a dialog button for Race_Dialog labelled Wood Elf - Summon C...
      • Set DialogButton[9] = (Last created dialog Button)
      • Dialog - Show Race_Dialog for (Owner of (Buying unit))
  • Repick
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as An exact match
    • Conditions
      • (Number of living New Game or Repick units owned by Player 1 (Red)) Equal to 0
    • Actions
      • Unit - Remove hero[(Player number of (Triggering player))] from the game
      • Wait 0.01 seconds
      • Unit - Create 1 New Game or Repick for (Triggering player) at (Center of New Game or Repick <gen>) facing Default building facing degrees
      • Camera - Apply Repick <gen> for (Triggering player) over 0.00 seconds
Can you tell me what I did wrong?

EDIT:
The Hero isn't removed when I type "-repick"
 
Status
Not open for further replies.
Top