Moin zusammen,
ich bin gerade dabei ein Berufsystem zu entwickeln, bei dem man zur Jobbörse gehen muss um sich einen Beruf auszusuchen. Der NPC bei der Jobbörse hat ein User Interface, in dem verschieden Knöpfe sind um entweder Bauer oder ähnlich zu werden. Die Knöpfe sollen eine bestimmte Lizenz vergeben, je nachdem was man werden will. Ich habe bereits eine Abfrage eingebaut, dass man nur einen neuen Job annehmen kann, wenn man noch keinen hat. Ich tue mich allerdings mit der onButtonClick action des Buttons schwer. Also meine Frage, wie kann man über einen Button eine bestimmte Lizenz erwerben?
Der Dialog:
Code: berufswahl.hpp
class berufswahl
{
idd = 5555;
class ControlsBackground
{
};
class Controls
{
class HeadBg
{
type = 0;
idc = 0;
x = safeZoneX + safeZoneW * 0.29375;
y = safeZoneY + safeZoneH * 0.22444445;
w = safeZoneW * 0.4125;
h = safeZoneH * 0.04888889;
style = 0;
text = "";
colorBackground[] = {0.3687,0.102,0.102,0.6111};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
};
class MainBg
{
type = 0;
idc = 0;
x = safeZoneX + safeZoneW * 0.29375;
y = safeZoneY + safeZoneH * 0.27888889;
w = safeZoneW * 0.4125;
h = safeZoneH * 0.49555556;
style = 0;
text = "";
colorBackground[] = {0.102,0.102,0.102,0.754};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
};
class Heading
{
type = 0;
idc = 0;
x = safeZoneX + safeZoneW * 0.29375;
y = safeZoneY + safeZoneH * 0.22444445;
w = safeZoneW * 0.4125;
h = safeZoneH * 0.04555556;
style = 0;
text = "Berufsauswahl";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
font = "PuristaBold";
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
};
class GetBauer
{
type = 1;
idc = -1;
x = safeZoneX + safeZoneW * 0.34375;
y = safeZoneY + safeZoneH * 0.38111112;
w = safeZoneW * 0.096875;
h = safeZoneH * 0.05444445;
style = 0;
text = "Bauer - 10.000 $";
borderSize = 0;
colorBackground[] = {0.102,0.102,0.102,1};
colorBackgroundActive[] = {1,0,0,1};
colorBackgroundDisabled[] = {0.2,0.2,0.2,1};
colorBorder[] = {0,0,0,0};
colorDisabled[] = {0.2,0.2,0.2,1};
colorFocused[] = {0.2,0.2,0.2,1};
colorShadow[] = {0,0,0,1};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
offsetPressedX = 0.01;
offsetPressedY = 0.01;
offsetX = 0.01;
offsetY = 0.01;
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1.0};
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1.0};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1.0};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1.0};
onButtonClick = "[false, false, false, bauer] call life_fnc_buyLicense; closeDialog 0;";
};
class GetMetallbauer
{
type = 1;
idc = -1;
x = safeZoneX + safeZoneW * 0.54375;
y = safeZoneY + safeZoneH * 0.38111112;
w = safeZoneW * 0.096875;
h = safeZoneH * 0.05444445;
style = 0;
text = "Metallbauer - 10.000 $";
borderSize = 0;
colorBackground[] = {0.102,0.102,0.102,1};
colorBackgroundActive[] = {1,0,0,1};
colorBackgroundDisabled[] = {0.2,0.2,0.2,1};
colorBorder[] = {0,0,0,0};
colorDisabled[] = {0.2,0.2,0.2,1};
colorFocused[] = {0.2,0.2,0.2,1};
colorShadow[] = {0,0,0,1};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
offsetPressedX = 0.01;
offsetPressedY = 0.01;
offsetX = 0.01;
offsetY = 0.01;
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1.0};
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1.0};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1.0};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1.0};
onButtonClick = "[false, false, false, metallbauer] call life_fnc_buyLicense; closeDialog 0;";//Hier brauche ich Hilfe
};
class Close
{
type = 1;
idc = -1;
x = safeZoneX + safeZoneW * 0.469375;
y = safeZoneY + safeZoneH * 0.61555556;
w = safeZoneW * 0.058125;
h = safeZoneH * 0.02333334;
style = 0+2;
text = "EXIT";
borderSize = 0;
colorBackground[] = {0.102,0.102,0.102,1};
colorBackgroundActive[] = {1,0,0,1};
colorBackgroundDisabled[] = {0.2,0.2,0.2,1};
colorBorder[] = {0,0,0,0};
colorDisabled[] = {0.2,0.2,0.2,1};
colorFocused[] = {0.2,0.2,0.2,1};
colorShadow[] = {0,0,0,1};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
offsetPressedX = 0.01;
offsetPressedY = 0.01;
offsetX = 0.01;
offsetY = 0.01;
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1.0};
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1.0};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1.0};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1.0};
onButtonClick = "closeDialog 0; ";
};
};
};
Alles anzeigen
Die Funktion:
Code: fn_berufswahl.sqf
#include "..\..\script_macros.hpp" //Ja ich weiß unnötig
createDialog "berufswahl";
if(license_civ_bauer || license_civ_metallbauer) then {
closeDialog 0;
hint localize "STR_NOTF_AlreadyJob";
};
Ich hoffe ihr konntet mein anliegen verstehen und mir helfen.
Mit freundlichen Grüßen, Moritz B.