• 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.

Spell death cause spawn

Status
Not open for further replies.
Level 9
Joined
Apr 14, 2020
Messages
63
I am trying to have a certain ability, derived from lightning shield, spawn a unit if it is the cause of death. I can't seem to wrap my head around how I would trigger that, what condition I would use to single out "X" ability causing the death of a unit when the event is "A Unit Dies".
 
Level 30
Joined
Feb 18, 2014
Messages
3,623
If I understood correctly, you want a unit to cast lightning shield on x unit and if this latter dies while under the effect of the spell, it will spawn a unit from it? It should be easy to trigger, you can do what Devalut said or use unit groups instead :
  • Spawn 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to Lightning_Group
  • Spawn 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Lightning_Group) Equal to TRUE
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Unit - Create 1 Footman for (Owner of (Killing unit)) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Unit Group - Remove (Triggering unit) from Lightning_Group
  • Spawn Reset
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • 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
              • ((Picked unit) is in Lightning_Group) Equal to TRUE
              • ((Picked unit) has buff Lightning Shield) Equal to FALSE
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Lightning_Group
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I created what Devalut suggested.

One minor difference is that I check for Ability level instead of Unit-type when determining if the Dummy killed a unit.

This way you don't need to create a new Dummy unit in the Object Editor.

  • Cast LS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield (Hero)
    • Actions
      • -------- Create the Dummy --------
      • Set VariableSet TempPoint = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- --------
      • -------- Make the Dummy cast Lightning Shield --------
      • Unit - Add a 11.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Lightning Shield (Dummy) to (Last created unit)
      • Unit - Set level of Lightning Shield (Dummy) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
      • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield (Target unit of ability being cast)
  • LS Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Lightning Shield (Dummy) for (Killing unit)) Greater than 0
    • Actions
      • -------- Create the Spawn Unit --------
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Skeleton Warrior for (Owner of (Killing unit)) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
Alternate version that only spawns units if the dying unit is an Enemy
  • LS Kill alternate
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Lightning Shield (Dummy) for (Killing unit)) Greater than 0
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
    • Actions
      • -------- Create the Spawn Unit --------
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Skeleton Warrior for (Owner of (Killing unit)) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_TempPoint)

The Hero ability is based on Forked Lightning and doesn't do anything besides spend mana/go on cooldown/run the Cast LS trigger.

The Dummy ability is based on Lightning Shield and is used by the Dummy unit. This deals the damage.
 

Attachments

  • Lightning Shield Example.w3m
    19.1 KB · Views: 19

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Beautiful. Thank you. I'm just now starting to grasp the use of dummy units for custom abilities. I learn through example so this helps a bunch!
Thanks, glad to help.

And yeah, you have to use a lot of tricks with the world editor, especially when it comes to custom abilities. Dummys are one of the more important ones to master since they're our only way to "Create a spell effect". If only we actually had something that simple, it'd be great to be able to just say "cast lightning shield from this unit on that unit" without having to worry about all of the other game's mechanics, like having the ability on a unit, being able to afford the costs, issuing an order, etc... Instead, we have to create an invisible, uncommandable (but controllable w/ triggers), "Dummy", add our desired ability to it, make sure it can cast that ability, and then order it to do so. It's a lot of extra steps but at least it gets the job done.
 
Last edited:
Level 9
Joined
Apr 14, 2020
Messages
63
Thanks, glad to help.

And yeah, you have to use a lot of tricks with the world editor, especially when it comes to custom abilities. Dummys are one of the more important ones to master since they're our only way to "Create a spell effect". If only we actually had something that simple, it'd be great to be able to just say "cast lightning shield from this unit on that unit" without having to worry about all of the other game's mechanics, like having the ability on a unit, being able to afford the costs, issuing an order, etc... Instead, we have to create an invisible, uncommandable (but controllable w/ triggers), "Dummy", add our desired ability to it, make sure it can cast that ability, and then order it to do so. It's a lot of extra steps but at least it gets the job done.
If the ability is not actually lightning shield but a custom version of it, does "Unit - Order (Last created unit) to Orc Shaman - Lightning Shield (Target unit of ability being cast)" work? Only preset wc3 abilities seem to be able to be selected here
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
If the ability is not actually lightning shield but a custom version of it, does "Unit - Order (Last created unit) to Orc Shaman - Lightning Shield (Target unit of ability being cast)" work? Only preset wc3 abilities seem to be able to be selected here
Every ability is based on an existing spell. And that existing spell uses an Order String which is hard-coded, meaning you cannot modify it despite the Editor making it seem like you can. This Order String is what you're referencing in the Trigger Editor when you "Order some unit to cast some spell".

See the attached picture for an example of Thunder Clap. Any ability based on Thunder Clap will use the "thunderclap" Order String, even if you change it. Why they even allow you to change it is beyond me since it doesn't work.

Also note that these Order Strings are what determine ability conflicts when using multiples of the same ability. If the game detects that 2+ of your abilities have the same Order String, it will only be able to cast 1 of those at a time, and even if they have different Hotkeys it will choose which ability gets used regardless of what the User pressed.

Here's something neat that you can do with Order Strings as well, since the unit actually issues this exact order. This can be particularly useful for getting information like the target unit/point of an ability before the ability actually casts:
  • order example
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(thunderclap))
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: You just ordered a unit to cast Thunder Clap.
Here's a useful trigger for getting the name of ANY issued order. You'd be surprised how many there are:
  • get orders
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: ((Name of (Ordered unit)) + :) + (String((Issued order)))))
And there are two abilities with adjustable Order Strings, Channel and Charge Gold and Lumber abilities. You don't actually modify the Order String on these abilities directly, instead you adjust their Base Order Id which is a Data Field. Again, why Blizzard even allows you to click the Order String fields is beyond me seeing as how they don't work.
 

Attachments

  • ex.png
    ex.png
    108.3 KB · Views: 35
Last edited:
Status
Not open for further replies.
Top