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

Illusions

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Illusions can't cast spell.
Once an Illusion always an Illusion
Cause`, the unit is ILLUSION, EVEN if he can cast spell, the spell would probably an ILLUSION (does nothing)
The thing you can do is create dummy unit at the position of the illusion and execute your "spell" from the dummy unit
Make that illusion plays some animation to make it looks like casting a spell ;D
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Cause`, the unit is ILLUSION, EVEN if he can cast spell, the spell would probably an ILLUSION (does nothing)
Actually illusions can have an effect with spells though it's probably limited to passive abilities.
For example, if the illusion has an ability like 100% Bash, it would give the attacked unit the stunned buff. Alone, that wouldn't do anything since the buff wouldn't have any effect. However, if the unit was previously stunned, then the illusion could prolong the stun duration by refreshing the buff.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Actually illusions can have an effect with spells though it's probably limited to passive abilities.
For example, if the illusion has an ability like 100% Bash, it would give the attacked unit the stunned buff. Alone, that wouldn't do anything since the buff wouldn't have any effect. However, if the unit was previously stunned, then the illusion could prolong the stun duration by refreshing the buff.

Barathrum said:
"...make the Illusion to cast that spell..."

I'm thinking he meant ACTIVE spell since he mentioned CAST word
 
Level 13
Joined
Mar 24, 2010
Messages
950
illusions also have working item slots, maybe do it that way.

If your not dealing with an illusion hero just give it a item slot ability via trigger with 1 slot and the item and make the illusion use it. Or if it wont make it an item thats auto casting. I know if you give phoenix fire to an item the illusions will cast it auto.
 
Level 11
Joined
Sep 12, 2008
Messages
657
actually, if you try picking items with illusions, it fails.
if only 1 hero is able to cast it,
basicly use same hero, get agi/str/int, etc,
and clone the hero, set the RGB of the unit to mirror image(try changing the values)
and see how it can do,
then add the "Clone" the ability.
thats the best thing i can think of;p
 
Level 13
Joined
Mar 24, 2010
Messages
950
If you add that tinting though the other player would know also.

If you can make the items trigger off with triggers then just have it be a real illusion and have a dummy unit do the casting and make the illusion just have the casting graphic done.
 
Level 11
Joined
Sep 12, 2008
Messages
657
hmm.. no, he wont.

JASS:
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit())
   call SetUnitVertexColor(GetTriggerUnit(), 100, 50, 10, 0)
endif

  • Actions
    • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit())
    • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 50.00%, 10.00%) with 0.00% transparency
    • Custom script: endif
 
Level 22
Joined
Feb 3, 2009
Messages
3,292
hmm.. no, he wont.

JASS:
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit())
   call SetUnitVertexColor(GetTriggerUnit(), 100, 50, 10, 0)
endif

  • Actions
    • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit())
    • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 50.00%, 10.00%) with 0.00% transparency
    • Custom script: endif

Indeed, that would work aswell.
 
Level 11
Joined
Sep 12, 2008
Messages
657
well asfar as i can tell, bigged con is not letting it pick items, which could probably be surpassed somehow exept if a unit picks item, drop it, etc.
btw, i can make you a spell that creates the clone if you want, all you gotta do is either implement the dummy.mdx (if you got more then 1 hero using that spell with diffrent model)
or i can make a dummy unit with a permament model that you can change in object editor.
(as a request)
 
Level 11
Joined
Sep 12, 2008
Messages
657
well, ill do it when i get back from school, after another request by chilla_killa.

edit: test it for me, basicly you call it like this:
call Clone.unit(OldUnit, Kill the old unit?, clone the items?, Ability 1 raw id, Ability 2 raw id, Ability 3 raw id, Ability 4 raw id, Ability 5 raw id, Ability 6 raw id returns the copied unit)
this is it. heres the code:

