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

Is there a "use stored ability" action?

Status
Not open for further replies.
Level 29
Joined
Apr 6, 2010
Messages
3,139
I'm trying to create a "voodoo doll" spell: the doll selects a visible allied or enemy unit; after which any ability/buff cast on the doll will also be cast on the unit until one or the other dies.

However, I can't seem to find an "order dummy to use the spell that was just cast" trigger (even by storing the ability as a variable), is there a way to do that, or is the only option to put an if/then/else trigger for EVERY ability in the game?
 
Level 29
Joined
Apr 6, 2010
Messages
3,139
But can that work for every ability? I want to know if there's a way to automatically have the game cast the used spell, instead of having to trigger every possible spell: "if ability = firebolt, give firebolt, use firebolt on target; if ability = frost nova, give frost nova, use frost nova on target, if ability =..."
 
Level 7
Joined
Mar 6, 2006
Messages
282
You're talking about GUI, where you can't do 'Unit - Order' and set the ability as a variable?

Use this instead; it's the same line, but in JASS.

  • Custom script: call IssueTargetOrderById( udg_VoodooDoll, udg_Ability, udg_Target )
It takes the ability by ID, so store the ability in a variable first, then replace udg_Ability with the variable you're using. If you variable is called VoodooAbility then in JASS, it would be udg_VoodooAbility

You also need to replace udg_VoodooDoll with the variable that holds your voodoo unit.

And finally, replace udg_Target with the variable that holds your voodoo unit's target.

Edit: grr, wasn't fast enough.
 
Level 29
Joined
Apr 6, 2010
Messages
3,139
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to target
      • (Unit-type of (Triggering unit)) Equal to Voodoo Doll
    • Actions
      • Set doll = (Triggering unit)
      • Set dolltarget = (Target unit of ability being cast)
  • Untitled Trigger 002
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Target unit of ability being cast) Equal to doll
    • Actions
      • Unit - Create 1 cast for (Owner of (Triggering unit)) at (Position of dolltarget) facing (Position of dolltarget)
      • Set dollcast = (Last created unit)
      • Set dollabil = (Ability being cast)
      • Unit - Add dollabil to dollcast
      • Custom script: call IssueTargetOrderById( udg_dollcast, udg_dollabil, udg_dolltarget )
 
Level 29
Joined
Apr 6, 2010
Messages
3,139
  • Untitled Trigger 002
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Voodoo Doll
    • Actions
      • Set doll = (Target unit of ability being cast)
      • 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) has buff target ) Equal to True
            • Then - Actions
              • Set dolltarget = (Picked unit)
              • Unit - Create 1 cast for (Owner of (Triggering unit)) at (Position of dolltarget) facing (Position of dolltarget)
              • Set dollcast = (Last created unit)
              • Set dollabil = (Ability being cast)
              • Unit - Add dollabil to dollcast
              • Custom script: call IssueTargetOrderById( udg_dollcast, udg_dollabil, udg_dolltarget )
            • Else - Actions
              • Do nothing
I tried it like this, but it's still doing everything but using the spell.
 
Level 7
Joined
Mar 6, 2006
Messages
282
Where is the target getting the buff "target" from?

Check your dummy unit "cast" to make sure it has mana to cast the spell. Also, depending on how your target is selected, your spell may not be able to target the 'target unit'.

You can find out exactly why it's not casting if you try it in game, then select your 'cast' dummy and manually try to cast the spell yourself. Take off Locust or anything else that may prevent you from selecting your dummy unit. It's probably because of mana or 'Target is not allowed'.
 
Level 29
Joined
Apr 6, 2010
Messages
3,139
The "target" buff is based off of Faerie Fire with infinite range. First I have the doll cast it on the unit. (If no one has the target buff I tried to set the spell to be cast on the caster instead of Do nothing, but that causes something like 18 dummies to appear around the caster every time he casts.)

  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Voodoo Doll
    • Actions
      • Set doll = (Target unit of ability being cast)
      • 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) has buff target ) Equal to True
            • Then - Actions
              • Set dolltarget = (Picked unit)
              • Unit - Create 1 cast for (Owner of (Triggering unit)) at (Position of dolltarget) facing (Position of dolltarget)
              • Set dollcast = (Last created unit)
              • Set dollabil = (Ability being cast)
              • Unit - Add dollabil to dollcast
              • Custom script: call IssueTargetOrderById( udg_dollcast, udg_dollabil, udg_dolltarget )
            • Else - Actions
              • Set dolltarget = (Casting unit)
              • Unit - Create 1 cast for (Owner of (Triggering unit)) at (Position of dolltarget) facing (Position of dolltarget)
              • Set dollcast = (Last created unit)
              • Set dollabil = (Ability being cast)
              • Unit - Add dollabil to dollcast
              • Custom script: call IssueTargetOrderById( udg_dollcast, udg_dollabil, udg_dolltarget )
When I try to cast the spell manually (Purge in most cases), it works perfectly (dummy is based off the sorceress without Locust, abilities or upgrades, has full mana, has the ability and is able to cast it).
 
Level 7
Joined
Mar 6, 2006
Messages
282
That IF statement is being run for every unit in your map (Pick every unit in X and) so when it checks to see if they have the buff, and they don't, it's going to run that Else statement for every unit that doesn't have the buff.

You need another variable to check if there was a target for the voodoo doll. Set it to false at the start of the spell, and set it to true, if the doll found a target. Then at the end of the spell, you can check if it found a target, and if not, THEN set the target as the caster.

Keep in mind that the way you currently have it "Unit - Create 1 cast for (Owner of (Triggering unit))", your dummy caster will be owned by the same player as the caster, so it may not be able to cast all spells on the caster (friend isn't allowed as a target). This is actually true for almost any spell that you would attempt to cast on an enemy. The owner of the dummy must be something like Neutral, but then neutral would take credit for killing the caster if it were to die.

=================

Back to your original problem. The trigger looks fine, it should be casting at the target. If it wasn't casting, then there may not be a target (no one has the target buff). Try adding a debug message where the dummy caster is attempting to cast the spell, like "Game - Message to all players 'attempting to cast'" so you can see if it's actually running.
 
Status
Not open for further replies.
Top