Im in the process of creating a dialogue that will allow the player to assign weapons (of a choice of 3 weapons) to units within one of 5 groups. I have got the basics of the dialogue created. The bottons and the lists. I also have got a good start on one of the scripts. My problem is that im not sure how to transfer variables. I made a counter script to add the amount of weapons available (pistols = 10, pistols being the weapon type). What i need to know is how to script the addweapon button in my dialouge to add the weapon selected to the soldier selected. Also, when the group is selected from the group list, the appropriate units in that group need to be detected. I already have the check group figured out. So groups will show up if present, or vise versa.
This is the description.ext; "UPDATED 1 DEC @ 1333"
#define FontM "tahomaB36"
#define FontHTML "CourierNewB64"
#define ST_LEFT 0
#define ST_RIGHT 1
#define ST_CENTER 2
#define ST_FRAME 64
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_COMBO 4
#define CT_LISTBOX 5
#define CT_ACTIVETEXT 11
class RscText
{
type = CT_STATIC;
idc = -1;
style = ST_LEFT;
colorBackground[] = {0, 0, 0, 0};
colorText[] = {0, 0, 0, 1};
font = FontM;
sizeEx = 0.04;
};
class RscActiveText
{
type = CT_ACTIVETEXT;
idc = -1;
style = ST_LEFT;
color[] = {0, 0, 0, 1};
colorActive[] = {1, 0, 0, 1};
font = FontM;
sizeEx = 0.02;
soundEnter[] = {"ui\ui_over", 0.2, 1};
soundPush[] = {, 0.2, 1};
soundClick[] = {"ui\ui_ok", 0.2, 1};
soundEscape[] = {"ui\ui_cc", 0.2, 1};
default = false;
};
class RscButton
{
type = CT_BUTTON;
idc = -1;
style = ST_CENTER;
colorText[] = {0, 0, 0, 1};
font = FontHTML;
sizeEx = 0.025;
soundPush[] = {, 0.2, 1};
soundClick[] = {"ui\ui_ok", 0.2, 1};
soundEscape[] = {"ui\ui_cc", 0.2, 1};
default = false;
};
class RscEdit
{
type = CT_EDIT;
idc = -1;
style = ST_LEFT;
font = FontHTML;
sizeEx = 0.02;
colorText[] = {0, 0, 0, 1};
colorSelection[] = {0.5, 0.5, 0.5, 1};
autocomplete = false;
text = ;
};
class RscLB_C
{
style = ST_LEFT;
idc = -1;
colorSelect[] = {0.4, 0.4, 0.4, 1};
colorSelectBackground[] = {0.2, 0.2, 0.2, 1};
colorText[] = {0.2, 0.2, 0.2, 1};
colorBackground[] = {0.4, 0.4, 0.4, 1};
font = FontHTML;
sizeEx = 0.025;
rowHeight = 0.04;
};
class RscListBox : RscLB_C
{
type = CT_LISTBOX;
};
class RscCombo : RscLB_C
{
type = CT_COMBO;
wholeHeight = 0.3;
};
class DlgTutorial
{
idd = 1;
movingEnable = true;
controlsBackground[] = { MY_BACKGROUND, MY_FRAME };
class MY_BACKGROUND : RscText
{
colorBackground[] = {0.4, 0.4, 0.4, 0.75};
text = ;
x = 0.2;
y = 0.2;
w = 0.6;
h = 0.4;
};
class MY_FRAME : RscText
{
idc = 103;
style = ST_FRAME;
colorText[] = {0, 0, 0, 1};
text = "Weapon Assignment";
font = FontHTML;
sizeEx = 0.025;
x = 0.22;
y = 0.22;
w = 0.56;
h = 0.36;
};
objects[] = { };
controls[] = {select, closebutton, Weaponslist, Grouplist, soldierlist, Pistols, muskets, Bombs};
//Execute button, Will assign weapons
class select : RscButton
{
idc = 101;
style = ST_CENTER;
x = 0.25;
y = 0.48;
w = 0.2;
h = 0.05;
text = "Select";
action = "[] exec ""/Arms/process.sqs""";
default = true;
};
//closes the dialogue; button
class closebutton : RscButton
{
idc = 102;
x = 0.5;
y = 0.48;
w = 0.2;
h = 0.05;
text = "Close";
action = "closeDialog 0";
};
// list of available weapons
class Weaponslist : RscCombo
{
idc = 104;
x = 0.25;
y = 0.3;
w = 0.2;
h = 0.04;
};
// list of availabe groups
class Grouplist : RscCombo
{
idc = 105;
x = 0.25;
y = 0.36;
w = 0.2;
h = 0.04;
};
//lists of available soldiers
class soldierlist : RscCombo
{
idc = 106;
x = 0.25;
y = 0.42;
w = 0.2;
h = 0.04;
};
//IS supposed to display the amount of pistols in pool
class pistols :RscActiveText
{
idc = 107;
style = ST_CENTER;
x = 0.55;
y = 0.26;
w = 0.2;
h = 0.1;
text = "# Pistols";
};
// is supposed to display the amount of muskets in pool
class muskets : RscActiveText
{
idc = 108;
style = ST_CENTER;
x = 0.56;
y = 0.31;
w = 0.2;
h = 0.1;
text = "# Muskets";
};
// is supposed to display the amount of bombs in pool
class bombs : RscActiveText
{
idc = 109;
style = ST_CENTER;
x = 0.55;
y = 0.36;
w = 0.2;
h = 0.1;
text = "# Bombs";
};
};
The classes Muskets, pistols, and bombs are supposed to display the amount of those weapons in the pool on the dialogue, but i dont know how to transfer the appropriate variable into the dialogue.
this is the script that sorts out the variables. "UPDATED 1 DEC @ 1333"
_ok = createDialog "DlgTutorial"
?(!_ok): hint "Fehler!"; exit
ctrlSetText [106, format ["%1 pistols", pistols]]
ctrlSetText [107, format ["%1 muskets", muskets]]
ctrlSetText [108, format ["%1 bombs", bombs]]
? (pistols > 0): _index = lbAdd [104, "Pistol"]
lbSetData [104, _index, "Pistol"]
? (muskets > 0): _index = lbAdd [104, "Musket"]
lbSetData [104, _index, "Musket"]
? (bombs > 0): _index = lbAdd [104, "Bomb"]
lbSetData [104, _index, "Bomb"]
lbSetCurSel [104, 0]
? !(isNull g1): _index = lbAdd [105, "Group 1"]
lbSetData [105, _index, "Group 1"]
? !(isNull g2): _index = lbAdd [105, "Group 2"]
lbSetData [105, _index, "Group 2"]
? !(isNull g3): _index = lbAdd [105, "Group 3"]
lbSetData [105, _index, "Group 3"]
? !(isNull g4): _index = lbAdd [105, "Group 4"]
lbSetData [105, _index, "Group 4"]
? !(isNull g5): _index = lbAdd [105, "Group 5"]
lbSetData [105, _index, "Group 5"]
lbSetCurSel [105, 0]
? lbcursel 105==0: goto "group1"
? lbcursel 105==1: goto "group2"
? lbcursel 105==2: goto "group3"
? lbcursel 105==3: goto "group4"
? lbcursel 105==4: goto "group5"
#group1
? (alive a2): _index = lbAdd [106, "Soldier 1"]
lbSetData [106, _index, "Soldier 1"]
? (alive a3): _index = lbAdd [106, "Soldier 2"]
lbSetData [106, _index, "Soldier 2"]
? (alive a4): _index = lbAdd [106, "Soldier 3"]
lbSetData [106, _index, "Soldier 3"]
? (alive a5): _index = lbAdd [106, "Soldier 4"]
lbSetData [106, _index, "Soldier 4"]
? (alive a6): _index = lbAdd [106, "Soldier 5"]
lbSetData [106, _index, "Soldier 5"]
? (alive a7): _index = lbAdd [106, "Soldier 6"]
lbSetData [106, _index, "Soldier 6"]
? (alive a8): _index = lbAdd [106, "Soldier 7"]
lbSetData [106, _index, "Soldier 7"]
? (alive a9): _index = lbAdd [106, "Soldier 8"]
lbSetData [106, _index, "Soldier 8"]
? (alive a10): _index = lbAdd [106, "Soldier 9"]
lbSetData [106, _index, "Soldier 9"]
? (alive a11): _index = lbAdd [106, "Soldier 10"]
lbSetData [106, _index, "Soldier 10"]
? (alive a12): _index = lbAdd [106, "Soldier 11"]
lbSetData [106, _index, "Soldier 11"]
lbSetCurSel [106, 0]
exit
#group2
? !(isNull b1): _index = lbAdd [106, "Soldier 1"]
lbSetData [106, _index, "Soldier 1"]
? !(isNull b2): _index = lbAdd [106, "Soldier 2"]
lbSetData [106, _index, "Soldier 2"]
? !(isNull b3): _index = lbAdd [106, "Soldier 3"]
lbSetData [106, _index, "Soldier 3"]
? !(isNull b4): _index = lbAdd [106, "Soldier 4"]
lbSetData [106, _index, "Soldier 4"]
? !(isNull b5): _index = lbAdd [106, "Soldier 5"]
lbSetData [106, _index, "Soldier 5"]
? !(isNull b6): _index = lbAdd [106, "Soldier 6"]
lbSetData [106, _index, "Soldier 6"]
? !(isNull b7): _index = lbAdd [106, "Soldier 7"]
lbSetData [106, _index, "Soldier 7"]
? !(isNull b8): _index = lbAdd [106, "Soldier 8"]
lbSetData [106, _index, "Soldier 8"]
? !(isNull b9): _index = lbAdd [106, "Soldier 9"]
lbSetData [106, _index, "Soldier 9"]
? !(isNull b10): _index = lbAdd [106, "Soldier 10"]
lbSetData [106, _index, "Soldier 10"]
? !(isNull b11): _index = lbAdd [106, "Soldier 11"]
lbSetData [106, _index, "Soldier 11"]
? !(isNull b12): _index = lbAdd [106, "Soldier 12"]
lbSetData [106, _index, "Soldier 12"]
lbSetCurSel [106, 0]
exit
#group3
? (alive c1): _index = lbAdd [106, "Soldier 1"]
lbSetData [106, _index, "Soldier 1"]
? (alive c2): _index = lbAdd [106, "Soldier 2"]
lbSetData [106, _index, "Soldier 2"]
? (alive c3): _index = lbAdd [106, "Soldier 3"]
lbSetData [106, _index, "Soldier 3"]
? (alive c4): _index = lbAdd [106, "Soldier 4"]
lbSetData [106, _index, "Soldier 4"]
? (alive c5): _index = lbAdd [106, "Soldier 5"]
lbSetData [106, _index, "Soldier 5"]
? (alive c6): _index = lbAdd [106, "Soldier 6"]
lbSetData [106, _index, "Soldier 6"]
? (alive c7): _index = lbAdd [106, "Soldier 7"]
lbSetData [106, _index, "Soldier 7"]
? (alive c8): _index = lbAdd [106, "Soldier 8"]
lbSetData [106, _index, "Soldier 8"]
? (alive c9): _index = lbAdd [106, "Soldier 9"]
lbSetData [106, _index, "Soldier 9"]
? (alive c10): _index = lbAdd [106, "Soldier 10"]
lbSetData [106, _index, "Soldier 10"]
? (alive c11): _index = lbAdd [106, "Soldier 11"]
lbSetData [106, _index, "Soldier 11"]
? (alive c12): _index = lbAdd [106, "Soldier 12"]
lbSetData [106, _index, "Soldier 12"]
lbSetCurSel [106, 0]
exit
#group4
? (alive d1): _index = lbAdd [106, "Soldier 1"]
lbSetData [106, _index, "Soldier 1"]
? (alive d2): _index = lbAdd [106, "Soldier 2"]
lbSetData [106, _index, "Soldier 2"]
? (alive d3): _index = lbAdd [106, "Soldier 3"]
lbSetData [106, _index, "Soldier 3"]
? (alive d4): _index = lbAdd [106, "Soldier 4"]
lbSetData [106, _index, "Soldier 4"]
? (alive d5): _index = lbAdd [106, "Soldier 5"]
lbSetData [106, _index, "Soldier 5"]
? (alive d6): _index = lbAdd [106, "Soldier 6"]
lbSetData [106, _index, "Soldier 6"]
? (alive d7): _index = lbAdd [106, "Soldier 7"]
lbSetData [106, _index, "Soldier 7"]
? (alive d8): _index = lbAdd [106, "Soldier 8"]
lbSetData [106, _index, "Soldier 8"]
? (alive d9): _index = lbAdd [106, "Soldier 9"]
lbSetData [106, _index, "Soldier 9"]
? (alive d10): _index = lbAdd [106, "Soldier 10"]
lbSetData [106, _index, "Soldier 10"]
? (alive d11): _index = lbAdd [106, "Soldier 11"]
lbSetData [106, _index, "Soldier 11"]
? (alive d12): _index = lbAdd [106, "Soldier 12"]
lbSetData [106, _index, "Soldier 12"]
lbSetCurSel [106, 0]
exit
#group5
? (alive e1): _index = lbAdd [106, "Soldier 1"]
lbSetData [106, _index, "Soldier 1"]
? (alive e2): _index = lbAdd [106, "Soldier 2"]
lbSetData [106, _index, "Soldier 2"]
? (alive e3): _index = lbAdd [106, "Soldier 3"]
lbSetData [106, _index, "Soldier 3"]
? (alive e4): _index = lbAdd [106, "Soldier 4"]
lbSetData [106, _index, "Soldier 4"]
? (alive e5): _index = lbAdd [106, "Soldier 5"]
lbSetData [106, _index, "Soldier 5"]
? (alive e6): _index = lbAdd [106, "Soldier 6"]
lbSetData [106, _index, "Soldier 6"]
? (alive e7): _index = lbAdd [106, "Soldier 7"]
lbSetData [106, _index, "Soldier 7"]
? (alive e8): _index = lbAdd [106, "Soldier 8"]
lbSetData [106, _index, "Soldier 8"]
? (alive e9): _index = lbAdd [106, "Soldier 9"]
lbSetData [106, _index, "Soldier 9"]
? (alive e10): _index = lbAdd [106, "Soldier 10"]
lbSetData [106, _index, "Soldier 10"]
? (alive e11): _index = lbAdd [106, "Soldier 11"]
lbSetData [106, _index, "Soldier 11"]
? (alive e12): _index = lbAdd [106, "Soldier 12"]
lbSetData [106, _index, "Soldier 12"]
lbSetCurSel [106, 0]
exit
This is the script that processes the variables and adds the weapons "UPDATED 1 DEC @ 1333"
? lbcursel 105==0: goto "group1"
? lbcursel 105==1: goto "group2"
? lbcursel 105==2: goto "group3"
? lbcursel 105==3: goto "group4"
? lbcursel 105==4: goto "group5"
#group1
? lbcursel 106==0: _x = a2
? lbcursel 106==1: _x = a3
? lbcursel 106==2: _x = a4
? lbcursel 106==3: _x = a5
? lbcursel 106==4: _x = a6
? lbcursel 106==5: _x = a7
? lbcursel 106==6: _x = a8
? lbcursel 106==7: _x = a9
? lbcursel 106==8: _x = a10
? lbcursel 106==9: _x = a11
? lbcursel 106==10: _x = a12
? lbCurSel 104==0: goto "pistol"
? lbCurSel 104==1: goto "musket"
? lbCurSel 104==2: goto "bomb"
#group2
? lbcursel 106==0: _x = b1
? lbcursel 106==1: _x = b2
? lbcursel 106==2: _x = b3
? lbcursel 106==3: _x = b4
? lbcursel 106==4: _x = b5
? lbcursel 106==5: _x = b6
? lbcursel 106==6: _x = b7
? lbcursel 106==7: _x = b8
? lbcursel 106==8: _x = b9
? lbcursel 106==9: _x = b10
? lbcursel 106==10: _x = b11
? lbcursel 106==11: _x = b12
? lbCurSel 104==0: goto "pistol"
? lbCurSel 104==1: goto "musket"
? lbCurSel 104==2: goto "bomb"
#group3
? lbcursel 106==0: _x = c1
? lbcursel 106==1: _x = c2
? lbcursel 106==2: _x = c3
? lbcursel 106==3: _x = c4
? lbcursel 106==4: _x = c5
? lbcursel 106==5: _x = c6
? lbcursel 106==6: _x = c7
? lbcursel 106==7: _x = c8
? lbcursel 106==8: _x = c9
? lbcursel 106==9: _x = c10
? lbcursel 106==10: _x = c11
? lbcursel 106==11: _x = c12
? lbCurSel 104==0: goto "pistol"
? lbCurSel 104==1: goto "musket"
? lbCurSel 104==2: goto "bomb"
#group4
? lbcursel 106==0: _x = d1
? lbcursel 106==1: _x = d2
? lbcursel 106==2: _x = d3
? lbcursel 106==3: _x = d4
? lbcursel 106==4: _x = d5
? lbcursel 106==5: _x = d6
? lbcursel 106==6: _x = d7
? lbcursel 106==7: _x = d8
? lbcursel 106==8: _x = d9
? lbcursel 106==9: _x = d10
? lbcursel 106==10: _x = d11
? lbcursel 106==11: _x = d12
? lbCurSel 104==0: goto "pistol"
? lbCurSel 104==1: goto "musket"
? lbCurSel 104==2: goto "bomb"
#group5
? lbcursel 106==0: _x = e1
? lbcursel 106==1: _x = e2
? lbcursel 106==2: _x = e3
? lbcursel 106==3: _x = e4
? lbcursel 106==4: _x = e5
? lbcursel 106==5: _x = e6
? lbcursel 106==6: _x = e7
? lbcursel 106==7: _x = e8
? lbcursel 106==8: _x = e9
? lbcursel 106==9: _x = e10
? lbcursel 106==10: _x = e11
? lbcursel 106==11: _x = e12
? lbCurSel 104==0: goto "pistol"
? lbCurSel 104==1: goto "musket"
? lbCurSel 104==2: goto "bomb"
#pistol
? _X hasweapon "pistol": goto "assigned"
? (pistols == 0): goto "out"
_x addweapon "pistol"
pistols = pistols - 1
hint format ["You have %1 pistols left.", pistols]
exit
#musket
? _X hasweapon "musket": goto "assigned"
? (muskets == 0): goto "out"
_X addweapon "musket"
muskets = muskets - 1
hint format ["You have %1 muskets left.", muskets]
exit
#out
hint "You are out of that weapon."
exit
#assigned
hint "That soldier already has that weapon."
exit
As you can see for the unit detection i used individual names. I want these to change depending on the selected group. So lets say group 1 had 2 soldiers, i would want the soldier list to bring up those two soldiers so could arm them.
I hope i explained my problem good enough.
Thanks in advance
CA