1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Prevent "friendly fire"

Discussion in 'Map Development' started by Lingonberryjam, Aug 11, 2005.

  1. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    Can someone please tell me a nice trigger, or tell me were i can find one here, thet prevents allies from attacking eachother. I'vve tried simple ones, like just order unit to stop, but its kinda buggy and only works from time to time.
     
  2. N00byStance

    N00byStance

    Joined:
    Jul 4, 2005
    Messages:
    1,071
    Resources:
    14
    Models:
    13
    Tutorials:
    1
    Resources:
    14
    In Object Editor, manipulate with unit's Target Allowed property to make unit not able to attack allies.
     
  3. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    exactly how do i do that, theres no "non friendly" i can fill in...

    Maybe just fill in enemy works.
     
  4. Telefragged

    Telefragged

    Joined:
    Feb 4, 2005
    Messages:
    311
    Resources:
    1
    Maps:
    1
    Resources:
    1
    No, it's under ally or something.
     
  5. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,638
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    I think he's talking about ordering a unit to attack a friendly, not the effect of a spell or something. You could copy DOTAs way and make it so when you attack a friendly unit, the attacking unit turns into a sheep.
     
  6. Telefragged

    Telefragged

    Joined:
    Feb 4, 2005
    Messages:
    311
    Resources:
    1
    Maps:
    1
    Resources:
    1
    noobystance is trying to get him to edit unit data in the Object Editor. As you know, you can choose what unit-type a unit can attack. As long as you remove allied and add enemy, you can't attack allies.
     
  7. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,638
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    You can still order a unit to attack a friendly unit... Example: You have two grunts, you click the attack icon and select your other grunt.
    Example: You have a grunt and your ally has a grunt, you can order you grunt to attack his grunt.

    Those fields in the unit object editor only apply to the units AI, it is still capable of attacking other things.
     
  8. Giant Halfling

    Giant Halfling

    Joined:
    Jul 16, 2005
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Code (Text):
    Event: Unit is attacked
    Conditions: Boolean - ((Owner of attacking unit) is an ally of (owner of attacked unit) equal to TRUE)
    Actions: Unit - Order Attacking unit to (Stop), Unit (Pause) (Attacking unit), wait 2 seconds, Unit (unpause) (attacking unit).
    That will stop from attacking and make thier unit freeze for 2 second penalty. This has always worked for me along with:
    Code (Text):
    Event: Unit is attacked
    Condition: Boolean - ((Owner of attacking unit) is an ally of (owner of attacked unit) equal to TRUE)
    Actions:
      Unit - Order (attacking unit) to stop
      Set Penalty[Player number of attacking unit] = Player[player number of attacking unit] + 1
      If/then/else
        If Integer - Player[player number of attacking unit] equal to 3
        then Unit - Kill attacking unit, Game - Display to [owner of attacking unit]: You have tried to team kill to many times!
        else Do nothing
    For that make Player an integer variable with however many numbers of players as the array, then it sets it to +1, so pretty much if they attack 3 times thier guy dies... Good in a resident evil game i suppose... You could go with a smaller penalty like gold loss, turn em into a sheep (;) kam) or just freeze em again. You can also add a wait then set it to -1, so if they try to attack 3 times in 2 seconds it happens etc...
     
  9. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    Ok, im gonna use one of thoose triggers, since the "targets allowed" are just data on the units AI.

    But while were talking about sheeps, how to turn it into a sheep? Do you need dummy units?, cause i havent learned to use dummy units yet...

    If not, just tell me the trigger... :)
     
  10. skwee

    skwee

    Joined:
    Aug 11, 2005
    Messages:
    26
    Resources:
    1
    Maps:
    1
    Resources:
    1
    no, you're completely wrong. If in the object editor it has enemy checked and allied unchecked when you try to target an ally it will say 'Cannot target allied units'
     
  11. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,638
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    With a spell, jesus. The basic attack can target your own units. Do I really have to make a video for you when you can just play any wc map and see for yourself? I just did it, took me two secs to map a new map to test. You do it.
     
  12. skwee

    skwee

    Joined:
    Aug 11, 2005
    Messages:
    26
    Resources:
    1
    Maps:
    1
    Resources:
    1
    But does the unit attack himself? no... thats what the guy needs
     
  13. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    Man, yhis is one hot discussion... :shock:
    Just to get things sorted out, i meant a trigger to prevent "assholes" from using the "attack" aiming to kill allied players on my map.

    And to add my own opinion, to fill in the boxes in "targets allowed" didnt work for me. I had no allied or friend, but i had enemy signed as a target, but i could still attack my allies.

    I will use trigger, since that also punishes the player who attacks...
     
  14. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,638
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    Events

    A unit is attacked

    Conditions

    (Owner of (Attacking unit)) Not equal to (Owner of (Attacked unit))
    (((Attacked unit) is A ground unit) Equal to true) or ((((Attacked unit) is A flying unit) Equal to True) or (((Attacked unit is A structure) Equal to True))
    ((Attacked unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
    ((Attacked unit) is A neutral unit) Equal to False

    Actions

    Unit - Explode (Attacking unit)
     
  15. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    hehe that was to much punishing for the little incident someone would do, i dont like blowing up people... :p
     
  16. Los_Tacos

    Los_Tacos

    Joined:
    Aug 5, 2005
    Messages:
    219
    Resources:
    7
    Maps:
    7
    Resources:
    7
    Don't make the attacker explode... Simply order it to stop.