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. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    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.

[Trigger] Unit only attacks specific unit

Discussion in 'Triggers & Scripts' started by Hoernchen, Jul 11, 2007.

  1. Hoernchen

    Hoernchen

    Joined:
    Jun 16, 2007
    Messages:
    365
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Hi, how can I do, that a unit only attacks certain types of units?
    Alright more detail:
    I am Player 3
    I build buildings
    Buildings spawn units for Player 1 (NPC)
    Units move and attack to base of Player 7 (Human Opponent of me)
    Now I want to make a special unit called Witch-hunter.
    It's supposed to only attack units like healers, mages and other of those.
    but now how can i do that?
    It has to be not able to attack any other units before all magicians are dead near it, and it has to move on after that to the enemy base...
    Please help!
     
  2. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    I guess you could use a specific "stats -unit classification" for the spellcasters, and allow the Witch-hunter to only attack those with "combat - attack1 - targets allowed"

    For example, have all the spellcasters marked as "ancient", and the Witch-hunters "combat - attack1 - targets allowed" (maybe attack2 aswell i dunno) set to ancients only.

    If the witch-hunters belong to a cpu player then this would do the trick. But if a human player has a witch-hunter, and the forces hiim to attack a unit witch is not an ancient, a message will say "Can only target ancients", which doesnt sound so good. To fix that, you can do this:

    World Editor --> Advanced --> Game Interface --> Text - Message - 'Unable to target Ancients' --> [set the text here to: "Can only target spellcasters"] --> then press ok
     
  3. Hoernchen

    Hoernchen

    Joined:
    Jun 16, 2007
    Messages:
    365
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    hmmm i knew about ancients, but wouldnt that make the spellcasters immune to several spells? many spells do not work on ancients, so that would be a problem with my 200 spells...
     
  4. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    True. You'll have to check your spells to be able to target ancients and so on. I dont know if there's some things you cant fix, like if they always take reduced to spells. Maybe you can choose another classification that better suits your map. Anyway you'll just have to test it out and see how it works.