JASS:
library CloneHero
    struct Clone
        // edit is must!
        private static constant integer DUMMY_MDX_RAW_RED = 100  // those are the colors
        private static constant integer DUMMY_MDX_RAW_GREEN = 50 // of the new unit
        private static constant integer DUMMY_MDX_RAW_BLUE = 10 // last created.
        private static constant integer DUMMY_MDX_RAW_ALPHA = 0 // alpha = invisibility if you dont know.
        //-------------Dont touch below!
        private static integer array CLONE_ITEMS
        private static unit CLONE_NEW = null
        private static integer array CLONE_ITEMCHARGES
        private static integer array ABILITY_LEVEL
        private static integer array CLONE_STATS
        private static real array CLONE_STATSREAL
        private static player CLONE_OWNER
        private static item TempItem = null
        
        private static integer m =0
        private static integer c =0
        
        static method Unit takes unit CLONE_OLD, boolean KILLOLD, boolean CLONEITEMS, string model, integer ABILITY1, integer ABILITY2, integer ABILITY3, integer ABILITY4, integer ABILITY5, integer ABILITY6 returns unit
            if CLONEITEMS then
                set c = 0
                set m = UnitInventoryCount(CLONE_OLD)
                    loop
                    set c = c + 1
                        set CLONE_ITEMS[c] = GetItemTypeId(UnitItemInSlot(CLONE_OLD, c))
                        set CLONE_ITEMCHARGES[c] = GetItemCharges(UnitItemInSlot(CLONE_OLD, c))
                    exitwhen c == m
                    endloop
            endif
                set ABILITY_LEVEL[1] = GetUnitAbilityLevel(CLONE_OLD, ABILITY1)
                set ABILITY_LEVEL[2] = GetUnitAbilityLevel(CLONE_OLD, ABILITY2)
                set ABILITY_LEVEL[3] = GetUnitAbilityLevel(CLONE_OLD, ABILITY3)
                set ABILITY_LEVEL[4] = GetUnitAbilityLevel(CLONE_OLD, ABILITY4)
                set ABILITY_LEVEL[5] = GetUnitAbilityLevel(CLONE_OLD, ABILITY5)
                set ABILITY_LEVEL[6] = GetUnitAbilityLevel(CLONE_OLD, ABILITY6)
                    
                    set CLONE_STATS[1] = GetHeroStr(CLONE_OLD, false)
                    set CLONE_STATS[2] = GetHeroAgi(CLONE_OLD, false)
                    set CLONE_STATS[3] = GetHeroInt(CLONE_OLD, false)
                    set CLONE_STATS[4] = GetHeroXP(CLONE_OLD)
                    set CLONE_STATSREAL[1] = GetWidgetLife(CLONE_OLD)
                    set CLONE_STATSREAL[2] = GetUnitState(CLONE_OLD, UNIT_STATE_MANA)
                    set CLONE_STATSREAL[3] = GetUnitX(CLONE_OLD)
                    set CLONE_STATSREAL[4] = GetUnitY(CLONE_OLD)
                    set CLONE_STATSREAL[5] = GetUnitFacing(CLONE_OLD)
                    set CLONE_STATSREAL[6] = GetUnitFlyHeight(CLONE_OLD)
                    set CLONE_OWNER = GetOwningPlayer(CLONE_OLD)
                    if KILLOLD then
                        if IsUnitHidden(CLONE_OLD) then
                            // i donno why, but it is sayd to bug if killing a hidden unit.. so donno
                            call KillUnit(CLONE_OLD)
                        endif
                            call RemoveUnit(CLONE_OLD)
                    endif
                    
                            set CLONE_NEW = CreateUnit(CLONE_OWNER, GetUnitTypeId(CLONE_OLD), CLONE_STATSREAL[3], CLONE_STATSREAL[4], CLONE_STATSREAL[5])
                            call SetUnitFlyHeight(CLONE_NEW, CLONE_STATSREAL[6], 0)
                            call SetWidgetLife(CLONE_NEW, CLONE_STATSREAL[1])
                            call SetUnitState(CLONE_NEW, UNIT_STATE_MANA, CLONE_STATSREAL[2])
                            call SetHeroStr(CLONE_NEW, CLONE_STATS[1], true)
                            call SetHeroAgi(CLONE_NEW, CLONE_STATS[2], true)
                            call SetHeroInt(CLONE_NEW, CLONE_STATS[3], true)
                            call SetHeroXP(CLONE_NEW, CLONE_STATS[4], false)
                                //! textmacro ability takes number
                                if ABILITY$number$ != 0 then
                                    call UnitAddAbility(CLONE_NEW, ABILITY$number$)
                                    call SetUnitAbilityLevel(CLONE_NEW, ABILITY$number$, ABILITY_LEVEL[$number$])
                                endif
                                //! endtextmacro
                                
                                //! runtextmacro ability("1")
                                //! runtextmacro ability("2")
                                //! runtextmacro ability("3")
                                //! runtextmacro ability("4")
                                //! runtextmacro ability("5")
                                //! runtextmacro ability("6")
                                
                                call SetUnitVertexColor(CLONE_NEW, DUMMY_MDX_RAW_RED, DUMMY_MDX_RAW_GREEN, DUMMY_MDX_RAW_BLUE, DUMMY_MDX_RAW_ALPHA)
                                    loop
                                    set c = c - 1
                                        set TempItem = UnitAddItemById(CLONE_NEW, CLONE_ITEMS[c])
                                        call SetItemCharges(TempItem, CLONE_ITEMCHARGES[c])
                                    exitwhen c == 0
                                    endloop
            return CLONE_NEW
        endmethod
    endstruct
