Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Melmarkian

Something I want to show you: Ammocrate Dialog

Recommended Posts

*UPDATED VERSION WITH FILLER IN LAST POST (#5)*

Hi,

I worked a bit with dialogs the last 2 days because I wanted an easy way to display the content of custom crates and remove specific content from them.

Here is a picture of the Dialog (I know it is not that pretty!):

cratedialog.jpg

Inside the Mission you can start the Dialog with Radio -> Crate (0-0-4).

What you can do:

- Click on a Weapon or Magazine and the count will decrease by 1 inside the Ammobox or Vehicle.

- I included a vehicle and two ammoboxes. The active Cargo for the dialog can be set with the actionmenu.

- You can also let the Dialog point at a different vehicle or box if you set the variable mel_currentcrate to a different object.

- You can fill the container the traditional way or you can use radio alpha (0-0-1) to spawn weapons on the tables. The weapons have action attached to them:

- Take weapon ( Will insert the weapon into the mel_currentcrate)

- Take magazinex1 or x5 ( same as above but with magazines)

- There is a limit for 10 weapons and 50 magazines implemented atm.

At the moment the Dialog is limited to 12 different weaponclasses and 18 different magazineclasses.

There is a lot of other mess in the mission because I use it to test functions for upcoming missions. But I think the only thing required is to set a container as mel_currentcrate.

The parts of the Dialog are:

- description.ext + controls_base.h + mycrate.h

- mel_inisupply.sqf ( used to declare the variables and add actions for cratechanging)

- startmycratedialog.sqf (starts the dialog inside the trigger)

- updatecargo.sqf ( to change the boxcontent)

I just created this for use in a campaign I am planning, but I want to share it. Use whatever you want and beware of the uncommented code!! ;)

If you have any questions feel free to ask.

Mission to test it:

http://www.mediafire.com/?0yrb8erh0dfbep8

Edited by Melmarkian

Share this post


Link to post
Share on other sites

i wanted to use dialogs similar in something entirely else than ammocrate, and this looks like a good example in understanding more about the subject.

Tnx for release.

Share this post


Link to post
Share on other sites

Thank you Demonized and Riouken!

I will set up a second window where you can fill the container in the same dialog. Will be no problem but I would like to let the script detect the right ammo for the weapons.

Edit: A small change

If you want to display the ingame weapon and magazine names replace startmycratedialog.sqf with this:

private ["_currentbutton","_currentindex","_firstwep","_buttonaction"];

createDialog "mycrate"; 

for "_i" from 0 to ((count ( getWeaponCargo mel_currentcrate select 0)) -1) do
{

   _currentbutton = 1600 + _i;
   _currentindex = _i;
   _weaponname =  gettext (configFile >> "CfgWeapons" >> ((getWeaponCargo mel_currentcrate  select 0) select _currentindex) >> "displayName");

   _buttonaction = format ["nul = [mel_currentcrate, %1, ""weapon""] execVM 'supportsystem\updatecargo.sqf'; closeDialog 0; nul = [] execvm 'supportsystem\startmycratedialog.sqf'", _currentindex];
   _firstwep = format ["%1     %2", _weaponname, ((getWeaponCargo mel_currentcrate  select 1) select _currentindex)];
   ctrlSetText [_currentbutton,  _firstwep];
   buttonSetAction [_currentbutton, _buttonaction];

};


for "_i" from 0 to (count (( getMagazineCargo mel_currentcrate select 0)) -1) do
{

   _currentbutton = 1612 + _i;
   _currentindex = _i;
   _magazinename = gettext (configFile >> "CfgMagazines" >> ((getMagazineCargo mel_currentcrate  select 0) select _currentindex) >> "displayName");

   _buttonaction = format ["nul = [mel_currentcrate, %1, ""magazine""] execVM 'supportsystem\updatecargo.sqf'; closeDialog 0; nul = [] execvm 'supportsystem\startmycratedialog.sqf'", _currentindex];   
   _firstwep = format ["%1     %2",_magazinename , ((getMagazineCargo mel_currentcrate  select 1) select _currentindex)];
   ctrlSetText [_currentbutton,  _firstwep];
   buttonSetAction [_currentbutton, _buttonaction ];

};

I added:

_weaponname =  gettext (configFile >> "CfgWeapons" >> ((getWeaponCargo mel_currentcrate  select 0) select _currentindex) >> "displayName");

and set the result as buttontext.

Edited by Melmarkian

Share this post


Link to post
Share on other sites

Ok, here is a new version with an included Filler for the Box:

http://www.mediafire.com/?tp52562oxboqba7

filler.jpg

Start the Dialog with Radio -> Filler (0-0-6)

It will detect the weapons you choose inside the array and display the correct magazines + explosives for the weapon.

You define your weaponchoice for the filler with the array: mel_weaponchoice

And the container again with: mel_currentcrate

Grenades should work if you put "Throw" in the array. "Put" seems to just show Satchel Charges.

Files:

- description.ext + controls_base.h + Mycrate.h + MyCrateFiller.h

- mel_inisupply.sqf ( used to declare the variables and add actions for cratechanging)

- startcratefillerdialog.sqf (starts the dialog inside the trigger)

- updatecargo.sqf ( to change the boxcontent)

- updateweaponchoice.sqf ( Changes the weapon + magazines depending on your click)

Again feel free to use whatever you want

Share this post


Link to post
Share on other sites
Sign in to follow this  

×