1. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  2. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  3. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  4. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  5. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  6. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  7. 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.

Unit type specific mine

Discussion in 'World Editor Help Zone' started by Kam, Jun 16, 2011.

  1. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,657
    Resources:
    24
    Models:
    8
    Icons:
    2
    Maps:
    14
    Resources:
    24
    I need a a goblin mine to be triggered only by mechanical units and have the target AOE shown when choosing where to place it. IE when attempting to place it in deep water it should trigger an error message.

    I've been struggling with this for some time and can't seem to find a solution. I've tried using various dummy spells and altering what targets the AOE damage upon death spell has.
     
  2. water_Knight

    water_Knight

    Joined:
    Mar 22, 2008
    Messages:
    421
    Resources:
    1
    Maps:
    1
    Resources:
    1
    You could trigger the damage?
     
  3. Drazhar

    Drazhar

    Joined:
    May 11, 2010
    Messages:
    213
    Resources:
    0
    Resources:
    0
    Urgh, I got it working but I can't have more than 1 mine working at a time. I'm trying to work out how. Hopefully someone will help before I figure it out.
     
  4. ThaAthael

    ThaAthael

    Joined:
    Sep 1, 2010
    Messages:
    168
    Resources:
    0
    Resources:
    0
    It's easy
    You'll need a dummy spell that shows your aoe (like silence) to place, then a condition check upon starts casting an ability (here you'll stop the unit if impossible and show error message) you conditions.
    Another trigger that fires when 'unit starts effect of an ability' which creates you mine dummy unit and uses the action - event - "a unit matching (your condition) comes within (your aoe) of last created unit" to another trigger.
    That last trigger only has action code: pick every unit of unit type (your mine) in (your aoe) around triggering unit
    -kill picked unit
    -damage triggering unit for (whatever damage)

    (just an explanation above, no acutal coding, no leak removal)
    If you want to use hashtables instead, you could create a mine group and check like every 0.1 seconds:
    pick every unit in minegroup
    -set currentmine =picked unit
    if(a unit matching (your condition) is within (your aoe) of current mine
    -damage all units matching (your condition) within (your oae) of currentmine for damage xyz
    remove currentmine from minegroup
    -kill currentmine

    The latter deals damage to all units to all units matching your condition, the earlier only to the triggering unit - depends on what you want to achieve with your mine, though i believe that the 2nd version is a) better and b) if you want effect a) youcan achieve it too.