• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Random summon spell

Level 16
Joined
Dec 12, 2021
Messages
228
Could you help me create a spell trigger that serves to summon units randomly, for example, based on the Beastmaster (Rexxar), which has 3 summoning units (bear, pig, bird), then with my spell when starting it, any of those 3 units near my hero are summoned, opportunely that it has the same chance of generating the different units for example 33% that a bear is generated, 33% that a pig is generated and the other 33% that a bird is summoned, that the summoning lasts 60 seconds and has an animation when it comes to summoning it, and that it can be done with different levels, level 1 weaker units, level 2 stronger, etc.
EDIT: I forgot the part where it said to have a low CD for example 20 seconds and that more units can be summoned while 1 unit has already been summoned, for example if I already summoned the first unit the spell charges in 20 seconds and once there I can summon another but the first unit is not lost, but rather is kept with its remaining time (with 20 seconds of CD there would be like 40 seconds left to summon the first unit)
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,971
Here you go, it's a very simple trigger to make yourself:
  • Random Summon Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- [DEFINE THE STATS FOR THIS CUSTOM ABILITY] --------
      • -------- --------
      • -------- Bears: --------
      • Set VariableSet RSummon_Bear_Types[1] = Bear (Level 1)
      • Set VariableSet RSummon_Bear_Types[2] = Raging Bear (Level 2)
      • Set VariableSet RSummon_Bear_Types[3] = Spirit Bear (Level 3)
      • -------- --------
      • -------- Boars: --------
      • Set VariableSet RSummon_Pig_Types[1] = Quilbeast (Level 1)
      • Set VariableSet RSummon_Pig_Types[2] = Dire Quilbeast (Level 2)
      • Set VariableSet RSummon_Pig_Types[3] = Raging Quilbeast (Level 3)
      • -------- --------
      • -------- Hawks: --------
      • Set VariableSet RSummon_Bird_Types[1] = Hawk (Level 1)
      • Set VariableSet RSummon_Bird_Types[2] = Thunder Hawk (Level 2)
      • Set VariableSet RSummon_Bird_Types[3] = Spirit Hawk (Level 3)
  • Random Summon Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Pet
    • Actions
      • -------- Determine where to position the summoned unit: --------
      • Set VariableSet RSummon_Point[0] = (Position of (Triggering unit))
      • Set VariableSet RSummon_Point[1] = (RSummon_Point[0] offset by 192.00 towards (Facing of (Triggering unit)) degrees.)
      • -------- --------
      • -------- Pick a random number, 1 = Bear, 2 = Boar, 3 = Hawk: --------
      • Set VariableSet RSummon_RNG = (Random integer number between 1 and 3)
      • -------- --------
      • -------- Create the unit: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RSummon_RNG Equal to 1
        • Then - Actions
          • -------- Bears: --------
          • Unit - Create 1 RSummon_Bear_Types[(Level of (Ability being cast) for (Triggering unit))] for (Triggering player) at RSummon_Point[1] facing (Facing of (Triggering unit)) degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RSummon_RNG Equal to 2
            • Then - Actions
              • -------- Boars: --------
              • Unit - Create 1 RSummon_Pig_Types[(Level of (Ability being cast) for (Triggering unit))] for (Triggering player) at RSummon_Point[1] facing (Facing of (Triggering unit)) degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RSummon_RNG Equal to 3
                • Then - Actions
                  • -------- Hawks: --------
                  • Unit - Create 1 RSummon_Bird_Types[(Level of (Ability being cast) for (Triggering unit))] for (Triggering player) at RSummon_Point[1] facing (Facing of (Triggering unit)) degrees
                • Else - Actions
      • -------- --------
      • -------- It's not considered a summoned unit yet. Let's make it summoned and have it die after X seconds: --------
      • Unit - Add classification of Summoned to (Last created unit)
      • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
      • -------- --------
      • -------- Optional special art effects: --------
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Clean up memory leaks: --------
      • Custom script: call RemoveLocation( udg_RSummon_Point[0] )
      • Custom script: call RemoveLocation( udg_RSummon_Point[1] )
1751727615141.png
 

Attachments

  • Random Summon 1.w3m
    19.8 KB · Views: 2
