Jump to content
Sign in to follow this  
gizz46

gizz46's Weaponselection dialog /hud

Recommended Posts

Hi, folks!

this is my new mod/addon wich I want to present to the community .

Well basicly its just a concept Im working on right now.

menu works via the F key at the moment.

firemodeselection and grendade selection wil be applied also later.

But right now im on a point where i dont now how to handle some problems with the scripting

So i could need some help from the community on this.

i want that the different symbols only be displayed if the gun or item is in the players load out.

also it would be cool to get some feedback and ideas from you on this.

Edited by gizz46

Share this post


Link to post
Share on other sites

I,ve a problem with the dialog at the moment.

Im trying to let the weaponsymbols only show up, if the weapon is realy in the soldiers inventory.

so that the launcher symbol only shows up if the solder has a launcher!

i know it has somthing to to with ctrlShow.

but i dont know how to use this in a script.

init.sqf

disableSerialization;

waitUntil {(not (isNull player)) and (alive player)};

sleep 0.2;

keyspressed = compile preprocessFile "keyspressed.sqf";

_display = findDisplay 46;

_display displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressef.sqf

private['_handled'];

_handled = false;

switch (_this select 1) do

{

//F key

case 33:

{

player execVM "comR.sqf",closeDialog 0;

_handled = true;

};

};

_handled;

comR.sqf

_ok=createDialog "comR";

class comR

{

idd = 3000;

movingEnable = 0;

controlsBackground[] = {};

name = "myMenu1";

objects[] = {};

controls[] = {Control_0,Control_1,Control_2,Control_3,Control_4};

class Control_0 : Base_Activetext

{

style = ST_PICTURE;

x = 0.019;

y = 0.020;

w = 0.961;

h = 0.960;

colorText[] = {0.000,0.000,0.000,1.000};

colorBackground[] = {1.000,1.000,1.000,0.000};

sizeEx = TextSize_normal;

};

class Control_1 : Base_Activetext

{

idc= 1;

style = ST_PICTURE;

action = player execVM "rifle.sqf";

text = hud\rifle.paa;

x = 0.053;

y = 0.100;

w = 0.311;

h = 0.175;

colorText[] = {1.000,1.000,1.000,0.000};

colorBackground[] = {1.000,1.000,1.000,0.000};

sizeEx = TextSize_normal;

};

class Control_2 : Base_Activetext

{

idc = 2;

style = ST_PICTURE;

action = player execVM "";

x = 0.053;

y = 0.295;

w = 0.311;

h = 0.175;

colorText[] = {1.000,1.000,1.000,0.000};

colorBackground[] = {1.000,1.000,1.000,0.000};

sizeEx = TextSize_normal;

};

class Control_3 : Base_Activetext

{

idc = 3;

style = ST_PICTURE;

action = player execVM "launcher.sqf";

text = hud\launcher.paa;

x = 0.382;

y = 0.295;

w = 0.311;

h = 0.175;

colorText[] = {1.000,1.000,1.000,0.000};

colorBackground[] = {1.000,1.000,1.000,0.000};

sizeEx = TextSize_normal;

};

class Control_4 : Base_Activetext

{

idc = 45561;

style = ST_PICTURE;

action = player execVM "pistol.sqf";

text= hud\pistole.paa;

x = 0.382;

y = 0.100;

w = 0.270;

h = 0.175;

colorText[] = {0.000,0.000,0.000,1.000};

colorBackground[] = {1.000,1.000,1.000,0.000};

sizeEx = TextSize_normal;

};

};

I found a script in the forum for handgun scanning and get it to work.

now i have to get it work for all the other itmes like launchers, grenades ect.

createDialog "comR";

_unit = player;

// Function for pistol data - by Spooner

isPistol =

{

private ["_isPistol","_unknownConfig","_unknownWeaponClass","_pistolConfig"];

_unknownWeaponClass = _this select 0;

_unknownConfig = configFile >> "CfgWeapons" >> _unknownWeaponClass;

_pistolConfig = configFile >> "CfgWeapons" >> "PistolCore";

_isPistol = false;

while {isClass _unknownConfig} do

{

if (_unknownConfig == _pistolConfig) exitWith

{

_isPistol = true;

};

_unknownConfig = inheritsFrom _unknownConfig;

};

_isPistol; // Return.

};

// Do we have a pistol?

_items = items _unit;

_weaps = (weapons _unit) - _items;

_pistol = "";

// Check weapons for pistols.

if (!(_weaps select 0 == "")) then {

for [{_i = 0}, {_i < count _weaps}, {_i = _i + 1}] do {

_weap = _weaps select _i;

if ([_weap] call isPistol) then {_pistol = _weap};

};

};

if (_pistol == "") then {ctrlShow [45561, false]} else {ctrlShow [45561, true]};

};

};

im very new to all that scripting stuff so it would be cool to gets some hints from you.

Edited by gizz46

Share this post


Link to post
Share on other sites

hi there,

here is a new update of my weapon control dialog.

i get it to work that the pistol symbol is only shown if the player is carrying one.

My plan ist to get it work with all of the weapons but i dont know how to do that exactly.

So if somebody knows how to check the player for primaryweapon or secondaryweapon it would be a great help.

I've searched already in the forum but everything I tried didnt work.

if (primaryWeapon == "") then {ctrlShow [45561, false]} else {ctrlShow [45561, true]}; ??????????

maybe something like this ?

Share this post


Link to post
Share on other sites

if (player HaseWeapon X && X == primaryWeapon) then {...};

Some like this, where X is base weapon class type for primary weapons ;)

Share this post


Link to post
Share on other sites

if (player hasWeapon "x" == "primaryWeapon") then {ctrlShow [45561, true]} else {ctrlShow [45561, false]};

I've tried it with that but didnt work.

Share this post


Link to post
Share on other sites

its wrong, I mean X its BASIC WEAPON CLASS

Waht you want to do, ask here, or PM me?!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×