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

[Trigger] Kill Trigger

Status
Not open for further replies.
Level 2
Joined
Sep 9, 2006
Messages
15
I am trying to make a trigger so when I type in ".kill" the game kills the unit I am currently selecting. Here is my trigger, I want to know why it doesn't work.

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

Actions:
Set tempUnit = (Picked Unit)

If (tempUnit Equal to No unit) then do (Game - Display to Player Group - Player 1 (Red) the text: [Debug] No unit selected!) else do (Unit - Kill tempUnit)

Custom Script: call RemoveUnit(udg_tempUnit)

Note: Is there a special BBcode to show triggers, I see them around the site.
 
Level 3
Joined
Jul 14, 2008
Messages
41
[ trigger] [ /trigger]
And the events etc are added automaticly
And you forgot to declare who is the picked unit.
Put an Unit Group - Pick all units selected by player 1

  • Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Do X
[ trigger]
Trigger
Events
Map initialization
Conditions
Actions
Do X

[ /trigger]
 
Level 2
Joined
Sep 9, 2006
Messages
15
  • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
    • Loop - Actions

What if I don't have any units selected, how do I tell the game to display a message that no units are selected?

Edit: I set tempUnit to a unit group, I cant use the unit comparison

EDIT2: Found it, it was in boolean comparison, thanks guys! +rep
 
Level 8
Joined
Aug 3, 2008
Messages
391
  • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to KILL
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in KILL) Equal to 0
    • Then - Actions
    • Else - Actions
 
Level 3
Joined
Jul 14, 2008
Messages
41
By the way,
to make it only kill if he has only 1 unit selected
then do
  • Conditions
  • (Number of units in (Units currently selected by Player 1 (red))) equal to 1
Methinks it works
 
Level 6
Joined
Apr 23, 2009
Messages
94
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set SELECTION = (Triggering unit)
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing .kill as An exact match
    • Conditions
    • Actions
      • Unit - Kill SELECTION
Simplest way i can think of.
 
Status
Not open for further replies.
Top