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

GUI Custom Illusion v1.1


Description
Creating mirror image using trigger is impossible no more. vJass version is also available here.

It's highly recommended to use this illusion library instead, if you know vJass. It's been approved and is much better than mine (no requirement and works on magic immune unit). But you have to work a little on object editor part.​

Known bug
When you create an illusion of structure/building unit, it will initially play "birth" animation. But you can play it's "stand" animation right after the create function is executed. Just like the way I changed the illusion's size in the demo trigger.​

Requirements
- DDD
- UnitIndexer by Bribe
- UnitEvent by Bribe​

How to install
1. Import dummy.mdx at import manager
2. Install all required systems correctly
3. Copy Dummy, ILLUSION_ITEM, ILLUSION_ABILITY_1 & ILLUSION_ABILITY_2 at Object Editor
4. Make sure ILLUSION's ability is ILLUSION_ABILITY_2
5. Configure the system​

How to use
(Included inside the "READ ME")​

Trigger
  • CustomIllusion
    • Events
      • Game - UnitIndexEvent becomes Equal to 3.00
    • Conditions
    • Actions
      • -------- --------
      • -------- CONFIGURATION --------
      • -------- --------
      • Set CI__dummyID = Dummy
      • Set CI__itemID = ILLUSION_ITEM
      • Set CI__spellID = ILLUSION_ABILITY_2
      • -------- --------
      • Custom script: call ExecuteFunc("CI__onInitialization")
      • Custom script: endfunction
      • -------- --------
      • -------- execute this function to create mirror image based on existing unit --------
      • -------- --------
      • Custom script: function CI__Copy takes nothing returns nothing
      • -------- if target is valid --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (CI__IllusionUnit is alive) Equal to (==) True
            • (CI__IllusionUnit is Magic Immune) Equal to (==) False
          • Then - Actions
            • Set CI__wantDetect = True
            • Set CI__tempLoc = (Position of CI__IllusionUnit)
            • Unit - Move CI__dummyCaster instantly to CI__tempLoc
            • Unit - Change ownership of CI__dummyCaster to CI__IllusionOwner and Retain color
            • Hero - Order CI__dummyCaster to use CI__dummyItem on CI__IllusionUnit
            • Custom script: call RemoveLocation(udg_CI__tempLoc)
          • Else - Actions
      • Custom script: endfunction
      • -------- --------
      • -------- execute this function to create new mirror image --------
      • -------- --------
      • Custom script: function CI__Create takes nothing returns nothing
      • -------- if unit type is valid --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CI__IllusionType Not equal to (!=) No unit-type
          • Then - Actions
            • Set CI__tempLoc = (Point(0.00, 0.00))
            • Unit - Create 1 CI__IllusionType for Neutral Passive at CI__tempLoc facing CI__IllusionFacing degrees
            • Set CI__IllusionUnit = (Last created unit)
            • Custom script: call RemoveLocation(udg_CI__tempLoc)
            • Custom script: call CI__Copy()
            • Unit - Remove CI__IllusionUnit from the game
          • Else - Actions
      • Custom script: endfunction
      • -------- --------
      • -------- at detected damage event --------
      • -------- --------
      • Custom script: function CI__onDmgEvt takes nothing returns boolean
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Multiple ConditionsOr - Any (Conditions) are true
              • Conditions
                • (DDD__Event__Source is an illusion) Equal to (==) True
                • (DDD__Event__Target is an illusion) Equal to (==) True
          • Then - Actions
            • Set CI__tempDex = (Custom value of DDD__Event__Source)
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CI__isIllusion[CI__tempDex] Equal to (==) True
                • Then - Actions
                  • Set DDD__Event__Amount = (DDD__Event__Amount x CI__dealtFactor[CI__tempDex])
                • Else - Actions
            • Set CI__tempDex = (Custom value of DDD__Event__Target)
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CI__isIllusion[CI__tempDex] Equal to (==) True
                • Then - Actions
                  • Set DDD__Event__Amount = (DDD__Event__Amount x CI__takenFactor[CI__tempDex])
                • Else - Actions
          • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • -------- --------
      • -------- executed function on index event --------
      • -------- --------
      • Custom script: function CI__onIndexEvt takes nothing returns boolean
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CI__wantDetect Equal to (==) True
            • (UDexUnits[UDex] is an illusion) Equal to (==) True
          • Then - Actions
            • Set CI__wantDetect = False
            • -------- --------
            • Set CI__LastCreatedIllusion = UDexUnits[UDex]
            • Set CI__tempDex = (Custom value of CI__LastCreatedIllusion)
            • Set CI__dealtFactor[CI__tempDex] = CI__DealtDmgFactor
            • Set CI__takenFactor[CI__tempDex] = CI__TakenDmgFactor
            • Set CI__isIllusion[CI__tempDex] = True
            • Unit - Move CI__LastCreatedIllusion instantly to CI__IllusionLocation
            • -------- reset assigned values --------
            • Set CI__IllusionFacing = 0.00
            • Set CI__DealtDmgFactor = 0.00
            • Set CI__TakenDmgFactor = 0.00
            • Set CI__IllusionType = No unit-type
            • Set CI__IllusionUnit = No unit
            • Custom script: set udg_CI__IllusionOwner = null
            • -------- remove leak --------
            • Custom script: call RemoveLocation(udg_CI__IllusionLocation)
          • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • -------- --------
      • -------- executed function on deindex event --------
      • -------- --------
      • Custom script: function CI__onDeindexEvt takes nothing returns boolean
      • Set CI__tempDex = (Custom value of UDexUnits[UDex])
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CI__isIllusion[CI__tempDex] Equal to (==) True
          • Then - Actions
            • Set CI__dealtFactor[CI__tempDex] = 0.00
            • Set CI__takenFactor[CI__tempDex] = 0.00
            • Set CI__isIllusion[CI__tempDex] = False
          • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • -------- --------
      • -------- initialization function --------
      • -------- --------
      • Custom script: function CI__onInitialization takes nothing returns nothing
      • Set CI__tempLoc = (Point(0.00, 0.00))
      • Unit - Create 1 CI__dummyID for Neutral Passive at CI__tempLoc facing Default building facing (270.0) degrees
      • Set CI__dummyCaster = (Last created unit)
      • Unit - Add CI__spellID to CI__dummyCaster
      • Item - Create CI__itemID at CI__tempLoc
      • Set CI__dummyItem = (Last created item)
      • Hero - Give CI__dummyItem to CI__dummyCaster
      • Custom script: call RemoveLocation(udg_CI__tempLoc)
      • -------- --------
      • Custom script: set udg_CI__onDmgTrigger = CreateTrigger()
      • Trigger - Add to CI__onDmgTrigger the event (Game - DDD__Event__Trigger becomes Equal to 1.00)
      • Custom script: call TriggerAddCondition(udg_CI__onDmgTrigger, Condition(function CI__onDmgEvt))
      • -------- --------
      • Custom script: set udg_CI__onIndexTrigger = CreateTrigger()
      • Trigger - Add to CI__onIndexTrigger the event (Game - UnitIndexEvent becomes Equal to 1.00)
      • Custom script: call TriggerAddCondition(udg_CI__onIndexTrigger, Condition(function CI__onIndexEvt))
      • -------- --------
      • Custom script: set udg_CI__onDeindexTrigger = CreateTrigger()
      • Trigger - Add to CI__onDeindexTrigger the event (Game - DeathEvent becomes Equal to 3.00)
      • Custom script: call TriggerAddCondition(udg_CI__onDeindexTrigger, Condition(function CI__onDeindexEvt))

