• 🏆 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!

Illusion spell

Status
Not open for further replies.
Level 9
Joined
Apr 22, 2020
Messages
430
I want to make a storm bolt base spell, after it hits/damages a hero or enemy unit creates an illusion of the unit that was hit by stormbolt. Of course the illusion must be on the caster/your control and the illusion of the unit is created exactly where the enemy unit is. So does anyone got any idea of how on doing this. Note: Must be GUI
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
Make a base spell that does NOTHING, base it on something that can target Units but won't do anything to them. Rejuvenation comes to mind or you can use a customized Channel ability.

Create a new Dummy unit and create a new spell based on Storm Bolt. Add this new ability to our New Dummy in the Object Editor.

Create a new ability based on Wand of Illusion and give it 999999 Cast Range. Make sure it's setup correctly so that it can be cast on enemy units and used by our Dummy. Add this new ability to our New Dummy in the Object Editor.

Use Bribe's Damage Engine to detect when our Dummy unit deals damage with Storm Bolt, then order it to cast Wand of Illusion on the damaged unit.

Now for the triggers:
  • Events:
  • A unit starts the effect of an ability
  • Conditions:
  • Ability being cast Equal to Fake Storm Bolt (This is the base spell that does nothing)
  • Actions:
  • Set Variable Point = Position of triggering unit
  • Create 1 New Dummy at Point owned by Triggering Player facing default building degrees
  • Order last created unit to Human - Mountain King - Storm Bolt target unit of ability being cast
  • Add a 10.00 second expiration timer to last created unit
  • Custom script: call RemoveLocation (udg_Point)
Damage Engine stuff:
  • Events:
  • DamageEvent becomes Equal to 1.00
  • Conditions:
  • Unit-type of DamageEventSource Equal to New Dummy
  • Actions:
  • Custom script: call IssueTargetOrderById(udg_DamageEventSource, 852274, udg_DamageEventTarget)
Wand of Illusion doesn't show up in the list of abilities you can cast in GUI, so we need to use Custom script to cast it instead.

So pretty simple stuff. When our Hero casts their Fake Storm Bolt ability, a Dummy unit is created at their position, and casts the REAL Storm Bolt ability. The REAL ability has the Art/Damage effects.

We then detect when this REAL Storm Bolt ability deals damage, and order the damaging unit (which is our Dummy) to cast Wand of Illusion on the damaged unit.

For this to work properly you need to make sure that you only use this New Dummy unit in these triggers. Don't use it in anything else.
 
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
Make a base spell that does NOTHING, base it on something that can target Units but won't do anything to them. Rejuvenation comes to mind or you can use a customized Channel ability.

Create a new Dummy unit and create a new spell based on Storm Bolt. Add this new ability to our New Dummy in the Object Editor.

Create a new ability based on Wand of Illusion and give it 999999 Cast Range. Add this new ability to our New Dummy in the Object Editor.

Use Bribe's Damage Engine to detect when our Dummy unit deals damage with Storm Bolt, then order it to cast Wand of Illusion on the damaged unit.

Now for the triggers:
  • Events:
  • A unit starts the effect of an ability
  • Conditions:
  • Ability being cast Equal to Fake Storm Bolt (This is the base spell that does nothing)
  • Actions:
  • Set Variable Point = Position of triggering unit
  • Create 1 New Dummy at Point owned by Triggering Player facing default building degrees
  • Order last created unit to Human - Mountain King - Storm Bolt target unit of ability being cast
  • Add a 10.00 second expiration timer to last created unit
  • Custom script: call RemoveLocation (udg_Point)
Damage Engine stuff:
  • Events:
  • DamageEvent becomes Equal to 1.00
  • Conditions:
  • Unit-type of DamageEventSource Equal to New Dummy
  • Actions:
  • Custom script: call IssueTargetOrderById(udg_DamageEventSource, 852274, udg_DamageEventTarget)
Wand of Illusion doesn't show up in the list of abilities you can cast in GUI, so we need to use Custom script to cast it instead.

So pretty simple stuff. When our Hero casts their Fake Storm Bolt ability, a Dummy unit is created at their position, and casts the REAL Storm Bolt ability. The REAL ability has the Art/Damage effects.

We then detect when this REAL Storm Bolt ability deals damage, and order the damaging unit (which is our Dummy) to cast Wand of Illusion on the damaged unit.

For this to work properly you need to make sure that you only use this New Dummy unit in these triggers. Don't use it in anything else.
Can't we just set the "ability turned on" of the wand of illusion as like any other spells in the object editor? For example cripple and order the last created unit to cripple.

Edit: By the way how to custom script the dummy unit to cast the wand of illusion.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
Like I said, Wand of Illusion is missing from the list. You need to use this to order a unit to cast Wand of Illusion:
  • Custom script: call IssueTargetOrderById(CastingUnit, 852274, TargetUnit)
You replace "CastingUnit" with your Dummy and "TargetUnit" with the target of the spell. Since it's custom script you need to either use Jass or global variables when doing so.

And remember that when using global variables in Custom Script you need to give them the "_udg" prefix. For example, if you set the Dummy to a variable called D and the target to a variable called T, it would look like this:
  • Custom script: call IssueTargetOrderById(udg_D, 852274, udg_T)
 
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
Like I said, Wand of Illusion is missing from the list. You need to use this to order a unit to cast Wand of Illusion:
  • Custom script: call IssueTargetOrderById(CastingUnit, 852274, TargetUnit)
You replace "CastingUnit" to your Dummy and "TargetUnit" to the target of the spell. Since it's custom script you need to either use Jass or global variables.

