• 🏆 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 Spells - Summons

Level 5
Joined
Mar 24, 2023
Messages
49
I have been playing with trigger spells with some decent success until I tried to create a spell that summons units. Problem I am having is when I try my normal method there is no option for any "summon" type spells under - Unit - Order Last Created Unit to Ability Picked Unit - . So i am unable to tell my dummy unit to "cast" the spell for me.

I have tried making the trigger create the units I want at a specific location when the ability is cast and then adding a generic timer to the units which works. My problem with this method is two fold:

1) I cant get the summoned units to scale up with the ability level of the hero
2) I am unable to have these units removed from the map if the spell is cast again to prevent duplicate summons.


any help appreciated . more info on request
 
Level 11
Joined
Aug 11, 2009
Messages
594
For first issue i would make a map Init that setup unit type variables with arrays.
Example:
UT_Summon(0) = Unit for level 1
UT_Summon(1) = Unit for level 2
Etc. For every level of the ability

Then when you run the summoning trigger you create UT_Summon(Level of Ability).
If that makes sense.

For the second issue you could use variables aswell. After you create the unit set a unit variable for example U_Summon(Player Number of Triggering Unit) = Last created unit.

And before you create a new Summon unit you remove U_Summon(PlayerNumber) from the game. This makes sure the old stored Summon is removed before a new one is created.

So how it would look like:
Event Unit Starts Effect of Ability

Condition Ability being cast equal to SummonSpell

Remove U_Summon(Player Number of Triggering Unit).
Create UT_Summon(Level of SummonSpell for Triggering Unit)
Set U_Summon(Player Number of Triggering Unit) = Last Created Unit


This will only work if one unit per player can Summon it though, if you have multiple units with the Summon spell it will not work. I think if you download a unit index system it could be used to make it MUI.

I am at the phone so cant show in triggers. Hopefully it makes some sense.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
I am not sure I understand the issue correctly, but here are a few notes regarding casting spells:

#1: Targeting
You have the following types of spells in regards to targeting:
  • Spells with no target: You click the spell and the unit casts it
    • Examples: Starfall, Berserk, Avatar, Bear Form
  • Spells targeting an object: These spells require you to select a target object on which the spell will be cast
    • The target object can be unit, item, destructible (e.g. tree)
    • Examples: Storm Bolt, Inner Fire, Frost Nova, Cyclone
  • Spells targeting a point: These spells require you to select a location on which the spell will be cast
    • Most spells usually have a targeting circle of various width to show you the area of effect of the spell
    • Examples: Blizzard, Rain of Fire, Cloud, Healing Ward
To find out to which category your custom spell belongs to is as easy as starting the map and manually ordering your unit to cast the spell and watching what you have to target.
To order unit to cast a spell via triggers, you have the following trigger actions that match the categories above:
  • Spells with no target:
    • Action name: 'Unit - Issue Order With No Target'
    • Example:
      • Unit - Order DummyUnit to Night Elf Priestess Of The Moon - Starfall.
  • Spells targeting an object:
    • Action names:
      • 'Unit - Issue Order Targeting A Unit'
      • 'Unit - Issue Order Targeting A Destructible'
      • 'Unit - Issue Order Targeting An Item'
    • Example:
      • Unit - Order DummyUnit to Human Priest - Inner Fire (Picked unit)
  • Spells targeting a point:
    • Action name: 'Unit - Issue Order Targeting A Point'
    • Example:
      • Unit - Order DummyUnit to Human Archmage - Blizzard (Target point of ability being cast)

Most summoning spells are 'No target' spells. As such, you have to 'Issue Order With No Target'.

#2: Spell's order
Each spell has an order. It is the order that you have to specify in the trigger actions mentioned earlier, you cannot specify the custom spell itself.
Warcraft has a pre-defined list of orders and these are hardcoded in the abilities. The following is important to understand:
  • You cannot add your own orders
  • For default abilities it's obvious what the order is (since in triggers the order matches the ability's name)
  • Custom spells inherit the order from the ability you based your custom spell off.
As an example, let's say I have created a 'Summon Air Elemental' spell which is based off Archmage's 'Summon Water Elemental' spell.
To order dummy unit to cast the spell via triggers, you would have to execute the following set of actions:
  • Unit - Add Summon Air Elemental to DummyUnit //only required if the dummy unit does not have the ability
  • Unit - Order DummyUnit to Human Archmage - Summon Water Elemental.
If my custom spell was based off Far Seer's Feral Spirit, then that's what I would have to order:
  • Unit - Order DummyUnit to Orc Far Seer - Feral Spirit.
The only exception to this rule is the 'Channel' spell (and any spell based off it) where you can specify the order (but this only allows you to specify an existing order, you cannot create a new one).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I have tried making the trigger create the units I want at a specific location when the ability is cast and then adding a generic timer to the units which works. My problem with this method is two fold:

1) I cant get the summoned units to scale up with the ability level of the hero
2) I am unable to have these units removed from the map if the spell is cast again to prevent duplicate summons.
For problem 1 you can apply scaling logic to each of the created units, Create the units one at a time and then set the appropriate unit stats, or choose the appropriate unit type if you are using unit type scaling.

For problem 2 you need to track the summoned units in a unit group. When the summons are re-cast, you pick every unit in the unit group and then kill/remove it and then clear the unit group.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Here's a useful Event I didn't see anyone mention:
  • Events
    • Unit - A unit Spawns a summoned unit
This fires in response to most if not every "Summon" ability in the game and gives you a reference to the specific Summon and it's Summoner. This should give you control over just about everything and works with any number of Summons.
 
Level 5
Joined
Mar 24, 2023
Messages
49
before i close this thread, could someone tell me why this separate trigger for single target Soulburn in an AOE is not working - currently it only applies soul burn to the targeted unit and no one else (it has something to do with the variable Group1 as if i changed the "Unit group -pick every unit in Group1 and do (Actions)" to "Unit group -pick every unit in playable map area and do (Actions)" it works but applies soul burn to all enemy units on the map which isnt what i want.

To add, I am looking to find out what is wrong this THIS trigger itself and how to fix it rather than doing it an alternative way. All help appreciated

1697131570889.png
 
Level 5
Joined
Mar 24, 2023
Messages
49
okay... i thought i had the original one down but it did'nt work as intended. Could someone tell me how i would put the units summoned in this trigger ability into a unit group variable and then remove the units in that variable when the ability is again cast, thereby removing the existing summoned units when new ones are summoned.

The unit ability summons 1 unit and the dummy summons another, so 2 units total.


Again thanks in advance!!
1697148543432.png
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
I will step back a bit before posting any triggers, instead I would like to clarify what you are trying to achieve.

Is the unit-type summoned by 'Double Summon' and 'Double Summon dummy' same? Or are those unit-types different?
If they are the same unit-type, you can change the number of summoned units in the ability itself (field 'Level N - Data - Summoned Unit Count').

If you want your old summons to disappear automatically when the same unit re-casts the spell, then base your spell off Feral Spirit, not Summon Water Elemental.

I just wonder if you really need a trigger to capture and manage those summons if there already exists an ability that would do it for you out-of-box.
 
Top