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

Does anyone know how to change the colour of illusions?

Status
Not open for further replies.
Level 2
Joined
Nov 8, 2022
Messages
6
What I tried:

1,create a illusion and change the colour, faild.
2,create illusion and change the colour of local player,faild.
1,create a illusion for Player12(enemy of all players) and change the illusion 's owner to the spelling hero,faild.

Is it possible to change the colour of illusions?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
I tested this trigger and Vertex Coloring doesn't work with Illusions:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is an illusion) Equal to True
            • Then - Actions
              • Animation - Change (Picked unit)'s vertex coloring to ((Random percentage)%, (Random percentage)%, (Random percentage)%) with 0.00% transparency
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
You can change the illusion's Player Color though but it will only affect their Hero Glow and possibly Team Coloring:
  • Unit - Change color of (Picked unit) to (Color of (Player((Random integer number between 1 and 24))))
So as far as I know, no, you cannot change their color, but there may be a trick out there if you search around the forums.
 
Level 2
Joined
Nov 8, 2022
Messages
6
I tested this trigger and Vertex Coloring doesn't work with Illusions:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is an illusion) Equal to True
            • Then - Actions
              • Animation - Change (Picked unit)'s vertex coloring to ((Random percentage)%, (Random percentage)%, (Random percentage)%) with 0.00% transparency
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
You can change the illusion's Player Color though but it will only affect their Hero Glow and possibly Team Coloring:
  • Unit - Change color of (Picked unit) to (Color of (Player((Random integer number between 1 and 24))))
So as far as I know, no, you cannot change their color, but there may be a trick out there if you search around the forums.
Thank you.I found a way and have tested just now.
 
Level 2
Joined
Nov 8, 2022
Messages
6
function GetHeroIllusionId takes integer UnitTypeId returns integer
if UnitTypeId=='Hro0' then//0
return 'Oro0'
elseif UnitTypeId=='Hro1' then//1
return 'Oro1'
elseif UnitTypeId=='Hro2' then//2
return 'Oro2'
elseif UnitTypeId=='Hro3' then//3
return 'Oro3'
elseif UnitTypeId=='Hro4' then//4
return 'Oro4'
elseif UnitTypeId=='Hro5' then//5
return 'Oro5'
elseif UnitTypeId=='Hro6' then//6
return 'Oro6'
elseif UnitTypeId=='Hro7' then//7
return 'Oro7'
elseif UnitTypeId=='Hro8' then//8
return 'Oro8'
elseif UnitTypeId=='Hro9' then//9
return 'Oro9'
elseif UnitTypeId=='Ero2' then//10
return 'Uro2'
elseif UnitTypeId=='Er51' then//11
return 'Ur51'
elseif UnitTypeId=='Er52' then//12
return 'Ur52'
elseif UnitTypeId=='Er53' then//13
return 'Ur53'
elseif UnitTypeId=='Ero9' then//14
return 'Uro9'
endif
return 0
endfunction
function Item_Copy_AtoB_Illusion takes unit ua,unit u_Target returns nothing
local integer i = 0
local item it_Origin = null
local item it_Target = null
local integer it_Origin_Type = 0
local integer it_Origin_Charges = 0
loop
exitwhen i > 5
set it_Origin = UnitItemInSlot(ua,i)//源头单位此格物品
set it_Origin_Type = GetItemTypeId(it_Origin)//源头单位此格物品类型
set it_Origin_Charges = GetItemCharges(it_Origin)//源头此格物品次数
set it_Target = UnitItemInSlot(u_Target,i)//目标此格物品
call RemoveItem(it_Target)//目标此格物品清空
call UnitAddItemToSlotById(u_Target,it_Origin_Type,i)
set it_Target = UnitItemInSlot(u_Target,i)//目标此格物品
call SetItemCharges(it_Target,it_Origin_Charges)
call SetItemDropOnDeath(it_Target,false)
set i = i + 1
endloop
set it_Origin = null
set it_Target = null
endfunction

function CreateIllusion_Hero takes player p,unit ut,real x,real y,real f returns unit
//1,等级和经验
local integer Lv=GetHeroLevel(ut)
local integer XP=GetHeroXP(ut)
//2属性
local integer Str=GetHeroStr(ut,false)
local integer Agi=GetHeroAgi(ut,false)
local integer Int=GetHeroInt(ut,false)
//3血蓝量
local real Life=GetUnitState(ut,UNIT_STATE_LIFE)
local real Mana=GetUnitState(ut,UNIT_STATE_MANA)
local integer UnitTypeId=GetHeroIllusionId(GetUnitTypeId(ut))
local unit Illusion=CreateUnit(p,UnitTypeId,x,y,f)
//1等级和经验
call SetHeroXP(Illusion,XP,false)
//2属性
call SetHeroStr(Illusion,Int,false)
call SetHeroAgi(Illusion,Agi,false)
call SetHeroInt(Illusion,Str,false)
//3血蓝量
call SetUnitState(Illusion,UNIT_STATE_LIFE,Life)//11
call SetUnitState(Illusion,UNIT_STATE_MANA,Mana)//12
//4
call SuspendHeroXP(Illusion,true)//暂停经验获取
call SetUnitUseFood(Illusion,false)//禁止人口占用
call UnitAddAbility(Illusion,'Silu')
call UnitMakeAbilityPermanent(Illusion,true,'Silu')
call Item_Copy_AtoB_Illusion(ut,Illusion)
call SetUnitAbilityLevel(Illusion,'Aien',2)//-----Here is the POINT,MUST set the itemslot(ability) has two level, Level 1 is allowed to get item and Level 2 is not.
set UnitForReturn=Illusion
set Illusion=null
return UnitForReturn
endfunction

function CreateIllusion_Unit takes player p,unit ut,real x,real y,real f returns unit
//1血蓝量
local real Life=GetUnitState(ut,UNIT_STATE_LIFE)
local real Mana=GetUnitState(ut,UNIT_STATE_MANA)
local integer UnitTypeId=GetUnitTypeId(ut)
local unit Illusion=CreateUnit(p,UnitTypeId,x,y,f)
//3血蓝量
call SetUnitState(Illusion,UNIT_STATE_LIFE,Life)//11
call SetUnitState(Illusion,UNIT_STATE_MANA,Mana)//12
//4
call SetUnitUseFood(Illusion,false)//禁止人口占用
call UnitAddAbility(Illusion,'Silu')
call UnitMakeAbilityPermanent(Illusion,true,'Silu')
set UnitForReturn=Illusion
set Illusion=null
return UnitForReturn
endfunction

function CreateIllusion takes player p,unit ut,real x,real y,real f returns unit
if IsUnitType(ut,UNIT_TYPE_HERO)==true then
return CreateIllusion_Hero(p,ut,x,y,f)
endif
return CreateIllusion_Unit(p,ut,x,y,f)
endfunction

function IllusionDeath takes unit Illusion returns nothing
call DeleteUnitsItemAll(Illusion)
call RemoveUnit(Illusion)
endfunction
 
Level 2
Joined
Nov 8, 2022
Messages
6
Why do you want to do this? Seems like a lot of work for something that only the player who created the illusions can ever see.
I made some spells like:separate target's soul and body,and damage the body according to the distance between soul and body.A transparent illusions is the soul here
 
Last edited by a moderator:
Status
Not open for further replies.
Top