Demo
  • Copy
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set tempGroup = (Units currently selected by Player 1 (Red))
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • -------- set base unit --------
          • Set CI__IllusionUnit = (Picked unit)
          • -------- set the facing angle, etc. --------
          • Set CI__IllusionFacing = (Facing of CI__IllusionUnit)
          • Set CI__IllusionOwner = (Owner of CI__IllusionUnit)
          • -------- no need to remove this location afterwards --------
          • Set CI__IllusionLocation = (Position of CI__IllusionUnit)
          • -------- This means the image will deals half of original damage --------
          • Set CI__DealtDmgFactor = 0.50
          • -------- This means the image will takes 4x of original damage --------
          • Set CI__TakenDmgFactor = 4.00
          • -------- create the illusion based on variables above --------
          • Custom script: call ExecuteFunc("CI__Copy")
          • -------- resize illusion which is created by this system --------
          • Animation - Change CI__LastCreatedIllusion's size to (200.00%, 100.00%, 100.00%) of its original size
      • Custom script: call DestroyGroup(udg_tempGroup)

Credits
- UnitIndexer & UnitEvent by Bribe
- Dummy.mdx by Vexorian​

Keywords:
custom, triggered, mirror, image, illusion
Contents

Custom Illusion (Map)

Reviews
14:37, 4th Mar 2015 IcemanBo: The system allows to create an illusion, based on a unit, or on a unit type. The illusion may have a modified factor for dealt damage, but also for the damage taken. Approved.

