• 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.

Locating a unit and placing it into a variable?

Status
Not open for further replies.
Level 2
Joined
Oct 12, 2008
Messages
13
I was wondering if someone would point me in the right direction on how to make a trigger locate a unit (a hero) and store that unit into a variable for later use. I've been experimenting with triggers, but none of my ways seem to work. I want this trigger to be able to store more than one player's hero, so I'm guessing variable arrays and player number of owner of triggering unit is required? This will be for a RPG and I want to make something move to the position of a hero of a certain player. I hope you catch my drift and understand what I'm trying to say. Thanks in advance.
 

peq

peq

Level 6
Joined
May 13, 2007
Messages
171
Its always best to save the heros to variables at the moment they enter the map. So the easiest way would be to expand your hero-selection trigger to store the hero in an array as you already said.

set Hero[Player Number of (Owner Of (Last Created Unit))] = Last Created Unit

If yuo use taverns you can use a trigger which detects units entering the map.
 
Status
Not open for further replies.
Top