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

[General] Illusion Reference

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
For example, after I cast Mirror Image, I want it to be able to save those Illusions (created by Mirror Image) into a variable of Unit Group or even Unit (Array).
How do I come up with that ?

Well, that is for Mirror Image, what about Wand of Illusion Target-based Illusion spawn ?
As we all know, using dummy to cast the spell enables the creation of Illusion from the target without mimicking the Mirror Image mechanics.
After I cast the spell, how do I refer the Illusion created by the cast ?

The most simple (and inefficient) ways is to pick unit within area of target, but, this will collide with other illusions that have been summoned previously.

Any method, guys ?

ADDITIONAL QUESTION
What about I used the Summoning ability event to capture the creation of the unit and after its timer has finished, I use the RemoveUnit function ?

When I experimented this approach, I realized that the Hero Portrait at the top-left has disappeared, does this mean that the Game System releases the handle of that unit, since I can't refer to the pointer any longer ?
Or does the handle, still exists ?

Remarks
Even though if I managed to use the following approach, the nature of Illusion is still hard to mimick, characteristics such as Illusion takes 300% more damage, Illusion only gets damage from Raw Damage, etc.

I still need to it to be an Illusion.
 
Last edited:
Level 12
Joined
Oct 16, 2010
Messages
680
trigger the effect:p you only need to 1. create unit of same type 2. set vertex coloring to allies (local player) to blueish 3. add expiration timer. 4. save unit to variable

not a big deal and provides what u want

EDIT: for the abilities ... don't know how can u disable for the unit. don't have WE right now

EDIT2 : the solution u mentioned could be used as well. I think summoning counts as last created unit
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
trigger the effect:p you only need to 1. create unit of same type 2.
I stopped reading after this part :p

As my Unit is a Hero-type, which means War3 System will treat it as a unique handle, rather than Normal-unit type, therefore, dynamically creating "new" Hero is a bad idea, as it is rather considered as "leak" to create more and more Heroes instead of Illusions.

EDIT2 : the solution u mentioned could be used as well. I think summoning counts as last created unit
I used the word "summon" does not refer to "A unit Summons another unit" mechanics @@
It's just a term for the illusion to "spawn".
Summoning unit is as same as creating a new unit which is, creating new hero, bad idea.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Use the "unit enters region" event, check for illusion type.

To detect which hero cast it, set a player variable when a hero casts mirror image, and use that one when the illusion detect trigger fires.

This might break if two units cast mirror image at the same time.

I had a crack at making some illusion code a while back: http://www.hiveworkshop.com/forums/...-code-snippets-40758/index54.html#post2265625

I don't remember quick how it worked or if it had issues, but it's worth a look I think.
 
Level 12
Joined
Oct 16, 2010
Messages
680
Summoning unit is as same as creating a new unit which is, creating new hero, bad idea.

I meant spawning an illusion counts as creating a unit , thus u can refer to it as (last created unit) , at least I think u can:p

EDIT:
This might break if two units cast mirror image at the same time.

that can not happen. but u don't even have to store the caster player
just check the owner of entering unit if it is an illusion:p

why haven't I tought of "entering unit"?...
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
This might be helpful for you:

  • Test
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Custom script: if IsUnitIllusion(udg_TempUnit) == true then
      • Game - Display to (All players) the text: fire
      • Unit - Pause TempUnit
      • Custom script: endif
This successfully paused the illusion I created by using the standard blademaster mirror image ability.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If I do that, how would I differentiate between different spells ?
Let's say I have 3 different spells that can produce Illusion (from same Hero casting all those 3 spells), how do I differentiate each Illusion spawn will each be assigned to Spell A for Illusion A, Spell B for Illusion B, Spell C for Illusion C?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
If I do that, how would I differentiate between different spells ?
Let's say I have 3 different spells that can produce Illusion (from same Hero casting all those 3 spells), how do I differentiate each Illusion spawn will each be assigned to Spell A for Illusion A, Spell B for Illusion B, Spell C for Illusion C?

Use the event Starts the effect of an ability or something like that. You save the unit who casted and the ability cast. When the Spawns a summoned unit (or alternatively Enters region) triggers, you load the unit who last casted a spell, who made the event trigger by spawning illusions. And also load the spell that was cast.

The illusion detection triggers are turned off most of the time. Turn them on when illusions are about to appear.

This gives you pretty good accuracy and reliability. There is a small chance I believe that if two units cast the same ability at the same time, then all the illusions created will be marked for the last unit that casted the spell. However if you only have one of the same unit type per player, there is no problem.
 
Status
Not open for further replies.
Top