HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Quick Questions

04-11-2007, 12:33 AM#1
Joker
does
Collapse JASS:
IsUnitHidden( unit )
refer to
Collapse JASS:
ShowUnit( unit, boolean )
?
04-11-2007, 12:49 AM#2
RaveEye
The first one you can use to check if the unit is hidden.
ex
Collapse JASS:
local boolean isunithidden = IsUnitHidden() // It will return true or false

the other one can you use to hide and unhide a unit.
ex
Collapse JASS:
local unit u = ShowUnit(u,true) // True will hide the unit, and False will unhide.
04-11-2007, 12:59 AM#3
Joker
A bit extra info there..but thx
04-11-2007, 01:04 AM#4
akolyt0r
Collapse JASS:
local boolean isunithidden = IsUnitHidden() // It will return true or false

u missed the argument ..but i think thats clear ^^
04-11-2007, 01:24 AM#5
Joker
Ok, jacking my own thread.

why does this not work? maybe its contradicting with the rest of my trigger, b/c it hides the unit when it touches the ice, instead of giving it the slide effect.
Collapse JASS:
    if GetTerrainType( ex, ey ) == 'Iice' then
        call SetUnitX( e, ex + 15 * (ef * 0.074532) )
        call SetUnitY( e, ex + 15 * (ef * 0.074532) )
        call SetUnitAnimation( e, "stand" )
    endif

Collapse JASS:
function Trig_Maze_Kill_Effect_Conditions takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true
endfunction

function Trig_Maze_Kill_Effect2_Condition takes nothing returns boolean
    return IsUnitType( GetFilterUnit(), UNIT_TYPE_HERO ) == false and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0.405
endfunction

function Trig_Maze_Kill_Effect takes nothing returns nothing
    local unit e = GetEnumUnit()
    local real ex = GetUnitX(e)
    local real ey = GetUnitY(e)
    local real ef = GetUnitFacing(e)
    local group g = CreateGroup()
    local boolexpr b = Condition( function Trig_Maze_Kill_Effect2_Condition )
    local unit f

    call GroupEnumUnitsInRange( g, ex, ey, 60, b )
    set f = FirstOfGroup(g)
    

    if GetTerrainType( ex, ey ) == 'Agrs' or f != null and IsUnitHidden( e ) == false then
        call ShowUnit( e, false )
        call SetUnitState( e, UNIT_STATE_LIFE, GetUnitState(e,UNIT_STATE_MAX_LIFE) )
        call CreateUnit( Player(9), 'nder',ex, ey, 0 )
        call SetUnitPosition( e, 5090, 4890 )
        set f = null
    endif

    ////////
    //Slip//
    ////////

    if GetTerrainType( ex, ey ) == 'Iice' then
        call SetUnitX( e, ex + 15 * (ef * 0.074532) )
        call SetUnitY( e, ex + 15 * (ef * 0.074532) )
        call SetUnitAnimation( e, "stand" )
    endif
    

    call DestroyGroup(g)
    call DestroyBoolExpr(b)
    set b = null
    set g = null
    set e = null
endfunction    

function Trig_Maze_Kill_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local group r = CreateGroup()
    local boolexpr b = Condition( function Trig_Maze_Kill_Effect_Conditions ) 
    local integer i = 0

    loop
         call GroupClear(g)
         call GroupEnumUnitsOfPlayer(g, Player(i), b )
         call GroupAddGroup( g, r )
         set i = i + 1
         exitwhen i > 8
    endloop

    call ForGroup( r, function Trig_Maze_Kill_Effect )

    call DestroyGroup(g)
    call DestroyGroup(r)
    call DestroyBoolExpr(b)
    set g = null  
    set r = null
    set b = null
endfunction

//===========================================================================
function InitTrig_Maze_Kill takes nothing returns nothing
    set gg_trg_Maze_Kill = CreateTrigger(  )
    call TriggerRegisterTimerEvent( gg_trg_Maze_Kill, 0.1, true )
    call TriggerAddAction( gg_trg_Maze_Kill, function Trig_Maze_Kill_Actions )
endfunction
04-11-2007, 04:07 AM#6
MaD[Lion]
Collapse JASS:
 if GetTerrainType( ex, ey ) == 'Agrs' or f != null and IsUnitHidden( e ) == false then
This will hide the unit when it enters ashenvale grass terrain, and as long as there is a unit in 60 radius range from this unit's position (including itself), and if this unit is visible too.
Your trigger seems to be fine, problem is just it doesnt unhide the unit.
maybe add an action to unhide the unit?