• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Spell] Locust Swarm - Adding ability

Status
Not open for further replies.
Level 2
Joined
Oct 11, 2020
Messages
7
Hello, is it possible to grant units summoned via Locust Swarm an ability via a trigger?

I don't want to give them the ability baseline, I want to give it upon casting locust swarm.
 
Level 14
Joined
Sep 28, 2011
Messages
968
You do that the same way as you give abilities to any unit but you have to check if they were locust summoned.
Example way: you cast the ability and at that moment(ability is cast or something like that as an event) you pick all the units in a specific radius(how far the summons can initially be spread) and check if they are locust summoned and of the right type and then give the ability.
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,882
@noob
I THINK units with the Locust ability avoid Pick Every Unit, I'm pretty sure you need to rely on the "A unit enters map" Event instead.

A unit enters map

Unit-type of triggering unit equal to Locust

Add Critical Strike to triggering unit
 
Level 2
Joined
Oct 11, 2020
Messages
7
@noob
I THINK units with the Locust ability avoid Pick Every Unit, I'm pretty sure you need to rely on the "A unit enters map" Event instead.

A unit enters map

Unit-type of triggering unit equal to Locust

Add Critical Strike to triggering unit
It worked like a charm, thank you!

You do that the same way as you give abilities to any unit but you have to check if they were locust summoned.
Example way: you cast the ability and at that moment(ability is cast or something like that as an event) you pick all the units in a specific radius(how far the summons can initially be spread) and check if they are locust summoned and of the right type and then give the ability.
I couldn't get this to work, even when the unit was not a locust type. Can you please tell me, what I'm doing wrong:

  • Snowy old
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Snowy and Quill
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Snowy Lv1
            • Then - Actions
              • Unit - Add Snowy Expose Weakness to (Picked unit)
            • Else - Actions
              • Do nothing
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,882
It worked like a charm, thank you!


I couldn't get this to work, even when the unit was not a locust type. Can you please tell me, what I'm doing wrong:

  • Snowy old
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Snowy and Quill
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Snowy Lv1
            • Then - Actions
              • Unit - Add Snowy Expose Weakness to (Picked unit)
            • Else - Actions
              • Do nothing
That trigger should work for NON-Locust units, and by that I mean units without the Locust ability. Note that it leaks a Unit Group but if you're newer to the editor I'd say don't worry about that just yet.

I imagine the issue is one of these: Snow Lvl1 has Locust, or it's the wrong cast ability, or wrong unit-type, or snowy expose weakness is hidden.

Also, Don't use Do nothing, it does nothing.
 
Level 14
Joined
Sep 28, 2011
Messages
968
Also are you sure the locusts already exists at this step of the spellcasting?
Also you can make unlocusted locusts thanks to chaos then relocust them if picking them is a problem(locusts unlocusted by chaos can be picked which is probably why I do not remember locusts being unpickable) do they stay locusts for the purpose of the spell?

Also since you add the ability to all of them then there is no point in not just giving the ability to the baseline unit: those who are not obtained through this spell will still get the ability.
So either add a check(like check if they have a timed life) or wonder if those locusts are ever obtained from any source other than that spell.
 
Last edited:
Level 2
Joined
Oct 11, 2020
Messages
7
First of all apologies for the late response

That trigger should work for NON-Locust units, and by that I mean units without the Locust ability. Note that it leaks a Unit Group but if you're newer to the editor I'd say don't worry about that just yet.

I imagine the issue is one of these: Snow Lvl1 has Locust, or it's the wrong cast ability, or wrong unit-type, or snowy expose weakness is hidden.

Also, Don't use Do nothing, it does nothing.
After some slight tweaking it indeed worked for non-locus units. What should I place at the "else" field then? Leave it blank? Also thank you for bringing up the leak issue, I saw the thread linked in your signature and will give a proper read these days.


Also are you sure the locusts already exists at this step of the spellcasting?
Also you can make unlocusted locusts thanks to chaos then relocust them if picking them is a problem(locusts unlocusted by chaos can be picked which is probably why I do not remember locusts being unpickable) do they stay locusts for the purpose of the spell?

Also since you add the ability to all of them then there is no point in not just giving the ability to the baseline unit: those who are not obtained through this spell will still get the ability.
So either add a check(like check if they have a timed life) or wonder if those locusts are ever obtained from any source other than that spell.
After some tweaking it did end up working, but for non-locust units. I haven't tried the chaos method you mentioned, but I'll just stick to the one proposed by Uncle since it works really well.

As to why I want the ability to work this way. The summoned units basically gain one of the hero's passive abilities, based on its current level. So if that passive hasn't been leveled up, then the units won't get it either.

Thank you guys so, so much for the aid. I'll be using both of your methods in the future.
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,882
First of all apologies for the late response


After some slight tweaking it indeed worked for non-locus units. What should I place at the "else" field then? Leave it blank? Also thank you for bringing up the leak issue, I saw the thread linked in your signature and will give a proper read these days.



After some tweaking it did end up working, but for non-locust units. I haven't tried the chaos method you mentioned, but I'll just stick to the one proposed by Uncle since it works really well.

As to why I want the ability to work this way. The summoned units basically gain one of the hero's passive abilities, based on its current level. So if that passive hasn't been leveled up, then the units won't get it either.

Thank you guys so, so much for the aid. I'll be using both of your methods in the future.
No problem, glad it worked out. And yes, you can leave it blank.
 
Status
Not open for further replies.
Top