1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Upgrade which replaces a unit ability

Discussion in 'World Editor Help Zone' started by Dispatcher, Sep 12, 2020.

  1. Dispatcher

    Dispatcher

    Joined:
    Apr 22, 2020
    Messages:
    428
    Resources:
    0
    Resources:
    0
    I think you guys already know my problem based on the thread title. Let's say i want the "Heal" spell of my priest to be replaced as the "Abolish Magic" spell so i create a custom upgrade which replaces the priest heal into abolish magic available in the arcane sanctum. So how do i trigger this?
     
  2. DoomBlade

    DoomBlade

    Joined:
    Feb 5, 2018
    Messages:
    365
    Resources:
    0
    Resources:
    0
    • Events - A unit finishes an upgrade
    • Conditions - Upgrade equal to your upgrade
    • Actions
    • Set tempgroup = Unitsownedbyplayer(ownerfounit(triggeringunit)) of type priest
    • Pick every unit in tempgroup
    • Remove ability heal
    • Unit add abilty abolishmagic
    • call DestroyGroup (udg_tempgroup)
     
  3. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,471
    Resources:
    0
    Resources:
    0
    Adding to what DoomBlade said, you'll also want another trigger for newly created Priests. So when a priest enters the map, check if the upgrade is researched, and remove heal/add abolish.

    Events;
    A unit enters map
    Conditions:
    Unit-type of triggering unit equal to Priest
    Research level of Upgrade >= 1
    Actions:
    Remove heal from triggering unit
    Add abolish magic to triggering unit
     
  4. Dispatcher

    Dispatcher

    Joined:
    Apr 22, 2020
    Messages:
    428
    Resources:
    0
    Resources:
    0
    [​IMG]

    [​IMG]
    Is this trigger correct guys? I just made a quick picture on my phone thats explains why it is blurry, sorry guys.
     
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,471
    Resources:
    0
    Resources:
    0
    That looks good, but your condition is only checking for Player 1's level of the research. Is that intentional? You might want to change Player 1 to Triggering Player, and if that doesn't work use Owner of Triggering Unit. That way the trigger works properly for every single player, not just Player 1.

    How To Post Your Trigger
     
  6. Dispatcher

    Dispatcher

    Joined:
    Apr 22, 2020
    Messages:
    428
    Resources:
    0
    Resources:
    0
    Hehehe sorry for the bad photo. By the way i tested it and researched the Orb of Pain but the units that are already in the map still has curse and when i trained the banshee's again they have them. Looks like the trigger where it replaces the the existing units ability "Curse" seems like there is a problem. Any idea?
     
  7. [db]east

    [db]east

    Joined:
    Feb 27, 2019
    Messages:
    144
    Resources:
    0
    Resources:
    0
    What about having both spells on the unit at the start of the game. Then disable one of them. When the research is completed disable the second one and enable the first agian. Although it wouldnt get work for passives.
    • Map Initialization
    • Player - Disable Abolish Magic for (Players)
    • Research complete
    • Player - Disable Heal for (Triggering Player)
    • Player - Enable Abolish Magic for (Triggering Player)
     
    Last edited: Sep 12, 2020
  8. Dispatcher

    Dispatcher

    Joined:
    Apr 22, 2020
    Messages:
    428
    Resources:
    0
    Resources:
    0
    The trigger they made is completely fine and works well, but the only problem is the units that existed before the upgrade is finished researching doesn't get the ability at all. It seems like i have done a slight error here.
     
  9. [db]east

    [db]east

    Joined:
    Feb 27, 2019
    Messages:
    144
    Resources:
    0
    Resources:
    0
    You are using Triggering unit when picking units in unit group. Use Picked unit instead.
     
  10. Dispatcher

    Dispatcher

    Joined:
    Apr 22, 2020
    Messages:
    428
    Resources:
    0
    Resources:
    0
    Oh wow i just thought the same thing like why is this triggering unit when it is picking unit in a group so it should be picked unit. So i changed it to picked unit and it works now the existing units now have the ability. The answer was so simple yet hard to figure out LOL!