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

[JASS] Framework Kit by xXm0rpH3usXx

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Happy is refering to the 4 letter reference ID of a object (anything from object editor).

It always looks like
JASS:
'A000'
Although the letters can change.

This will give you an integer (which you could use in the first place) but is more efficent. Make sure you you refference existing objects and the correct ones or else it may cause major errors if not crashes.

How do I get this "number"?
Go to options (in the object editor) and you will find an option called "Display raw data" or something similar. You will then find the number next to the object's name in the object editor.​
 
Just to help everyone, here are the triggers:
JASS:
// ************************************
// * RoofControl module by Shadow1500 *
// ************************************

// CONFIG
constant function Roof_GetFloorDestructables takes nothing returns string
    return [B]"B003;B004;B005;B006;B007"[/B]
endfunction
constant function Roof_GetRoofDoodads takes nothing returns string
    return [B]"D00A;D00B;D00C;D00N;D00Q;D00P;D00R;D00O"[/B]
endfunction
constant function Roof_GetRoofWindowDoodads takes nothing returns string
    return [B]"D00A;D00B;D00C"[/B]
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

I don't see anything (right now from skimming) in the functions that would unallow the roofs to disappear other than the raw codes. The raw codes are bolded. Make sure that it matches the raw codes, otherwise, I don't think it will work. To view raw codes, I think you do something like this:
- Open the object editor then go to "View | Display Values as Raw Data"... Then look at the four letter code and fill in the blanks.

I hope this helps! :emote_grin:
 
Level 9
Joined
Jul 27, 2006
Messages
652
CSCache

The CSCache system is part of the Caster System (thats what the CS means).
If you havnt imported it properly then the framework system cannot store data, and the syntax cheacker cant find the correct function.
Solution : Reimport the Cache System and make sure you have the variables too.
 
Status
Not open for further replies.
Top