I've been stuck on this for several days. Perhaps other map makers could lend their wisdom?
Goal: Create a clickable dialog button with an image (76x76) of a particular unit / ability and launch custom functionality when clicked via a trigger.
Difficulty: My current attempts do not fire the triggers below when clicking over dialog images. For example, if the image is placed on top of the button, the triggers below will not work. If the button goes on top, it works but looks bad.
Current FAILED solution (code):
NOTE: I have some constants down there:
constintCARD_ICON_DIM=76constintDIALOG_OFFSET=35rootMenuAddIconOptions:ActionReturnType:(None)ParametersiconIndex=0<Integer>tooltip=NoText<Text>rootMenu=NoDialog<Dialog>iconFile=EditorData\Images\UnknownImage.tga<File-Image>GrammarText:rootMenuAddIcon(iconIndex,tooltip,rootMenu,iconFile)HintText:(None)CustomScriptCodeLocalVariablesActionsDialog-CreateaButtonforDialogrootMenuwiththedimensions(CARD_ICON_DIM,CARD_ICON_DIM)anchoredtoTopLeftwithanoffsetof((rootMenuIconIndexToXOff(iconIndex)),DIALOG_OFFSET)settingthetooltiptotooltipwithbuttontext""andthehoverimagesetto""Dialog-CreateanImageforDialogrootMenuwiththedimensions(CARD_ICON_DIM,CARD_ICON_DIM)anchoredtoTopLeftwithanoffsetof((rootMenuIconIndexToXOff(iconIndex)),DIALOG_OFFSET)settingthetooltiptotooltipusingtheimageAssets\Textures\btn-border-ability.ddsasaNormaltypewithtiledsettofalsetintcolorGreenandblendmodeNormalDialog-CreateanImageforDialogrootMenuwiththedimensions(CARD_ICON_DIM,CARD_ICON_DIM)anchoredtoTopLeftwithanoffsetof((rootMenuIconIndexToXOff(iconIndex)),DIALOG_OFFSET)settingthetooltiptotooltipusingtheimageiconFileasaNormaltypewithtiledsettofalsetintcolorGreenandblendmodeNormalrootMenuCreateOptions:FunctionReturnType:DialogParametersGrammarText:rootMenuCreate()HintText:(None)CustomScriptCodeLocalVariablesActionsDialog-CreateaNon-modaldialogofsize(ROOT_MENU_WIDTH,ROOT_MENU_HEIGHT)at(0,0)relativetoTopLeftofscreenGeneral-Return(Lastcreateddialog)init_comm_guiOptions:ActionReturnType:(None)Parametersteam<Team>player<PlayerGroup>GrammarText:init_comm_gui(team,player)HintText:Initializetextforplayerclass-Commander.CustomScriptCodeLocalVariablestmpDialog=NoDialog<Dialog>ActionsVariable-SettmpDialog=(rootMenuCreate())rootMenuAddIcon(0,"X",tmpDialog,Assets\Textures\btn-ability-terran-bombardmentstrike.dds)rootMenuAddIcon(1,"Y",tmpDialog,Assets\Textures\btn-unit-terran-marine.dds)rootMenuAddIcon(2,"Z",tmpDialog,Assets\Textures\btn-unit-terran-autoturret.dds)rootMenuAddIcon(3,"Q",tmpDialog,Assets\Textures\btn-ability-terran-heal.dds)Variable-SetrootMenu[(Integer(team))] = tmpDialog
Dialog - Show (Last created dialog) for player
BtnClicked
Events
Dialog - Any Dialog Item is Clicked by Player Any Player
UI - Player Any Player clicks Left mouse button Down.
Local Variables
Conditions
Actions
UI - Display a Message custom dialog with Title No Text and Text "Zing" for (All players) (Pause game)
After much experimenting, I found out a work-around. It's a bit hacky, but it works. Someone let me know if they find something better please!
In order to capture mouse clicks over an dialog image item, you can place a button of the same size with transparency set to 100%. Here's my work-around:
I've been stuck on this for several days. Perhaps other map makers could lend their wisdom?
Goal: Create a clickable dialog button with an image (76x76) of a particular unit / ability and launch custom functionality when clicked via a trigger.
Difficulty: My current attempts do not fire the triggers below when clicking over dialog images. For example, if the image is placed on top of the button, the triggers below will not work. If the button goes on top, it works but looks bad.
Current FAILED solution (code): NOTE: I have some constants down there:
After much experimenting, I found out a work-around. It's a bit hacky, but it works. Someone let me know if they find something better please!
In order to capture mouse clicks over an dialog image item, you can place a button of the same size with transparency set to 100%. Here's my work-around: