ownerdrawflag



ownerdrawflag is used to display items only when a certain condition is met.

One example: the following piece of code displays two messages
"OK" if you are in 1st place
"wtf ?" if you are not in 1st place
menuDef {
visible 1
rect 300 240 20 20

itemDef {
rect 0 0 32 32
visible 1
text "OK"
ownerdrawflag CG_SHOW_IF_PLYR_IS_FIRST_PLACE
}

itemDef {
rect 0 0 32 32
visible 1
text "wtf ?"
ownerdrawflag CG_SHOW_IF_PLYR_IS_NOT_FIRST_PLACE
}

}



This is a list of the possible values for ownerdrawflag (almost complete)


CG_SHOW_IF_PLYR_IS_FIRST_PLACE
CG_SHOW_IF_PLYR_IS_NOT_FIRST_PLACE
CG_SHOW_IF_RED_IS_FIRST_PLACE
CG_SHOW_IF_BLUE_IS_FIRST_PLACE


CG_SHOW_IF_PLYR_IS_ON_RED
CG_SHOW_IF_PLYR_IS_ON_BLUE


CG_SHOW_IF_PLAYER_HAS_FLAG
CG_SHOW_YOURTEAMHASENEMYFLAG
CG_SHOW_OTHERTEAMHASFLAG
CG_SHOW_BLUE_TEAM_HAS_REDFLAG
CG_SHOW_RED_TEAM_HAS_BLUEFLAG


CG_SHOW_ANYTEAMGAME
CG_SHOW_ANYNONTEAMGAME
CG_SHOW_CTF
CG_SHOW_CLAN_ARENA
CG_SHOW_TOURNAMENT
duel matches


CG_SHOW_HEALTHCRITICAL
(when your health is <= 25 )
CG_SHOW_HEALTHOK
(health > 25)


CG_SHOW_IF_WARMUP
CG_SHOW_IF_NOT_WARMUP

1 comment:

  1. I hope it's ok to post a question:

    I would like to draw a background on top of the "player has flag" gfx that warns me that our flag is also taken (often forget to look at flag status):

    itemDef {
    name "wait_to_cap"
    rect 270 50 32 32
    ownerdrawflag CG_SHOW_CTF
    ownerdrawflag CG_SHOW_IF_PLAYER_HAS_FLAG
    ownerdrawflag CG_SHOW_OTHERTEAMHASFLAG
    visible 1
    decoration
    style 1
    background "gfx/2d/defer.png"
    }


    But it just doesn't show up. What am I doing wrong, could you please tell me ?

    Xnoybis

    ReplyDelete