Hello Teldrin, so what you want to accomplish is pretty simple and a good project for someone just starting out. You just have to remember that Warcraft 3 has a ton of different mechanics, so the solution to any given problem will depend based on your specific needs. Also, there's many solutions to a problem, all with their own pros and cons.
With that in mind, let's look at some of the different types of summoning skills so that you can decide how you want your skill to function:
-
Summon Water Elemental: Instant ability (no targeting), Summons 1 unit (I think you can modify this), and new summons do NOT replace old summons.
- Summon Serpent Ward: Target point ability, Summons 1 unit (I know you can modify this), and new summons do NOT replace old summons.
- Feral Spirit: Instant ability, Summons 2 units, and new summons replace old summons.
So the key mechanics are: Targeting, Summon Count, and most importantly the Replace mechanic which can add some extra complexity to your trigger(s). Using those examples as a reference, please explain to us exactly what you want to accomplish and how everything should work.
In the meantime, here's how I would design this custom "Summon Random Elemental" skill,
assuming that it's like the Summon Water Elemental skill:
1) In the Object Editor, under Units, copy and paste the Archmage's Water Elemental (Level 1). Rename it to "Random Elemental".
2) In the Object Editor, under Units, copy and paste the Archmage's Water Elemental and create a Fire/Water/Air/Earth version for each Level.
3) In the Object Editor, under Abilities, copy and paste the Summon Water Elemental ability and change it's Summoned Unit-Type to our "Random Elemental" for ALL Levels.
4) In the Trigger Editor, create 6 new Variables. These should be their
names and (variable types):
Random_Elemental_RNG (Integer)
Random_Elemental_LVL (Integer)
Random_Elemental_Fire (Unit-Type, Array)
Random_Elemental_Water (Unit-Type, Array)
Random_Elemental_Air (Unit-Type, Array)
Random_Elemental_Earth (Unit-Type, Array)
5) In the Trigger Editor, create two new triggers. The first will look like this:
-
Events
-

Time - Elapsed game time is 0.00 seconds
-
Conditions
-
Actions
-

Set Variable Random_Elemental_Fire[1] = Fire Elemental (Level 1)
-

Set Variable Random_Elemental_Fire[2] = Fire Elemental (Level 2)
-

Set Variable Random_Elemental_Fire[3] = Fire Elemental (Level 3)
-

Set Variable Random_Elemental_Water[1] = Water Elemental (Level 1)
-

Set Variable Random_Elemental_Water[2] = Water Elemental (Level 2)
-

Set Variable Random_Elemental_Water[3] = Water Elemental (Level 3)
-

Set Variable Random_Elemental_Air[1] = Air Elemental (Level 1)
-

Set Variable Random_Elemental_Air[2] = Air Elemental (Level 2)
-

Set Variable Random_Elemental_Air[3] = Air Elemental (Level 3)
-

Set Variable Random_Elemental_Earth[1] = Earth Elemental (Level 1)
-

Set Variable Random_Elemental_Earth[2] = Earth Elemental (Level 2)
-

Set Variable Random_Elemental_Earth[3] = Earth Elemental (Level 3)
^ This is our setup trigger, it handles tracking the data for our custom skill. This should happen before anyone has actually had the chance to use the skill which is why the Event occurs at the 0 second mark. In this case, I am tracking the different types of Units we can summon at the different skill [levels].
[1] = Level 1, [2] = Level 2, [3] = Level 3, etc.
The second trigger will look like this:
-
Events
-

Unit - A unit Spawns a summoned unit
-
Conditions
-

(Unit-type of (Summoned unit)) Equal to Random Elemental
-
Actions
-

Set Variable Random_Elemental_RNG = (Random integer number between 1 and 4)
-

Set Variable Random_Elemental_LVL = (Level of (Summon Random Elemental) for (Summoning unit))
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



Random_Elemental_RNG Equal to 1
-


Then - Actions
-



Unit - Replace (Summoned unit) with a Random_Elemental_Fire[Random_Elemental_LVL] using The new unit's default life and mana
-


Else - Actions
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



Random_Elemental_RNG Equal to 2
-


Then - Actions
-



Unit - Replace (Summoned unit) with a Random_Elemental_Water[Random_Elemental_LVL] using The new unit's default life and mana
-


Else - Actions
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



Random_Elemental_RNG Equal to 3
-


Then - Actions
-



Unit - Replace (Summoned unit) with a Random_Elemental_Air[Random_Elemental_LVL] using The new unit's default life and mana
-


Else - Actions
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



Random_Elemental_RNG Equal to 4
-


Then - Actions
-



Unit - Replace (Summoned unit) with a Random_Elemental_Earth[Random_Elemental_LVL] using The new unit's default life and mana
-


Else - Actions
-

Unit - Add a 60.00 second Generic expiration timer to (Last replaced unit)
-

Unit - Add classification of Summoned to (Last replaced unit)
^ This is our summon trigger, it handles the logic for creating the random elemental.
In this case, I am detecting when a Random Elemental is summoned and immediately replacing it with one of the four types of elementals. The outcome is based on the random number that was rolled and stored in the RNG variable as well as the ability LVL variable that was set prior. These variables help determine if it should summon a Level 1 Fire elemental or a Level 3 Air elemental. Since this all happens immediately the user will never be able to see or interact with the "base" Random Elemental that gets replaced. To clarify, Replacing removes the original unit from the game and creates a new unit in it's place.
I also add a 60 second expiration timer as well as the Summoned classification to the new elemental, which means it'll die after 60 seconds and will be treated like a Summon (weak to dispel, etc). These are optional of course but are the same settings that the standard Summon Water Elemental ability uses.
Notes:
- Ability and Skill are the same thing. A Skill just implies that it's learned from the Hero Skill Menu but it's technically still an Ability.
- Variables have a checkbox called "Array" which you need to check on for the Fire/Water/Air/Earth variables. The Array option is very useful since it allows a single variable to track multiple values at once. You should be using this feature often!
- If you can't find an Action then try using the Search For Text option, but be careful with your syntax, it's extremely picky.
- Almost everything in the Trigger Editor is organized alphabetically and categorically. Try to use word association to find what you're looking for, IE: Looking at my above trigger, the "Replace" Action has the prefix Unit which tells us that you can find it under the Unit category. The Condition "Random_Elemental_RNG Equal to 1" is checking if a value is equal to 1, and we know that both the variable and the value 1 are Integers therefore it can be found under the Integer category.
- Another tip, if something is wrapped in (parenthesis) then we know that it can be found under the Functions dropdown menu.
- You can change the names of the Units/Abilities/Variables if you'd like, this is just what I decided to call things.