• 🏆 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 Editor v1.5c [vJass + GUI Support]

  • Like
Reactions: FUJI
Illusion Editor v1.5c




This system provides users with helpful utilities with regards to creation of illusions as well as the manipulation of their stats dynamically.
With this system, you can now create illusions of any type as easily as creating units.
Read the code documentation for more details.


System features:
- Specific illusion type creation
- Unit based illusion creation
- Dynamic illusion timed life
- Dynamic illusion damage dealt/received factor
- Dynamic illusion death special effect
- + A GUI Support


Credits:
- Looking_For_Help (DamageEvent)
- Vexorian [TimerUtils]
- Bribe ([Table)
- Flux (DummyRecycler)
- Nestharus (Alloc)


Click the "Preview Triggers" button below to preview the system and the sample spells' codes.


v1.5c
- Fixed a bug regarding the value returned by the illusions' duration and elapsed time
- Added a new method/function for retrieving the dying illusion inside an illusion death event
- Added 2 additional demo spells using this system namely Soul Drain & Replicate
- Updated the required libraries
- Optimized some parts of the code
- Other changes

v1.5b
- Fixed a bug regarding permanent illusions' elapsed time returning 0
- Fixed a bug regarding building illusions playing its birth animation
- Removed optional library AllocFast
- Other changes

v1.5
- Recoded the entire system
- Now uses struct
- Updated the dependencies
- Updated the documentation and the GUI Support
- Removed some features from the previous versions like the ability to set an illusion's level
- Other changes

v1.4
- Dummycaster is now given the illusion ability directly instead of an item with the same ability
- Made Table an optional requirement
- Fixed an error in the function SetIllusionLevel()
- Fixed an error on triggerregistration when RegisterPlayerUnitEvent is not found
- Other changes

v1.3c
- Updated the GUI IllusionEditor Documentation
- Updated the IllusionEditor GUI Support to include the functionalities of the GetIllusionBaseUnit(), GetIllusionElapsedTime(), and the IllusionDeathEvent
- Restructured the Operate() function of the IllusionEditor GUI Support for an even execution speed by replacing the long elseif chains with a separate trigger for each operation.
- Fixed a bug on the previous version where the targetorders to the illusions are not cached properly due to unitindex key of the hash not being flushed during
- Fixed the error regarding an illusion death event firing during illusion replacement
- Other changes

v1.3b
- Fixed the errors on the functions that gets the illusions' duration aspects
- Added a new API GetIllusionBaseUnit() for getting the unit origin of the product illusions of CopyUnit()
- Removed the hook for DoNothing(), instead, the GUI Support now uses [Trigger - Run <trig> ignoring conditions]
- replaced breaks with exitwhen true for vexorian jasshelper compatibility
- Some other changes

v1.3
- Added a new API GetIllusionElapsedTime() for getting the elapsed time of an illusion
- Shortened the function AdjustTimedLife
- Removed the unnecessary return values when in debug mode in the public functions
- Other changes

v1.2c
- Updated some documentations
- Added some optional library requirements including TimerUtils, GroupUtils, PlayerUtils
- Simplified some script sections
- Added the API for registering an illusion death event
- Fixed a bug in the previous version where illusions' death effect visibility are not properly managed
- Updated the demo spell
- Some other code restructuring and some other fixes

v1.2b
- Not Uploaded

v1.2
- Added a GUI support together with its guide and documentation
- Fixed the bug regarding GetLastIllusion returning the replacement illusion in cases where an illusions time needs to be extended
- Now uses a module initializer instead of a struct initializer
- Simplified many of the nested if statements by using the conjunction and on their condition
- Other fixes and changes

v1.1c
- Fixed the bug regarding the dummy item being created at the map center on map Init
- Small changes

v1.1b
- Placed the system initializer inside a struct initializer instead of a library initializer
- Replaced Bribe's Damage Engine with PDDS by Looking_For_Help
- Replaced Bribe's Unit Indexer with TriggerHappy's UnitDex
- Only uses 1 dummy caster for the system instead of 1 per illusion creation
- Only uses 1 item instead of 1 per illusion creation
- Added Table to the library requirement
- Changed the API naming
- Some minor code restructuring
- Small fixes
- Other changes

v1.1
- Added debug messages for debug mode
- Made some of the API functions to return boolean value depending on the success of the operation
- Added UnitIndexerGUI library to the requirement
- Added an API for users to put the functions they want to run when the system initializes, like creating an illusion at system initialization for example.
- Other minor changes

v1.0c
- Some fixes
- Some code restructuring
- Added more function/APIs

v1.0b
- Not uploaded

v1.0
- First Upload
Contents

Illusion Editor v1.5c (Map)

Reviews
KILLCIDE
I was a little hesitant to approve this given there was a similar one in the JASS section, but I guess its nice to have both. An advantage this one has is the GUI-friendly interface you implemented. The available configurability you added for each...

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
Well, this one includes some things not included in the snippet.
Aside from making an illusion based on an existing unit on the map, his system allows you to create an illusion where you only have to specify the unit type of the illusion you're going to create.
This system also allows you to create permanent illusions by setting the duration to 0. And of course theres more. They are written at the start of the main script.

EDIT: So i missed your question :D, well the concept of the two are different.
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
I fail to see any difference from your system and Flux's other than you allow the use of unittype creation. I'm hoping another mod / reviewer can do this one for me since I'm not really in the mood to compare two systems against one another. I do recommend taking a look at Bribe's vJass plugin for his Unit Indexer. It will reduce a nice amount of the local declarations you have in some functions. Have you also maybe considered looking into structs?
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
Have you also maybe considered looking into structs?
I'm not yet confident in using structs, I will use it for public releases when I see that I can already handle it properly.

EDIT:
Bump
Updated to version 1.1b
Code:
- Placed the system initializer inside a struct initializer instead of a library initializer
- Replaced Bribe's Damage Engine with PDDS by Looking_For_Help
- Replaced Bribe's Unit Indexer with TriggerHappy's UnitDex
- Only uses 1 dummy caster for the system instead of 1 per illusion creation
- Only uses 1 item instead of 1 per illusion creation
- Added Table to the library requirement
- Changed the API naming
- Some minor code restructuring
- Small fixes
- Other changes


EDIT:
Updated to version 1.2
Code:
- Added a GUI support together with its guide and documentation
- Fixed the bug regarding GetLastIllusion returning the replacement illusion in cases where an illusions time needs to be extended
- Now uses a module initializer instead of a struct initializer
- Simplified many of the nested if statements by using the conjunction "and" on their condition
- Other fixes and changes

Bump?
 
Last edited:
Level 20
Joined
Aug 13, 2013
Messages
1,696
JASS:
call KillUnit( u )
call RemoveUnit( u )
^ Why you need to merge the two?
I think you only need one of them or just remove the kill func.

I didnt test the demo map yet, but still based on the features of this system I can say that it is nice to interact with the system and very useful from customizing or manipulating artificial illusions. It also has a GUI support which makes the usage a plus factor.
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
^ Why you need to merge the two?
I think you only need one of them or just remove the kill func.
Right. I will remove that next update

Honestly I don't know that there is that already. Anyway, it's also good for users to have more utilities for illusions that isn't included there ^.

Updated to v1.2c
Code:
- Updated some documentations
- Added some optional library requirements including TimerUtils, GroupUtils, PlayerUtils
- Simplified some script sections
- Added the API for registering an illusion death event
- Fixed a bug in the previous version where illusions' death effect visibility are not properly managed
- Updated the demo spell
- Some other code restructuring and some other fixes

Updated to v1.3
Code:
- Added a new API GetIllusionElapsedTime() for getting the elapsed time of an illusion
- Shortened the function AdjustTimedLife
- Removed the unnecessary return values when in debug mode in the public functions
- Other changes

It's been almost two months and still no reviews :(
 
Last edited:
It seems visualy counter intuitive to use constant duration loops that do not actually display the remaining duration of an illusion.
I know that blizzard doesn't provide proper natives, but maybe it should just not be supported then, to have dynamic durations.

Nice that alatering the death effect is supported.

Cohader's break is used, but the script should be compileable on Vexorian's JassHelper.

Don't do this:

hook DoNothing Operate

Run a registration trigger for example, it also can be achieved easily with GUI.

structs could be a win in this case I believe, but I read your reply on it above. So maybe it's okay for now.

JASS:
*/function IllusionDeathEvent takes code c returns nothing/*
        - Adds a code to run when an illusion created from this system dies
^Does the user has access to the original unit of which the illusion was made in this death function?
Maybe there can be a "GetIllusionOrigin" function or so which returns the original unit of the illusion.
User might use it always, but also onDeath function it was useful.

I am not sure if there needs to be two seperate functions, CreateIllusion and Copy.
An illusion makes only sense if it also mimics everything else, like health/items/...
So using an Illusion which has full HP makes no sense if the original unit has only half of the HP, for example.
I suggest to make just an original unit as a requirement, instead of using only a general "base id" in CreateIllusion.

Idk if I did something wrong or changed something accidently, but this: call CreateIllusion(Player(0), 'Hpal', 2, 0, 0, 0, 0, 0) does not create the illusion for player red for me. ;o Could you test this maybe? Also the duration seemed wrong.


Goot attempt so far!
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
It seems visualy counter intuitive to use constant duration loops that do not actually display the remaining duration of an illusion.
I know that blizzard doesn't provide proper natives, but maybe it should just not be supported then, to have dynamic durations.
I don't understand yet, could you elaborate =)

Cohader's
break
is used, but the script should be compileable on Vexorian's JassHelper.
I didn't know it isn't compileable with Vex's, will change that.

Run a registration trigger for example, it also can be achieved easily with GUI.
Will change it

^Does the user has access to the original unit of which the illusion was made in this death function?
Maybe there can be a "GetIllusionOrigin" function or so which returns the original unit of the illusion.
User might use it always, but also onDeath function it was useful.
No, hmm useful feature so I'll add it.

I am not sure if there needs to be two seperate functions, CreateIllusion and Copy.
An illusion makes only sense if it also mimics everything else, like health/items/...
So using an Illusion which has full HP makes no sense if the original unit has only half of the HP, for example.
I suggest to make just an original unit as a requirement, instead of using only a general "base id" in CreateIllusion.
It just came to my thought that some might make a map/game only composed of illusions :D. Anyway, I think its also useful to have this option and I can also imagine it being used in a spell.

Idk if I did something wrong or changed something accidently, but this:
call CreateIllusion(Player(0), 'Hpal', 2, 0, 0, 0, 0, 0)
does not create the illusion for player red for me. ;o Could you test this maybe? Also the duration seemed wrong.
I just tested it and it works fine, it created an illusion for me for 2 seconds.


Maybe Ill update this tomorrow =)
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
I see, that's a big defect. Will update this soon.

Updated to v1.3b:
- Fixed the errors on the functions that gets the illusions' duration aspects
- Added a new API GetIllusionBaseUnit() for getting the unit origin of the product illusions of CopyUnit()
- Removed the hook for DoNothing(), insteadthe GUI Support now uses [Trigger - Run <trig> ignoring conditions]
- replaced breaks with exitwhen true for vexorian jasshelper compatibility
- Some other changes

Updated to v1.3c:
- Updated the GUI IllusionEditor Documentation
- Updated the IllusionEditor GUI Support to include the functionalities of the GetIllusionBaseUnit(), GetIllusionElapsedTime(), and the IllusionDeathEvent
- Restructured the Operate() function of the IllusionEditor GUI Support for an even execution speed by replacing the long elseif chains with a separate trigger for each operation.
- Fixed a bug on the previous version where the targetorders to the illusions are not cahced properly due to unitindex key of the hash not being flushed during
- Fixed the error regarding an illusion death event firing during illusion replacement
- Other changes
 
Last edited:

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
@IcemanBo
Updated to v1.4
- Dummycaster is now given the illusion ability directly instead of an item with the same ability
- Made Table an optional requirement
- Fixed an error in the function SetIllusionLevel()
- Fixed an error on triggerregistration when RegisterPlayerUnitEvent is not found
- Other changes
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
I was a little hesitant to approve this given there was a similar one in the JASS section, but I guess its nice to have both. An advantage this one has is the GUI-friendly interface you implemented. The available configurability you added for each illusion instance is great, and I couldn't find any issues when playing around with the API.

Needs Fixed

  • Nothing

Suggestions

  • Nothing

Status

Approved
 

Iph

Iph

Level 2
Joined
Jul 31, 2016
Messages
39
Would you consider adding a function to count the illusions the unit has generated and its illusions have generated? I tried adopting the function in the demo but it returned unreliable results to me. Would be nice to distinguish between the original unit's illusion count, its illusions' illusion count, and the total sum of the two.
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
The functionality that you want is a bit very specific, I don't think I would implement that directly in my system. However I can give you a little snippet that do just that if you tell me what it is that you're hoping to achieve.

EDIT:
Btw, if you adopted my method in my demo spell correctly, it should work.
 

Iph

Iph

Level 2
Joined
Jul 31, 2016
Messages
39
What I want is a way to return the number of illusions a unit has made, and if this unit is an illusion itself then also return the number of the illusions of the source of this unit.

UnitA has 2 illusions: IllusionA & IllusionB.
IllusionA has 1 Illusion: IllusionA_A.
IllusionB has 2 Illusions: IllusionB_A & IllusionB_B.

CountIllusions(UnitA)= 2+1+2 = 5
CountIllusions(IllusionA)= 1
CountIllusions(IllusionB)= 2
CountIllusions(SourceOf(IllusionA))= 5
CountIllusions(SourceOf(IllusionB))= 5
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
What I want is a way to return the number of illusions a unit has made, and if this unit is an illusion itself then also return the number of the illusions of the source of this unit.
Yeah. That's exactly how I made the included demo spell Phantom Strike. When the hero attacks, there is a chance that it will create summon an illusion. The illusion count is then updated for this hero. The illusions have a chance to summon their own illusions too. If that is the case, then the count is updated for the 'original' source of the illusion.

I see
 
Last edited:
Top