How to kill a unit that touches something?

Discussion in 'Maps and Replays' started by xberserkerx1, May 21, 2009.

How to kill a unit that touches something?

Discussion in 'Maps and Replays' started by xberserkerx1, May 21, 2009.

  1. xberserkerx1

    xberserkerx1 Guest

    hey, i want it so that when say... Ling touches a reaver the ling will die. I don't know how to do this, and ideas? thanks
     
  2. Dragon God

    Dragon God New Member

    Joined:
    Nov 10, 2008
    Messages:
    232
    Likes received:
    0
    Trophy points:
    0
    From:
    Vancouver
    Ok ,
    This is how you keep the location on the unit

    Code:
     Requirements:
    always
    
    Actions:
    move loc x on reaver
    preserve trigger
    
    player 1 is the reaver in this case
    For the killing thing
    Code:
    player 2,3,4,5,6,7,8
    
    Requirements: Always
    
    Actions: Kill any unit at loc x 
    There you go, good luck :yes:
     
  3. Ursawarrior

    Ursawarrior New Member

    Joined:
    Oct 17, 2007
    Messages:
    1,651
    Likes received:
    5
    Trophy points:
    0
    From:
    somewhere....not sure
    well... there are two problems...

    1.
    Code:
    player 2,3,4,5,6,7,8
    
    Requirements: Always
    
    Actions: 
    Kill any unit at loc x
    [b]Preserve Trigger[/b]
    
    and
    2.

    if you have other Wait conditions, they will be ignored
     
  4. JakeKessler

    JakeKessler New Member

    Joined:
    Jun 3, 2009
    Messages:
    35
    Likes received:
    0
    Trophy points:
    0
    From:
    Tallahassee, FL
    This alone won't do it; what will happen if you do it this way is when the level starts the trigger will fire once and kill the reaver.

    Here are two ways you could do what you want.

    Code:
    Way #1 -  one trigger
    
    CONDITIONS
     - Always
    ACTIONS
     - Center Location 1 on Reaver for Player 2 at anywhere
     - Kill all Zergling for Player 1 at Location 1
    Preserve Trigger
    Code:
    Way #2 - two triggers
    
    CONDITIONS
     - Always
    ACTIONS
     - Center Location 1 on Reaver for Player 2 at anywhere
     - Preserve Trigger
    
    CONDITIONS
     - Player 1 brings a Zergling to Location 1
    ACTIONS
     - Kill all Zergling for Player 1 at Location 1
     - Preserve Trigger
    The first way is more concise, but Ursawarrior is right: any time you have a trigger firing repeatedly, it can slow down other triggers trying to fire at the same time. Depending on the specifics of your map, this might be avoidable.

    First, is the Reaver moving or stationary? If he's sitting in place (if he's a neutral unit, for example, or if the Zergling is invincible, or if you're using a structure rather than a Reaver), you don't need to move the location at all--just place it over the Reaver in the editor.

    Second, setting up the kill trigger (the second one in Way #2, above) to trigger on the Zergling entering the location rather than "Always" (which is shorthand for "every 2 seconds") means you avoid most of the kind of delays Ursa was talking about. If the Zergling can't possibly die this way more than once--if you're not implementing extra lives or the ability to make more Zerglings--then you can get rid of the Preserve Trigger in that trigger all together.

    Hope this helps!