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

[Solved] multiple illusions from wand

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
hey,

is there any way to make wand of illusion make multiple illusions?

I am trying to base a hero ability off of it to create illusions of other units (unlike mirror image which creates only of the caster) and haven't been able to get more than two... (caster (1)+dummy(1))


[ideally i would want - level 1 to create 5 illusions/ level 2 -10/ level 3 - 15 ]

thanks!

(i saw there are a lot of threads on this that point to this guide by @Flux on making "library illusions in jass - I don't know how to use jass and therefore have no idea how to modify it appropriately)
 
Level 14
Joined
Feb 7, 2020
Messages
386
You could use that library in GUI but at this point you might as well learn JASS as it will look ridiculous with tons of custom scripts.

It would look something like this, though I didn't test it:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Ability being cast) Equal to Item Illusions
    • Actions
      • -------- do GUI stuff above --------
      • Custom script: local Illusion illu
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer i = 0
      • Custom script: local integer x = GetUnitAbilityLevel(u,'Alil')*5
      • Custom script: local player p = GetOwningPlayer(u)
      • Custom script: loop
      • Custom script: exitwhen i >= x
      • Custom script: i = i + 1
      • Custom script: illu = Illusion.create(p, u, GetUnitX(u), GetUnitY(u))
      • Custom script: set illu.duration = 30
      • Custom script: set illu.damageTaken = 2
      • Custom script: set illu.damageGiven = 0
      • Custom script: endloop
      • -------- do GUI stuff below --------
You would change GetTriggerUnit() to whatever unit you want to make illusions of (JASS Manual: API Browser - Type unit).
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
You need to setup your Dummy so it can cast multiple spells without a delay. Then simply order the Dummy to cast Wand of Illusion however many times you want:
  • Illusion Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Replicate (Hero)
    • Actions
      • Set VariableSet TempPoint = (Position of (Target unit of ability being cast))
      • Set VariableSet TempTarget = (Target unit of ability being cast)
      • Set VariableSet Level = (Level of (Ability being cast) for (Triggering unit))
      • -------- --------
      • -------- Set how many Illusions are created --------
      • Set VariableSet Illusion_Count = (Level x 5)
      • -------- --------
      • -------- Create Dummy --------
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing Default building facing degrees
      • Set VariableSet Dummy = (Last created unit)
      • Unit - Add Replicate (Illusions) to Dummy
      • Unit - Set level of Replicate (Illusions) for Dummy to Level
      • Unit - Add a 1.00 second Generic expiration timer to Dummy
      • Custom script: call RemoveLocation (udg_TempPoint)
      • -------- --------
      • -------- Order Dummy to cast Wand of Illusion multiple times --------
      • For each (Integer A) from 1 to Illusion_Count, do (Actions)
        • Loop - Actions
          • Custom script: call IssueTargetOrderById( udg_Dummy, 852274, udg_TempTarget )
The important stats on the Dummy:
Art - Animation - Cast Backswing/Cast Point = 0.00
Movement Type: None
Speed Base: 0
Attacks Enabled: None
I have a working Dummy unit in the attached map.
 

Attachments

  • Illusion Example 2.w3m
    18.5 KB · Views: 33
Level 21
Joined
Mar 29, 2020
Messages
1,237
Ok so i probably got something wrong, but I just tried what you wrote @Uncle , and it crashed my map. for some reason i can't open your example map.

this is my code:

  • decoy army
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Decoy Army
    • Actions
      • Set temp_point = (Position of (Casting unit))
      • Set Temptarget = (Target unit of ability being cast)
      • Set abilitylevel = (Level of (Ability being cast) for (Triggering unit))
      • Set Illusion_count = (abilitylevel x 5)
      • Unit - Create 1 dummywinventory for (Triggering player) at temp_point facing Default building facing degrees
      • Set Dummy = (Last created unit)
      • Unit - Add Decoy Army to Dummy
      • Unit - Set level of Decoy Army for Dummy to abilitylevel
      • Unit - Add a 1.00 second Generic expiration timer to Dummy
      • Custom script: call RemoveLocation (udg_temp_point)
      • For each (Integer A) from 1 to Illusion_count, do (Actions)
        • Loop - Actions
          • Custom script: call IssueTargetOrderById( udg_Dummy, 852274, udg_Temptarget )
is it possible the problem is that i gave the dummy the same ability as the original caster(that is how i understood what you wrote...) and this caused an endless loop? thanks!
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
That's pretty easy to fix. Add a check for if the unit is a hero or whatever it should only work on.
that made it stop crashing, but it went back to only making 2 illusions.

Yeah, in my setup the main ability being cast is based on Channel.
can you elabaorate? this made the casting unit do the channeling dance while the target unit had the channeling animation. still no illusions :confused:2
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Well, I modified the Channel ability to work the way I wanted it to. You should search for some info regarding Channel, it's a useful ability that is designed to be used with triggers.

I believe my settings were:
Options: Visible
Target Type: Unit
Disable Other Abilities: False
Follow Through Time: 0.00

And you can set the animation to whatever you want like you would with any ability.

Anyway, if your Dummy unit isn't setup properly than it won't be able to cast the spell multiple times. I went over this in my original post.
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Can you post your trigger. And which ability are you adding to the dummy.

The dummy gets wand of illusion.

The hero gets Channel.

Make sure your condition checks for the hero ability.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
wait, so the hero and the dummy get different abilities? I thought you wrote in your original post that they get the same ability... I assumed the trigger for the real illusion came through the custom script at the end.

base.gif
Illusion Cast

  • joinminus.gif
    cond.gif
    Conditions
    • line.gif
      joinbottom.gif
      if.gif
      (Ability being cast) Equal to Replicate (Hero)
  • ...
    • empty.gif
      join.gif
      unit.gif
      Unit - Add Replicate (Illusions) to Dummy
    • empty.gif
      join.gif
      unit.gif
      Unit - Set level of Replicate (Illusions) for Dummy to Level

these aren't the same ability?
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
The suffixes are different: (Hero) and (Illusion). Sorry if that was unclear. Hero = Based on Channel. Illusion = Wand of Illusion.

That custom script is the order id for wand of illusion. Some abilities are missing from the "Order unit to cast ability" Action so you can use the id of the ability instead. Every ability has a 6 digit integer Id.

To get an abilities integer id you can use:
  • Events:
  • A unit begins casting an ability
  • Actions:
  • Custom script: set udg_id = GetSpellAbilityId()
  • Display text message (id) to all players
Make sure you have an integer variable called "id" (id is the name I chose but you could name it something else). Just remember it's case sensitive.

Then you can display this variable in a text message and read it ingame. It can help to display the name of the ability + the id.

Edit: Fixed the example trigger.
 
Last edited:
Status
Not open for further replies.
Top