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

Player Selects a Unit

Status
Not open for further replies.
Level 1
Joined
Mar 30, 2008
Messages
2
Im working on a duel Trigger . This is how i want it to work:
A Player writes "-duel" in the game chat and the trigger should storage this player in a variable (no problem so far) and then check if the player has a unit selected and if this unit is a friendly hero storage this unit in a variable. Don't care about the rest for now.

Now here is my problem: How do I know which unit the player typing the message has selected? There is no such thing as "Unit - selected Unit". I've thought about working with the event "Player Player (1-12) selects a Unit" but I don't think that i can then work with "Unit - Triggering Unit" as this is a player event. I hope you get what my Problem is, I've searched this forum for "duel" and "select unit" but didn't get any helpful information. I'm sorry if my english isn't that great and I don't have the english world editor, so some labels might be wrong.
 
Level 5
Joined
Jan 3, 2008
Messages
164
I get what you mean man. Here is the trigger:
  • Duel
    • Events
      • Player - Player 1 (Red) types a chat message containing -duel as An exact match
      • Player - Player 2 (Blue) types a chat message containing -duel as An exact match
      • Player - Player 3 (Teal) types a chat message containing -duel as An exact match
      • Player - Player 4 (Purple) types a chat message containing -duel as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -duel as An exact match
      • Player - Player 6 (Orange) types a chat message containing -duel as An exact match
      • Player - Player 7 (Green) types a chat message containing -duel as An exact match
      • Player - Player 8 (Pink) types a chat message containing -duel as An exact match
      • Player - Player 9 (Gray) types a chat message containing -duel as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -duel as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -duel as An exact match
      • Player - Player 12 (Brown) types a chat message containing -duel as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Triggering player)) Equal to True
            • Then - Actions
              • Set UnitSelectedByPlayer = (Picked unit)
            • Else - Actions
              • Do nothing
I hope this has solved your problem..
 
Status
Not open for further replies.
Top