• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Max 3 units summoned

Status
Not open for further replies.
Level 5
Joined
Dec 25, 2018
Messages
110
So this part works properly, when I use this spell and there are already 3 units summoned, then first unit summoned is killed and another one is summoned.
  • Serpents limit Copy
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Witch Doctor
    • Actions
      • Set SerpentLimit = (Player number of (Owner of (Summoning unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Serpents Limit for (Summoning unit)) Equal to 0
        • Then - Actions
          • Set Serpent[SerpentLimit] = (Summoned unit)
          • Unit - Add Serpents Limit to (Summoning unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Serpents Limit for (Summoning unit)) Equal to 1
            • Then - Actions
              • Set Serpent2[SerpentLimit] = (Summoned unit)
              • Unit - Increase level of Serpents Limit for (Summoning unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Serpents Limit for (Summoning unit)) Equal to 2
                • Then - Actions
                  • Set Serpent3[SerpentLimit] = (Summoned unit)
                  • Unit - Increase level of Serpents Limit for (Summoning unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Serpents Limit for (Summoning unit)) Equal to 3
                    • Then - Actions
                      • Unit - Kill Serpent[SerpentLimit]
                      • Special Effect - Create a special effect at (Position of Serpent[SerpentLimit]) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                      • Set Serpent[SerpentLimit] = Serpent2[SerpentLimit]
                      • Set Serpent2[SerpentLimit] = Serpent3[SerpentLimit]
                      • Set Serpent3[SerpentLimit] = (Summoned unit)
                    • Else - Actions
Problem lies in other trigger
  • Serpents dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Serpent Ward (Level 1)
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) of type Witch Doctor) and do (Actions)
        • Loop - Actions
          • Unit - Decrease level of Serpents Limit for (Picked unit)
This trigger is resposible for summons dying from actual damage, not from summon trigger.
But it messes up everything, I can summon more then 4 units.
Any idea how to fix it or how to make this system is simpler way?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Keep track of the summons in a unit group. Dynamically compare the number of units in that unit group with the limit. If the limit is exceeded, select a victim (eg the one with lowest health or furthest away) and then create a new one. If you really want the oldest to be removed, then you will need to implement a linked list of units to track the order the summons were made.
 
when summoning the 4. Ward the ability decreases to level 2, but you still have 3 wards ( 2 old ones + 1 new one).
Smallest change is proably:
turn off the death Event trigger before using the kill action,
after the kill action turn on the death Event trigger again.

Or you enforce a level increase at new summon should also work.​

You also need to destroy the effect it currently leaks.

Using the group to find the witch doc is an overkill.
Use an unit array variable and save the witch doc of that player.
Inside death event trigger then directly alter the level for WitchDoc[Player Number of )Owner of triggering Unit)]

I am unsure if dat decreasing level action does remove the ability on level 1.
 
Status
Not open for further replies.
Top