Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Default spell leveled up

Discussion in 'Triggers & Scripts' started by P3in, Aug 23, 2020.

  1. P3in

    P3in

    Joined:
    Dec 16, 2017
    Messages:
    28
    Resources:
    0
    Resources:
    0
    Hi guys, i am new in WE, i want to make a trigger that level's up default skill of all heroes that are used in the map

    for example:

    Default upg
    Events
    Unit - A unit Gains a level
    Conditions
    Actions
    Unit - Set level of Warglaive of Azzinoth[Default] for (Leveling Hero) to 2
    Unit - Set level of Blade Strike [Default] for (Leveling Hero) to 2
    Unit - Set level of Cleaving Attack [Default] for (Leveling Hero) to 2
    Unit - Set level of Illusion Split [Default] for (Leveling Hero) to 2
    Unit - Set level of Mangekyo Sharingan[Default] for (Leveling Hero) to 2
    Unit - Set level of Katon : Gokakyu no Jutsu[Default] for (Leveling Hero) to 2
    Unit - Set level of Molten Armor[Default] for (Leveling Hero) to 2
    Unit - Set level of Rinnegan[Default] for (Leveling Hero) to 2
    Unit - Set level of Orb of Frost [Default] for (Leveling Hero) to 2
    Unit - Set level of Mangekyo Sharingan[Default] for (Leveling Hero) to 2
    Unit - Set level of Weights Training[Default] for (Leveling Hero) to 2
    Unit - Set level of Fel Energy[Default] for (Leveling Hero) to 2


    I mention that default skills are labelled as unit spell and they have more then one level, i want them to upgrade when hero gains a certain amount of lvl for example, if hero is lvl 10, upgrade the spell to level 2,if hero is lvl 20, upgrade the spell to level 3, and so on.
    I can't find a condition that is something like [level gained equals to 10],is there any alternate way i can do that?
    Will it crash because i set all defaults to upgrade at a certain level and even if for example someone doesn't play that hero and is unused?
    Thanks !
     
    Last edited: Aug 23, 2020
  2. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,413
    Resources:
    1
    JASS:
    1
    Resources:
    1
    There are several ways to do it, if then elseif where you have all the levels you want to check.
    Using an array where the index is the level you want to check.
    You can also use the modulo function and the integer result of hero level/level you want to check.
    And so one.
     
  3. Whitewolf8

    Whitewolf8

    Joined:
    Aug 31, 2011
    Messages:
    289
    Resources:
    6
    Models:
    1
    Maps:
    4
    Tutorials:
    1
    Resources:
    6
    In terms of checking levels, you're looking for an integer condition.
    Something like this
    • (Hero level of (Triggering unit)) Greater than or equal to 5
     
  4. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,378
    Resources:
    0
    Resources:
    0
    Here's a more generic trigger that levels up the Paladin's skills by 1 point whenever he gains a level. Note that doing it like this doesn't spend Skill Points, but you're using Unit abilities anyway, additionally, this won't increase the level of a non-learned Hero skill.
    • Level Up
      • Events
        • Unit - A unit Gains a level
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Paladin
      • Actions
        • Set Variable TempAbility = Holy Light
        • Unit - Set level of TempAbility for (Triggering unit) to ((Level of TempAbility for (Triggering unit)) + 1)
        • Set Variable TempAbility = Divine Shield
        • Unit - Set level of TempAbility for (Triggering unit) to ((Level of TempAbility for (Triggering unit)) + 1)
        • Set Variable TempAbility = Devotion Aura
        • Unit - Set level of TempAbility for (Triggering unit) to ((Level of TempAbility for (Triggering unit)) + 1)

    You can add a Level condition as well (Integer Comparison):
    • (Hero level of (Triggering unit)) Equal to 5

    Note that you don't need the TempAbility variable, it just makes things easier:
    • Level Up 2
      • Events
        • Unit - A unit Gains a level
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Paladin
      • Actions
        • Unit - Set level of Holy Light for (Triggering unit) to ((Level of Holy Light for (Triggering unit)) + 1)

    You can also set the level to exactly what you want:
    • Unit - Set level of Holy Light for (Triggering unit) to 3
     
    Last edited: Aug 24, 2020
  5. P3in

    P3in

    Joined:
    Dec 16, 2017
    Messages:
    28
    Resources:
    0
    Resources:
    0
    Thank you all for help !
    And if i want to keep it to 1 trigger per hero i tried something like this, it should be ok,no? so i make 1 trigger/per hero

    • Default upg
      • Events
        • Unit - A unit Gains a level
      • Conditions
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to |c00FF7F00Illidan Stormrage|r
            • (Hero level of (Triggering unit)) Greater than or equal to 10
          • Then - Actions
            • Unit - Set level of Illidan-Warglaive of Azzinoth[Default] for (Triggering unit) to 2
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to |c00FF7F00Illidan Stormrage|r
            • (Hero level of (Triggering unit)) Greater than or equal to 20
          • Then - Actions
            • Unit - Set level of Illidan-Warglaive of Azzinoth[Default] for (Triggering unit) to 3
          • Else - Actions
     
    Last edited: Aug 24, 2020
  6. ThompZon

    ThompZon

    Joined:
    Jan 30, 2020
    Messages:
    123
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Yes this is ok, but I'd suggest moving the "unit-type comparison" up to the trigger "conditions" so you only have to check for levels in the "if:s" in the Actions-part.

    And yes, one trigger per hero is good to keep the triggers short and clean (easier to overview and modify later if needed).

    If you surround your trigger in "[_TRIGGER]<pasted-trigger-here>[_/TRIGGER]" (without the _), it'll show up as in my quoted text of your trigger.
     
  7. P3in

    P3in

    Joined:
    Dec 16, 2017
    Messages:
    28
    Resources:
    0
    Resources:
    0
    Thank you a lot ! I've +rep everyone on this thread,i will use that trigger function on thread here,didn't knew about it,thanks for having patience with a newbie :D