endlibrary
 
Last edited:
Level 11
Joined
Sep 12, 2008
Messages
657
ohh.. heres the code:

JASS:
library CloneHero
    struct Clone
        // edit is must!
        private static constant integer DUMMY_MDX_RAW_RED = 100  // those are the colors
        private static constant integer DUMMY_MDX_RAW_GREEN = 50 // of the new unit
        private static constant integer DUMMY_MDX_RAW_BLUE = 10 // last created.
        private static constant integer DUMMY_MDX_RAW_ALPHA = 0 // alpha = invisibility if you dont know.
        //-------------Dont touch below!
        private static integer array CLONE_ITEMS
        private static unit CLONE_NEW = null
        private static integer array CLONE_ITEMCHARGES
        private static integer array ABILITY_LEVEL
        private static integer array CLONE_STATS
        private static real array CLONE_STATSREAL
        private static player CLONE_OWNER
        private static item TempItem = null
        
        private static integer m =0
        private static integer c =0
        
        static method Unit takes unit CLONE_OLD, boolean KILLOLD, boolean CLONEITEMS, integer ABILITY1, integer ABILITY2, integer ABILITY3, integer ABILITY4, integer ABILITY5, integer ABILITY6 returns unit
            if CLONEITEMS then
                set c = 0
                set m = UnitInventoryCount(CLONE_OLD)
                    loop
                    set c = c + 1
                        set CLONE_ITEMS[c] = GetItemTypeId(UnitItemInSlot(CLONE_OLD, c))
                        set CLONE_ITEMCHARGES[c] = GetItemCharges(UnitItemInSlot(CLONE_OLD, c))
                    exitwhen c == m
                    endloop
            endif
                set ABILITY_LEVEL[1] = GetUnitAbilityLevel(CLONE_OLD, ABILITY1)
                set ABILITY_LEVEL[2] = GetUnitAbilityLevel(CLONE_OLD, ABILITY2)
                set ABILITY_LEVEL[3] = GetUnitAbilityLevel(CLONE_OLD, ABILITY3)
                set ABILITY_LEVEL[4] = GetUnitAbilityLevel(CLONE_OLD, ABILITY4)
                set ABILITY_LEVEL[5] = GetUnitAbilityLevel(CLONE_OLD, ABILITY5)
                set ABILITY_LEVEL[6] = GetUnitAbilityLevel(CLONE_OLD, ABILITY6)
                    
                    set CLONE_STATS[1] = GetHeroStr(CLONE_OLD, false)
                    set CLONE_STATS[2] = GetHeroAgi(CLONE_OLD, false)
                    set CLONE_STATS[3] = GetHeroInt(CLONE_OLD, false)
                    set CLONE_STATS[4] = GetHeroXP(CLONE_OLD)
                    set CLONE_STATSREAL[1] = GetWidgetLife(CLONE_OLD)
                    set CLONE_STATSREAL[2] = GetUnitState(CLONE_OLD, UNIT_STATE_MANA)
                    set CLONE_STATSREAL[3] = GetUnitX(CLONE_OLD)
                    set CLONE_STATSREAL[4] = GetUnitY(CLONE_OLD)
                    set CLONE_STATSREAL[5] = GetUnitFacing(CLONE_OLD)
                    set CLONE_STATSREAL[6] = GetUnitFlyHeight(CLONE_OLD)
                    set CLONE_OWNER = GetOwningPlayer(CLONE_OLD)
                    if KILLOLD then
                        if IsUnitHidden(CLONE_OLD) then
                            // i donno why, but it is sayd to bug if killing a hidden unit.. so donno
                            call KillUnit(CLONE_OLD)
                        endif
                            call RemoveUnit(CLONE_OLD)
                    endif
                    
                            set CLONE_NEW = CreateUnit(CLONE_OWNER, GetUnitTypeId(CLONE_OLD), CLONE_STATSREAL[3], CLONE_STATSREAL[4], CLONE_STATSREAL[5])
                            call SetUnitFlyHeight(CLONE_NEW, CLONE_STATSREAL[6], 0)
                            call SetWidgetLife(CLONE_NEW, CLONE_STATSREAL[1])
                            call SetUnitState(CLONE_NEW, UNIT_STATE_MANA, CLONE_STATSREAL[2])
                            call SetHeroStr(CLONE_NEW, CLONE_STATS[1], true)
                            call SetHeroAgi(CLONE_NEW, CLONE_STATS[2], true)
                            call SetHeroInt(CLONE_NEW, CLONE_STATS[3], true)
                            call SetHeroXP(CLONE_NEW, CLONE_STATS[4], false)
                                //! textmacro ability takes number
                                if ABILITY$number$ != 0 then
                                    call UnitAddAbility(CLONE_NEW, ABILITY$number$)
                                    call SetUnitAbilityLevel(CLONE_NEW, ABILITY$number$, ABILITY_LEVEL[$number$])
                                endif
                                //! endtextmacro
                                
                                //! runtextmacro ability("1")
                                //! runtextmacro ability("2")
                                //! runtextmacro ability("3")
                                //! runtextmacro ability("4")
                                //! runtextmacro ability("5")
                                //! runtextmacro ability("6")
                                if GetLocalPlayer() == GetOwningPlayer(CLONE_NEW) then
                                    call SetUnitVertexColor(CLONE_NEW, DUMMY_MDX_RAW_RED, DUMMY_MDX_RAW_GREEN, DUMMY_MDX_RAW_BLUE, DUMMY_MDX_RAW_ALPHA)
                                endif
                                    
                                    loop
                                    set c = c - 1
                                        set TempItem = UnitAddItemById(CLONE_NEW, CLONE_ITEMS[c])
                                        call SetItemCharges(TempItem, CLONE_ITEMCHARGES[c])
                                    exitwhen c == 0
                                    endloop
            return CLONE_NEW
        endmethod
    endstruct
