Remember to always use the trigger "Show last created dialog"
And to save your dialogs and dialog items in the global data table for easy use later on.
In this example the main dialog box (DataTableSetDialog) was saved as "Kills" and the label control (DataTableSetControl) with the variable "gv_player1_Kills" was saved as "KillNum". Saving these dialogs will make it easier to use them in later triggers.
The 2nd trigger will be updating the global variable "player1_Kills" and then updating the dialog.
Theeventcouldbewhateveryoulike(Thisexamplewillusewhen"Any Unit Dies")Actions:gv_player1_Kills=(gv_player1_Kills+1);DialogControlDestroy(DataTableGetControl(true,"KillNum"));DataTableValueRemove(true,"KillNum");libNtve_gf_CreateDialogItemLabel(DataTableGetDialog(true,"Kills"),100,75,c_anchorLeft,110,20,IntToText(gv_player1_Kills),Color(100,100,100),false,2.0);DataTableSetControl(true,"KillNum",DialogControlLastCreated());DialogControlSetVisible(DialogControlLastCreated(),PlayerGroupAll(),true);
The first thing done is the global variable is incremented. Now each time you update a label you must destroy the existing label or the labels will stack on top of each other. Since the control was saved as "KillNum" it is easily destroyed. The next line removes KillNum from the data table so it can be added again later when creating the new dialog control. The next line creates the control for the dialog "Kills" (saved eariler for easy use) and is fed the updated player1_Kills. The next line adds the control back to the data table and sets the last control created to visible.
There you go, hope this helps some noobs, like myself, out there.
This trigger will show you a way of keeping a running total of player 1's unit kills and the use of a variable in a dialog.
The first trigger will set up the UI box with a label of "Kills" and a label with variable "gv_player1_Kills" initially set to 0.
Remember to always use the trigger "Show last created dialog" And to save your dialogs and dialog items in the global data table for easy use later on. In this example the main dialog box (DataTableSetDialog) was saved as "Kills" and the label control (DataTableSetControl) with the variable "gv_player1_Kills" was saved as "KillNum". Saving these dialogs will make it easier to use them in later triggers.
The 2nd trigger will be updating the global variable "player1_Kills" and then updating the dialog.
The first thing done is the global variable is incremented. Now each time you update a label you must destroy the existing label or the labels will stack on top of each other. Since the control was saved as "KillNum" it is easily destroyed. The next line removes KillNum from the data table so it can be added again later when creating the new dialog control. The next line creates the control for the dialog "Kills" (saved eariler for easy use) and is fed the updated player1_Kills. The next line adds the control back to the data table and sets the last control created to visible.
There you go, hope this helps some noobs, like myself, out there.
Or just use score values
@caspersc: Go
where do I have to add PlayerScoreValueGetAsInt?
@jmac321wky: Go
Could anyone turn this into regular triggers? the code is too hard to understand and i need this stuff :P
@ResolveHK: Go
nvm got it