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

Hiding Doodad

Status
Not open for further replies.
Level 13
Joined
Sep 29, 2008
Messages
671
does anyone know how to hide a doodad? I seen this on Jass and I
don't know if there is in GUI. if anyone know how and can show me
pls do tell.

Note: I want to hide a "doodad" not "destructible"
destructible triggers in GUI don't work on doodads. but if I missed

something do tell me. xD

+rep for those who help.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
I am not sure if that's even possible. What you can do however is change animations of doodads inside a region. Doodads that have no death animation will simply disappear if you order them to play dead animation (If I remember right). You can search for doodads in actions in GUI I'm sure you will find it.
 
Last edited:
Level 13
Joined
Sep 29, 2008
Messages
671
no there is no doodad action in GUI only destructible, but I seen this already in Jass, this is the one I saw, works on the main map but when I import it on my map it gives errors

JASS:
// ************************************
// * RoofControl module by Shadow1500 *
// ************************************

// CONFIG
constant function Roof_GetFloorDestructables takes nothing returns string
    return "B003;B004;B005;B006;B007"
endfunction
constant function Roof_GetRoofDoodads takes nothing returns string
    return "D00A;D00B;D00C;D00N;D00Q;D00P;D00R;D00O"
endfunction
constant function Roof_GetRoofWindowDoodads takes nothing returns string
    return "D00A;D00B;D00C"
endfunction
constant function Roof_GetFloorWidth takes integer floorId returns real
    return 64.0
endfunction
constant function Roof_GetFloorHeight takes integer floorId returns real
    return 64.0
endfunction
function Roof_RoofVisibleAnim takes integer roofId returns string
    local real time = GetFloatGameState(GAME_STATE_TIME_OF_DAY)
    if (not IsItemInPool(bj_forLoopAIndex,roofId)) or (time>=6 and time<=18) then
        return "Stand"
    endif
    return "Stand Alternate"
endfunction
constant function Roof_RoofHiddenAnim takes integer roofId returns string
    return "Death"
endfunction

// FUNCS
function I2Region takes integer i returns region
    return i
    return null
endfunction
function I2Destructable takes integer i returns destructable
    return i
    return null
endfunction
function InitBuildingsRegionFilter takes nothing returns boolean
    return IsItemInPool(bj_forLoopAIndex,GetDestructableTypeId(GetFilterDestructable()))
endfunction
function InitBuildingsRegionEnum takes nothing returns nothing
    local destructable d = GetEnumDestructable()
    local integer id = GetDestructableTypeId(d)
    local real w = Roof_GetFloorWidth(id)
    local real h = Roof_GetFloorHeight(id)
    local real x = GetWidgetX(d)
    local real y = GetWidgetY(d)
    local rect r = Rect(x-w,y-h,x+w,y+h)
    
    call RegionAddRect(I2Region(bj_forLoopBIndex),r)
    call RemoveRect(r)
    
    set r = null
    set d = null
endfunction
function HideRoofs takes player p, boolean flag returns nothing
    local integer roofPool = GetStoredInteger(CSCache(),"RoofControl","RoofObjects")
    local integer x = 0
    local integer len = CountItemsInPool(roofPool)
    local integer id
    call StoreBoolean(CSCache(),"RoofControl","isHidden_"+I2S(GetPlayerId(p)),flag)
    set bj_forLoopAIndex = GetStoredInteger(CSCache(),"RoofControl","RoofWindows")
    loop
        exitwhen x>len
        set id = PoolGetItem(roofPool,x)
        if GetLocalPlayer()==p then
            if flag then
                call SetDoodadAnimationRect(bj_mapInitialPlayableArea,id,Roof_RoofHiddenAnim(id),false)
            else
                call SetDoodadAnimationRect(bj_mapInitialPlayableArea,id,Roof_RoofVisibleAnim(id),false)
            endif
        endif
        set x = x + 1
    endloop
endfunction
function Trig_RoofControl_Actions takes nothing returns nothing
    call HideRoofs(GetOwningPlayer(GetTriggerUnit()),GetTriggerEventId()==EVENT_GAME_ENTER_REGION)
endfunction
function InitTrig_RoofControl takes nothing returns nothing
    local region buildings = CreateRegion()
    local boolexpr filter = Condition(function InitBuildingsRegionFilter)
    set gg_trg_RoofControl = CreateTrigger()
 
    set bj_forLoopAIndex = Rawcodes2Pool(Roof_GetFloorDestructables())
    set bj_forLoopBIndex = CS_H2I(buildings)
    call EnumDestructablesInRect(bj_mapInitialPlayableArea,filter,function InitBuildingsRegionEnum)
    call DestroyBoolExpr(filter)
    set filter = null

    call TriggerRegisterEnterRegion(gg_trg_RoofControl,buildings,null)
    call TriggerRegisterLeaveRegion(gg_trg_RoofControl,buildings,null)
    call TriggerAddAction(gg_trg_RoofControl,function Trig_RoofControl_Actions)

    call StoreInteger(CSCache(),"RoofControl","RoofWindows",Rawcodes2Pool(Roof_GetRoofWindowDoodads()))
    call StoreInteger(CSCache(),"RoofControl","RoofObjects",Rawcodes2Pool(Roof_GetRoofDoodads()))
    call HideRoofs(Player(0),true)
endfunction

But it says to this line: "Expected a name"
JASS:
    if (not IsItemInPool(bj_forLoopAIndex,roofId)) or (time>=6 and time<=18) then

I imported all the variables from the main map but it still don't work. Does anyone know how to fix it or a better way? I don't understand much on those Jass... xD
 
Status
Not open for further replies.
Top