• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Reverse Vizibility

Status
Not open for further replies.
Level 9
Joined
Jan 23, 2008
Messages
384
Hi !
I tried all my best on this one but i failed every time, what i wan to do is to make a unit that my enemy will see it with 0% transparency (a.k.a.: normally) and i should see it with 50% transparency (a.k.a.: ghost like) does anyone know how should i do this ? The owner of the unit doesn't concern me ... the unit can be owned by me or my enemy or every other player ...
Ty ! for your time ... +rep to the one helping me !
 
Level 17
Joined
Jun 28, 2008
Messages
776
Use GetLocalPlayer()
JASS:
...
if GetLocalPlayer() == Player(0) then
    call SetUnitVertexColor(YOUR_UNIT, 255, 255, 255, 50)
endif
...
That should work.

That should indeed work. But to put more simply :

Say for instance you want the hero to become transparent when he learns an
ability.

JASS:
function Trig_Set_on_Abt_Conditions takes nothing returns boolean
    if ( not ( GetLearnedSkillBJ() == 'Your Ability ID' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Set_on_Abt_Actions takes nothing returns nothing
    set udg_Unit_Transperant = GetLearningUnit()
    set udg_Player_Number =  GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))
    call SetUnitVertexColorBJ( udg_Unit_Transperant, 100, 100, 100, 100.00 )
    if GetLocalPlayer() == Player(0) then
    call SetUnitVertexColor( udg_Unit_Transperant, 255, 255, 255, 50 )
endif
endfunction

//===========================================================================
function InitTrig_Set_on_Abt takes nothing returns nothing
    set gg_trg_Set_on_Abt = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Set_on_Abt, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_Set_on_Abt, Condition( function Trig_Set_on_Abt_Conditions ) )
    call TriggerAddAction( gg_trg_Set_on_Abt, function Trig_Set_on_Abt_Actions )
endfunction

if you are new to jass just create a new trigger, go to edit and click on the convert to custom text. *Note - If converted it cannot be changed back *

You can create a variable named Unit_Transperant or change the Unit_Transperant varible. Now set the Ability ID to the ability you learned.
The Player_Number is a integer variable that tells which player learned the ability.

I an just a beginner with JASS so there might be a error, but I doubt it coz I tested it before posting.

Hope it helps.
 
Level 9
Joined
Jan 23, 2008
Messages
384
oook ... i know a little jass but i have no idea how to import a jass script ... tell me like you're telling a mega noob ... lets say that my trigger is this one ...

  • My Spell
    • Events
      • Unit - A unit begins casting an ability
    • Conditions
      • (Ability being cast) is equal to Thunder Clap
    • Actions
      • Unit - Create 1 Footman at position of ... bla, bla ...
I do not know if its all ok cuz i wright it by hand ... what sell i do next ? pls tell me like a llame noob ... Ty for your replies ... +rep
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
oook ... i know a little jass but i have no idea how to import a jass script ... tell me like you're telling a mega noob ... lets say that my trigger is this one ...

  • My Spell
    • Events
      • Unit - A unit begins casting an ability
    • Conditions
      • (Ability being cast) is equal to Thunder Clap
    • Actions
      • Unit - Create 1 Footman at position of ... bla, bla ...
I do not know if its all ok cuz i wright it by hand ... what sell i do next ? pls tell me like a llame noob ... Ty for your replies ... +rep

  • My Spell
    • Events
      • Unit - A unit begins casting an ability
    • Conditions
      • (Ability being cast) is equal to Thunder Clap
    • Actions
      • Unit - Create 1 Footman at position of ... bla, bla ...
      • Set Unit = Last Created Unit
      • Custom script: if GetLocalPlayer() == Player(0) then
      • Custom script: call SetUnitVertexColor(udg_Unit, 255, 255, 255, 50)
      • Custom script: endif
 
Status
Not open for further replies.
Top