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

Select unit trigger

Status
Not open for further replies.
Level 4
Joined
Feb 12, 2006
Messages
99
apocalypse_dude said:
condition: Triggering unit equals to selected unit

I'm not sure that will work. I think that Selected Unit will only refer to an Event or an Action [i.e., you select a unit with a trigger action]

I'm not sure how you would do it, I'm pretty sure there's a JASS code...function...thingy for it, [like smart is for right clicking], then you could use that for an Event in a trigger that would have an Action that would set the unit to a variable with an array according to the owning player of the selected unit. Anyways...I hope you get what you need!
 
Level 6
Joined
Feb 18, 2005
Messages
263
it works even easier

condition:
integer - Count units in group(Units selected by Player(whatEver) matching (whatEver = owner of matching unit)) > 0

if true - the player has selected a unit of himself, else he hasn't

that way you can even to 'pick every unit in group(units selected by (whatEver) do...' or stuff like that
 
Level 3
Joined
Mar 31, 2006
Messages
33
Well I trying this but I don't really understand so I'll write you what I have in my trigger ( it's a removing trigger ) and u'll simpely tell me what wrong (or not).

Trigger: Player - Player 1 (red) types a chat message containing remove as an exact match

Condition: ((Number of units in(Unit selected by player 1 (red))) greater than 0) and ( its a condition with and) (player 1 (red) equal to owner of (triggering unit)))

Action: Unit - remove (triggering unit) from game
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You need three triggers

=========================================

SelectionTrigger

Events
Player - Player 1 (Red) Selects a unit

Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)

Actions
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to UnitGroup)

===============================

TextTrigger

Events
Player - Player 1 (Red) types a chat message containing remove as An exact match

Conditions
-

Actions
Unit Group - Pick every unit in UnitGroup and do (Unit - Remove (Picked unit) from the game)

=================================

RemoveUnitsFromGroup

Events
Player - Player 1 (Red) Deselects a unit

Conditions
-

Actions
Unit Group - Remove (Triggering unit) from UnitGroup



=====================================

Should work. You can deselect units, if you change your mind. Doesn't remove enemy units.
 
Level 6
Joined
Feb 18, 2005
Messages
263
i would do it like this:

action:
- Player X types '-remove' as exact match
- <you might do this for all players - doesn't matter for the rest of the code>
condition:
- Integer - Number of Units in Group (Units selected by TriggeringPlayer matching (Owner of matching Unit = TriggeringPlayer)) > 0
actions:
- Unitgroup - Pick every unit in group(Units selected by TriggeringPlayer matching (Owner of Matching Unit = Triggering Player)) and do actions
- - remove picked unit from game
 
Status
Not open for further replies.
Top