Level 16
Joined
Dec 12, 2021
Messages
228
Thank you very much master, it works correctly for me, although I would like to polish a couple of details:
1. The first is regarding its animation, every time one dies it leaves its green bile on the floor, unlike other standard invocations such as that of Thrall's wolves that when they die, they come out as a red explosion without leaving bones or fluids, if possible, I would like it to have the same detail of an animation when dying and not leave its blood lying on the floor (only if it is possible, and if it does not cause any type of memory leak or lag, since from what I know the animations sometimes lag the game). 2. Here the other detail is very simple and the truth is I don't know if it's worth correcting it or leaving it there because it's quite functional but every time I summon a unit with triggers the phrase "synchronized life" appears in its time bar, unlike other summons that instead show the name of the spell, like for example when you summon Thrall's wolves "wild spirit" appears.

EDIT: Regarding point 1, I didn't mean having a death animation, but rather a "special effect."
1751730591935.png
 
Last edited:

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,971
1) Since we create the "summoned" units with triggers they aren't exactly the same as when created with an ability. In this case you'll have to Remove the unit from the game when it dies to hide the blood:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is Summoned) Equal to True
  • Actions
    • Unit - Remove (Triggering unit) from the game
^ This trigger will work on ALL summoned units, so you might want to add more Conditions to only check for your specific summons.

You can also add a "death" Special Effect here if you'd like:
  • Actions
    • Set VariableSet RSummon_Point[0] = (Position of (Triggering unit))
    • Special Effect - Create a special effect at RSummon_Point[0] using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation( udg_RSummon_Point[0] )
    • Unit - Remove (Triggering unit) from the game
2) You have a choice from a list of Expiration Timers, all with their own Names that you can customize in the Object Editor -> Buffs tab:
  • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
^ Change the "Generic" buff to say something else in the Object Editor OR choose a different one inside of this Action.
 
Last edited:

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,971
Regarding the first one, would adding the trigger also generate the special effect upon death, just like how the spectral wolves produce a red explosion when they die? I'd like that little detail, please. Otherwise, it's perfect. :D
You probably missed it because I edited my post but I showed how to add the "death" special effect as well.
You can also add a "death" Special Effect here if you'd like:

But you may want to do this right before Destroying the effect:
  • Special Effect - Set Height of (Last created special effect) to: (Current flying height of (Triggering unit))
That way the Special Effect will appear in the air for your summoned flying units (Hawks).

The reason I don't just attach this Special Effect is because Removing a unit from the game also removes any attached effects as well.
 
Last edited:
Level 16
Joined
Dec 12, 2021
Messages
228
Regarding the first one, I was able to solve it, but since it's not the only ability in my map that creates summons, the special effect appeared on all of them (which I didn't want), so I modified the condition so that it only applies to the 3 summoning units of this trigger and at its 3 levels. The only bad thing is that it takes up too much space, and I'm sure there's a shorter version of putting such a condition, but I don't know how. I only know that there was one that was to put "for each 1-3" so that it occupies all 3 levels, but I don't know how to do it. Regarding point 2, I'm trying to find what you told me to change the name but it doesn't appear even though I made a copy in the Water Elemental Buff section and changed its name, that name doesn't appear in the triggers, maybe it's because I use the old W3, anyway I think I'm going to ignore that detail, so it would be complete except for the spell condition which is very long, thank you very much master :D
1751736199883.png


1751736670726.png
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,971
I don't think you can create custom Expiration Timers. You have to edit an existing one. I would take the original Water Elemental buff and change it to say "Summoned Unit" or "Timed Life" or something generic that you can use everywhere.
For the messy Conditions you should use the "Or, Multiple Conditions" Condition, which let's you add one at a time without having to connect them all together in a huge chain.

But there's an even easier solution to this problem. You can use a hidden custom ability to keep track of these units, which I call a pseudo-Classification.
Then in the death trigger you can check if the dying unit has this ability or not:
  • (Level of Random Summon (Class) for (Triggering unit)) Greater than 0
This will be equal to 0 if it does NOT have the ability.

I attached a new map with these changes.
 

Attachments

  • Random Summon 2.w3m
    21.5 KB · Views: 1
Last edited:
Top