And remember that when using global variables in Custom Script you need to give them the "_udg" prefix. For example, if you set the Dummy to a variable called D and the target to a variable called T, it would look like this:
  • Custom script: call IssueTargetOrderById(udg_D, 852274, udg_T)
  • Illusion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt (Illusion)
    • Actions
      • Set Illusion_Point = (Position of (Triggering unit))
      • Unit - Create 1 dummy (Illusion) for (Triggering player) at Illusion_Point facing Default building facing degrees
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Target unit of ability being cast)
      • Custom script: call IssueTargetOrderById(Dummy (Illusion), 852274, TargetUnitOfAbilityBiengCast)
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Illusion_Point)
is that correct?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
Nope, since it's custom script you need to either use a global variable or Jass. Here's an example using Jass that would work for your trigger:
  • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, GetSpellTargetUnit())
Otherwise, you can store the Casting Unit/Target unit of ability being cast as Unit variables and reference the variables instead. Like I did in my example from earlier:
  • Unit - Create 1 dummy (Illusion) for (Triggering player) at Illusion_Point facing Default building facing degrees
  • Set D = Last created unit
  • Set T = Target unit of ability being cast
  • Custom script: call IssueTargetOrderById(udg_D, 852274, udg_T)
 
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
Can Wand of Illusion target computer players? Make sure the Targets Allowed is setup properly.

And if that's not the issue, explain how it doesn't work.
Well i gave this ability to my dummy sorceress and tested it in the WE and works perfectly but when i made some of my dummy sorceress who also has the ability an ally they won't create the illusion it only cast the storm bolt dummy but doesn't create the illusion which is quite wierd because when i cast it, it works fine it creates the illusion but doesn't work on computer allied players who has the ability.
 
Level 9
Joined
Apr 22, 2020
Messages
430
  • Illusion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt (Neutral Hostile)
    • Actions
      • Set Illusion_Point = (Position of (Triggering unit))
      • Unit - Create 1 dummy (Illusion) for (Triggering player) at Illusion_Point facing Default building facing degrees
      • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, GetSpellTargetUnit())
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Illusion_Point)
By the way is it really necessary to make a dummy storm bolt that has no damage and orders a dummy unit to cast the real one instead? Because as you can see their i'm using the neutral hostile firebolt that has damage and stun.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
If you don't care when the illusion spawns then you don't need even need the Damage Engine. I designed it like this because you said "after it hits/damages a hero or enemy unit creates an illusion of the unit". The only way to detect when Storm Bolt (or Firebolt, they're the same spell) hits an enemy is with a Damage Engine.

So if you don't care about that, then you can scrap the damage engine, remove the fake storm bolt setup, lower the expiration timer to something short like 0.50 seconds, and delete the new Dummy unit and use your old one. Then all you need is 1 trigger which Creates a dummy in response to casting your spell and orders it to Wand of Illusion the target.

Why the Wand of Illusion isn't working for computer players, I don't know. Try creating the Dummy for Owner of Triggering unit instead of Triggering player, although I'm pretty sure Triggering player should work.

Additionally, make sure Wand of Illusion is setup correctly, make sure your Dummy is setup correctly, etc... Your Dummy should have it's movement type set to None, Speed Base set to 0, and Cast Backswing / Cast Point set to 0.00.
 
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
Don't really know what's the problem here, i have already checked my dummy unit, altered my Dummy Illusion spell especially it's target allowed, and checked the trigger and the variables. From my perspective i think this has something to do with the custom script, just my perspective though.
 
Level 19
Joined
Feb 27, 2019
Messages
580
So from what I gathered when you as a player use the ability it works fine. It can be cast on any allowed target and spawns an illusion as intended.

BUT when a computer player casts the ability, the storm bolt is cast but the illusion is not spawned.

Am I right?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
Yeah, that's the issue.

I just started reading about it here: [Trigger] - Computer player and issued orders

So maybe ordering the ability using the Rawcode will work?
  • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 'Alil', GetSpellTargetUnit())
@Dispatcher
Try that above custom script but change 'Alil' to the rawcode of your Wand of Illusion ability. That code is the default rawcode so you can keep it the same if you're using the default ability.

Press Control + D in the Object Editor to view the rawcodes, they come up as A000, A001, etc... for custom abilities unless you named them something else.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Ok i think i have found the issue here of the trigger, the trigger that i have initially used is this:
  • Illusion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt (Neutral Hostile)
    • Actions
      • Set Illusion_Point = (Position of (Triggering unit))
      • Unit - Create 1 dummy (Illusion) for (Owner of (Triggering unit)) at Illusion_Point facing Default building facing degrees
      • Custom script: call IssueTargetOrderById(GetLastCreatedUnit(), 852274, GetSpellTargetUnit())
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Illusion_Point)
which was the one that disables computer players to get the illusion when casting the spell. But when i tested out @Uncle's second version trigger it finally worked! Computer players when casting the storm bolt dummy can now also get the illusion when using this trigger:
  • Illusion Test 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt (Neutral Hostile)
    • Actions
      • Set Illusion_Point = (Position of (Triggering unit))
      • Unit - Create 1 dummy (Illusion) for (Owner of (Triggering unit)) at Illusion_Point facing Default building facing degrees
      • Set Illusion_Unit = (Last created unit)
      • Set IllusionUnit_Point = (Target unit of ability being cast)
      • Unit - Add a 0.80 second Generic expiration timer to (Last created unit)
      • Custom script: call IssueTargetOrderById(udg_Illusion_Unit, 852274, udg_IllusionUnit_Point)
      • Custom script: call RemoveLocation (udg_Illusion_Point)
Finally this issue has been solved now. Just another simple mistake that i quite often make, lol.
 
Status
Not open for further replies.
Top