• 🏆 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] UI - Adjusting Frames

Status
Not open for further replies.
Level 20
Joined
Jul 12, 2010
Messages
1,717
Hello everybody, I began trying to create a custom UI for my map and I have stumbled upon a wall quite early in the process.

I moved the Unit Portrait (aka ORIGIN_FRAME_PORTRAIT ) to the top left and I made a border and background to go along with it.

The problem I have is that the 3D model keeps going through the background and it just won't work.

heroport.gif


JASS:
function Trig_GameUI_Init_Actions takes nothing returns nothing

    local framehandle port = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0)

    call BlzHideOriginFrames(true)
    call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))

    call BlzFrameSetVisible(port, true)
    call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME,0), true)

    call BlzFrameClearAllPoints(port)
    call BlzFrameSetAbsPoint(port, FRAMEPOINT_CENTER, 0.155, 0.525)

endfunction

//===========================================================================
function InitTrig_GameUI takes nothing returns nothing
    set gg_trg_GameUI = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_GameUI, 0.10 )
    call TriggerAddAction( gg_trg_GameUI, function Trig_GameUI_Init_Actions )
endfunction
JASS:
function Trig_silver_Actions takes nothing returns nothing

    local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
    local framehandle HeroBorder = BlzCreateFrameByType("BACKDROP", "HeroBorder", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) , "", 0)
    local framehandle port = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0)

    //======Hero Portrait Border=====\\
    call BlzFrameSetSize(HeroBorder , 0.13, 0.13)
    call BlzFrameSetAbsPoint(HeroBorder , FRAMEPOINT_CENTER, 0.074, 0.527)
    call BlzFrameSetTexture(HeroBorder , "UI\\Widgets\\Glues\\SinglePlayerSkirmish-MinimapCover3.blp",0, true)

    //======Hero Portrait Background=====\\
    call BlzFrameSetSize(HeroBackground , 0.13, 0.13)
    call BlzFrameSetAbsPoint(HeroBackground , FRAMEPOINT_CENTER, 0.074, 0.527)
    call BlzFrameSetTexture(HeroBackground , "UI\\Widgets\\EscMenu\\Human\\human-options-button-background-disabled.blp",0, true)

//    call BlzFrameSetAlpha(HeroBackground, 150)


//===== Making "HeroBackground" the Parent of ORIGIN_FRAME_PORTRAIT causes the portrait to move
//===== above the background image but it still passes through when animation is played.

    call BlzFrameSetParent(port, HeroBackground)

//===== FrameSetLevel seems to not work for ORIGIN_FRAME_PORTRAIT
//    call BlzFrameSetLevel(port, 10)


endfunction

//===========================================================================
function InitTrig_Borders takes nothing returns nothing
    set gg_trg_Borders = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Borders, 0.20 )
    call TriggerAddAction( gg_trg_Borders, function Trig_silver_Actions )
endfunction

Feel free to use the test map, any help to resolve this problem is appreciated!
 

Attachments

  • Game UI 005.w3x
    13.3 KB · Views: 48
based on something Hate said:
BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0) is deeper than BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0).
When using the world as parent for the background it should be deeper Layerwise hopefuly below that portait.
local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)

Other option could be to increase the FrameLevel of the portait's parent using BlzFrameSetLevel.
call BlzFrameSetLevel(BlzFrameGetParent(port), 5)
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
@Tasyen
JASS:
local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)
wow dude that actually helped thanks!

also:
JASS:
//===== FrameSetLevel seems to not work for ORIGIN_FRAME_PORTRAIT
//    call BlzFrameSetLevel(port, 10)
I already tried changing the level but it didn't work so I just disabled it.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
@Tasyen ahh right my bad I didn't read it all lol...

but still the parent of "port" was HeroBackground as I showed in these lines:
JASS:
//===== Making "HeroBackground" the Parent of ORIGIN_FRAME_PORTRAIT causes the portrait to move
//===== above the background image but it still passes through when animation is played.

    call BlzFrameSetParent(port, HeroBackground)
And I tried changing the level for both but still couldn't find a solution, the UI native are so complex >_<

I never would have solved it if you didn't help me :)
 
Status
Not open for further replies.
Top