Moderator

M

Moderator

14:37, 4th Mar 2015
IcemanBo:

The system allows to create an illusion, based on a unit, or on a unit type.
The illusion may have a modified factor for dealt damage, but also for the damage taken.

Approved.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
I'm sorry, perhaps previous file was not working properly after I saved it using normal WE, at least for me. So I have re-uploaded a new file. Still searching for the problem.

:3 this is first GUI Resource you made :D
lol
No one likes vJass and I think worldwide should know about this system then I made the GUI version so everyone can use.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I've already told you that there are few flaws/bugs in your vJass version.
You should at first make sure your jass script works properly, then release GUI version.

I've even pasted the example of how you can get improper results which clearly could lead to collapsing of whole instanciation process.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
I've already told you that there are few flaws/bugs in your vJass version.
You should at first make sure your jass script works properly, then release GUI version.

I've even pasted the example of how you could get improper results which clearly can collapse whole instanciation process.

check the newest update

It does alright with your little test.
 

Attachments

  • a.jpg
    a.jpg
    52.6 KB · Views: 327

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
No it does not :(
You basically changed nothing, I was able to break your system in a second :(

You seem to miss the point: since there is delay between UnitUseItemTarget and actual appearance of illusion, the numerous calls could occur before the onIndex method fires - we have created many illusions, but instanciated just one.

Thats why you need to create a queue of some kind to store each illusion created via this system. When I find some free time, I'll check my "Illusion", see the problem and help you out with your script.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
have you tested the newest update? It works alright when I created 12 images at the same time, or I need to test it for 100 units?

since there is delay between UnitUseItemTarget and actual appearance of illusion
you seem like very sure about that.

EDIT:
it works alright for 48 creations at once. I wont make future tests because 48 creations hits OP limit.

the numerous calls could occur before the onIndex method fires
I missed that part. You are right, a function call between the operation could break it. Looking for the solution.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Another example:
JASS:
scope TestIllusion initializer init

	private function onCast takes nothing returns boolean
		local unit u = GetSpellTargetUnit()
		call Illusion.create(GetTriggerPlayer(), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), 0)
		set u = null
		return false
	endfunction

	private function init takes nothing returns nothing
		local trigger t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
		call TriggerAddCondition(t, Condition(function onCast))
		set t = null
	endfunction

endscope
Test this together with your "Create" trigger (the 'esc' one). Let them both be enabled at the same time.
 
Level 4
Joined
Dec 22, 2016
Messages
67
hello , I'm currently using bribe's damage detection system in my map and I'm gonna have this system too , since it uses a different damage detection system (DDD) does this cause a malfunction?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
hello , I'm currently using bribe's damage detection system in my map and I'm gonna have this system too , since it uses a different damage detection system (DDD) does this cause a malfunction?
His DDD System would need a compatibility version to work with Damage Engine. I should be able to create one for you tomorrow; it'd be similar to the ones i made for PDD and GDD.
 
Level 4
Joined
Dec 22, 2016
Messages
67
Ok turns out it was easier to change this system to just use Damage Engine instead of creating a wrapper for DDD (a system Quilnez created which has features I don't replicate in DamageEngine). So I've attached it here.
Great ! That was exactly what I wanted ! Sorry if I'm obsessive and I ask too much , but , I already installed damage engine and unit event system in my map , so all I have to do is copy this system's folder and ability and item , and then configure them? no need for any other systems such as DDD?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Great ! That was exactly what I wanted ! Sorry if I'm obsessive and I ask too much , but , I already installed damage engine and unit event system in my map , so all I have to do is copy this system's folder and ability and item , and then configure them? no need for any other systems such as DDD?

Yeah, i think there are 2 abilities in the map though. Make sure you follow his installation instructions to ensure it is set up correctly. DDD is not needed though.
 
Level 4
Joined
Dec 22, 2016
Messages
67
Yeah, i think there are 2 abilities in the map though. Make sure you follow his installation instructions to ensure it is set up correctly. DDD is not needed though.
Hello , sorry to bother you again , but I felt like I have to say this , it seems this system has some problems with your knock back system , when both are installed and enabled , when I try to knock back some units it causes something more than a crash! the computer totally stops! and memory use goes up every second (from 250 Mb which is normal Warcraft map to like 750 Mb just in a few seconds after casting knock back)
 
Top