endlibrary

just figured how GetLocalPlayer() must be equal to a player, or it wont work,
so only the owner of the illusion sees its a illusion, sorry :D

edit: if you want, i can make it make sure the hero name is 100% same as the old hero, so no 1 can even tell the slighest diffrence.

edit2: oh yeah, i can make it show for allies only, if you know exact players. (player 1, 2, 5, 7), and so on.
 
Last edited:
Level 22
Joined
Feb 3, 2009
Messages
3,292
ohh.. heres the code:

JASS:
library CloneHero
    struct Clone
        // edit is must!
        private static constant integer DUMMY_MDX_RAW_RED = 100  // those are the colors
        private static constant integer DUMMY_MDX_RAW_GREEN = 50 // of the new unit
        private static constant integer DUMMY_MDX_RAW_BLUE = 10 // last created.
        private static constant integer DUMMY_MDX_RAW_ALPHA = 0 // alpha = invisibility if you dont know.
        //-------------Dont touch below!
        private static integer array CLONE_ITEMS
        private static unit CLONE_NEW = null
        private static integer array CLONE_ITEMCHARGES
        private static integer array ABILITY_LEVEL
        private static integer array CLONE_STATS
        private static real array CLONE_STATSREAL
        private static player CLONE_OWNER
        private static item TempItem = null
        
        private static integer m =0
        private static integer c =0
        
        static method Unit takes unit CLONE_OLD, boolean KILLOLD, boolean CLONEITEMS, integer ABILITY1, integer ABILITY2, integer ABILITY3, integer ABILITY4, integer ABILITY5, integer ABILITY6 returns unit
            if CLONEITEMS then
                set c = 0
                set m = UnitInventoryCount(CLONE_OLD)
                    loop
                    set c = c + 1
                        set CLONE_ITEMS[c] = GetItemTypeId(UnitItemInSlot(CLONE_OLD, c))
                        set CLONE_ITEMCHARGES[c] = GetItemCharges(UnitItemInSlot(CLONE_OLD, c))
                    exitwhen c == m
                    endloop
            endif
                set ABILITY_LEVEL[1] = GetUnitAbilityLevel(CLONE_OLD, ABILITY1)
                set ABILITY_LEVEL[2] = GetUnitAbilityLevel(CLONE_OLD, ABILITY2)
                set ABILITY_LEVEL[3] = GetUnitAbilityLevel(CLONE_OLD, ABILITY3)
                set ABILITY_LEVEL[4] = GetUnitAbilityLevel(CLONE_OLD, ABILITY4)
                set ABILITY_LEVEL[5] = GetUnitAbilityLevel(CLONE_OLD, ABILITY5)
                set ABILITY_LEVEL[6] = GetUnitAbilityLevel(CLONE_OLD, ABILITY6)
                    
                    set CLONE_STATS[1] = GetHeroStr(CLONE_OLD, false)
                    set CLONE_STATS[2] = GetHeroAgi(CLONE_OLD, false)
                    set CLONE_STATS[3] = GetHeroInt(CLONE_OLD, false)
                    set CLONE_STATS[4] = GetHeroXP(CLONE_OLD)
                    set CLONE_STATSREAL[1] = GetWidgetLife(CLONE_OLD)
                    set CLONE_STATSREAL[2] = GetUnitState(CLONE_OLD, UNIT_STATE_MANA)
                    set CLONE_STATSREAL[3] = GetUnitX(CLONE_OLD)
                    set CLONE_STATSREAL[4] = GetUnitY(CLONE_OLD)
                    set CLONE_STATSREAL[5] = GetUnitFacing(CLONE_OLD)
                    set CLONE_STATSREAL[6] = GetUnitFlyHeight(CLONE_OLD)
                    set CLONE_OWNER = GetOwningPlayer(CLONE_OLD)
                    if KILLOLD then
                        if IsUnitHidden(CLONE_OLD) then
                            // i donno why, but it is sayd to bug if killing a hidden unit.. so donno
                            call KillUnit(CLONE_OLD)
                        endif
                            call RemoveUnit(CLONE_OLD)
                    endif
                    
                            set CLONE_NEW = CreateUnit(CLONE_OWNER, GetUnitTypeId(CLONE_OLD), CLONE_STATSREAL[3], CLONE_STATSREAL[4], CLONE_STATSREAL[5])
                            call SetUnitFlyHeight(CLONE_NEW, CLONE_STATSREAL[6], 0)
                            call SetWidgetLife(CLONE_NEW, CLONE_STATSREAL[1])
                            call SetUnitState(CLONE_NEW, UNIT_STATE_MANA, CLONE_STATSREAL[2])
                            call SetHeroStr(CLONE_NEW, CLONE_STATS[1], true)
                            call SetHeroAgi(CLONE_NEW, CLONE_STATS[2], true)
                            call SetHeroInt(CLONE_NEW, CLONE_STATS[3], true)
                            call SetHeroXP(CLONE_NEW, CLONE_STATS[4], false)
                                //! textmacro ability takes number
                                if ABILITY$number$ != 0 then
                                    call UnitAddAbility(CLONE_NEW, ABILITY$number$)
                                    call SetUnitAbilityLevel(CLONE_NEW, ABILITY$number$, ABILITY_LEVEL[$number$])
                                endif
                                //! endtextmacro
                                
                                //! runtextmacro ability("1")
                                //! runtextmacro ability("2")
                                //! runtextmacro ability("3")
                                //! runtextmacro ability("4")
                                //! runtextmacro ability("5")
                                //! runtextmacro ability("6")
                                if GetLocalPlayer() == GetOwningPlayer(CLONE_NEW) then
                                    call SetUnitVertexColor(CLONE_NEW, DUMMY_MDX_RAW_RED, DUMMY_MDX_RAW_GREEN, DUMMY_MDX_RAW_BLUE, DUMMY_MDX_RAW_ALPHA)
                                endif
                                    
                                    loop
                                    set c = c - 1
                                        set TempItem = UnitAddItemById(CLONE_NEW, CLONE_ITEMS[c])
                                        call SetItemCharges(TempItem, CLONE_ITEMCHARGES[c])
                                    exitwhen c == 0
                                    endloop
            return CLONE_NEW
        endmethod
    endstruct
endlibrary
just figured how GetLocalPlayer() must be equal to a player, or it wont work,
so only the owner of the illusion sees its a illusion, sorry :D

edit: if you want, i can make it make sure the hero name is 100% same as the old hero, so no 1 can even tell the slighest diffrence.

edit2: oh yeah, i can make it show for allies only, if you know exact players. (player 1, 2, 5, 7), and so on.

This is very good, but I'm afraid I need a little extra on it if possible:

1. Can you make it so I can specify it's living time (how long it will live)?
2. Can you make it so it would actually deal less damage as the original (in % as the original Mirror Image) (ONLY IF POSSIBLE, the 1st one is important)
 
Level 11
Joined
Sep 12, 2008
Messages
657
hmm, i can do that, if you let me use BonusMod, which will add ALOT of abilities
and it will take me some time, you can do the how long it will live like this:
  • Custom script: set udg_YourUnitVariable = call Clone.Unit(GetTriggerUnit(), false, true, 'blah', 'blah', 'blah', 'blah', ''blah', 'blah')
  • Unit - Add a AmountOfTime second Generic expiration timer to YourUnitVariable
thats quite easy, about second part.. as i sayd above, will take time.
 
Status
Not open for further replies.
Top