Jump to content
Sign in to follow this  
DDavid

ArmA 2 Dialog - Driving me nuts

Recommended Posts

Hey all,

Lately I've been getting into scripting for ArmA 2, and it's been going pretty well.. I've created a few small scripts, played around with a lot of functions and commands.. But now, I'm completely stuck.

You see, I've made a script to call for a pilot to fly a vehicle to your location. Both pilot and vehicle are spawned on execution of the script, and it all works well. However, since I want to be able to choose from a list of vehicles, I've been trying to get a dialog to open after the player selects a "Send vehicle" command from the action menu. This dialog would contain a choice of vehicles.

I've been testing the script via the action menu, but when there are a number of vehicles to choose from, two problems occur:

-the action menu gets too cluttered

-the vehicles you do not select cannot be removed from the menu after having made a selection (I could only script it so that the action is remved from the menu when it is actually executed, since the action's ID is passed on to the script linked to it).

So, the logical choice for me was to open a dialog after selecting "Send vehicle" from the action menu. This turned out to be trickier than I expected. I've read the Dialog Control article thoroughly, and even tried my luck with the examples in that article. Still, I can't seem to get what I want from it, and I can't figure out why not. Here are the problems I'm facing at the moment:

-Player cannot move while dialog is open.

I know more people have encountered this problem, I have searched the forum when I ran into it. I was just wondering if there's a workaround or fix for this yet. If not, it's not a real problem. Shouldn't take long to click on a vehicle anyway ;).

-Button isn't working.

Now here's a real problem.. The button I made to test with isn't even doing anything. I've tried a lot of things, and after having read each line of code at least ten times, I decided to just copy-paste the example button, only to find that doesn't work either.. The button doesn't switch colors when I hover over it or click it, in fact I can't select it at all.. It behaves as a ST_TEXT more than as a button.

Kind of a bummer, after having made some nice scripts ;)

Here's the code I have in my description.ext file:

#define true 1
#define false 0

class VehicleDialog {
idd = -1;   // set to -1, because we don't require a unique ID
movingEnable = 1;  

class controlsBackground { 

	class Background {
			idc = -1;   // set to -1, unneeded
			type = ST_TEXT;   // constant
			style = ST_LEFT;   // constant
			move = true;

			text = "";
			font = Zeppelin32;
			sizeEx = 0.025;

			colorBackground[] = { 0.14, 0.18, 0.13, 0.8 };
			colorText[] = { 1, 1, 1, 1 };

			x = 0.1;
			y = 0.7;
			w = 0.2;
			h = 0.05;
		};	
};   

objects[] = {  };  

class controls { 

	class Button {
		idc = 0;
		type = CT_BUTTON;
		style = ST_LEFT;
		default = true;
		font = Zeppelin32;
		sizeEx = 0.03;
		colorText[] = { 0, 0, 0, 1 };
		colorFocused[] = { 1, 0, 0, 1 };   // border color for focused state
		colorDisabled[] = { 0, 0, 1, 0.7 };   // text color for disabled state
		colorBackground[] = { 0, 0, 0, 0 };
		colorBackgroundDisabled[] = { 0, 0, 0, 0 };   // background color for disabled state
		colorBackgroundActive[] = { 0, 0, 0, 0 };   // background color for active state
		offsetX = 0.003;
		offsetY = 0.003;
		offsetPressedX = 0.002;
		offsetPressedY = 0.002;
		colorShadow[] = { 0, 0, 0, 0.5 };
		colorBorder[] = { 0, 0, 0, 1 };
		borderSize = 0;
		soundEnter[] = { "", 0, 1 };  // no sound
		soundPush[] = { "", 0, 1 };
		soundClick[] = { "", 0, 1 };  // no sound
		soundEscape[] = { "", 0, 1 };  // no sound
		x = 0.1;
		y = 0.7;
		w = 0.2;
		h = 0.05;
		text = "Close";
		action = "";
	};
};	
};

Can anyone discover some mistake here?

I've been thinking of other options, though I'm not sure if they're possible.

I'd like to see my vehicle options via the command menu, for instance under the "support" option. I have no idea if I can add options to this menu, however.

While searching for more info on the dialogs, I've come across people saying that instead of "createDialog" one should use "createDisplay". The documentation on displays is rather poor, though, and I can't for the life of me figure out how to succesfully use displays.

I hope someone can help me with this.

Regards,

David

---* update *---

Oh dear, I'm feeling a bit stupid.. I was using the defined constants, assuming they were defined in the game's core somewhere. I've just now copy-pasted them into my own constants file, and the button's working as it should. Sorry for the dumb question. I am still looking for a way to enable the player's movement when the dialog is open, but I realize that's a tricky issue.

Once more, my apologies for the silly question, I am after all still learning :)

Edited by DDavid
update

Share this post


Link to post
Share on other sites

I am also looking for a way to enable movement when showing text/dialog on screen.

If you find the solution, please post it here.

Share this post


Link to post
Share on other sites

Oh dear, I'm feeling a bit stupid.. I was using the defined constants, assuming they were defined in the game's core somewhere. I've just now copy-pasted them into my own constants file, and the button's working as it should. Sorry for the dumb question. I am still looking for a way to enable the player's movement when the dialog is open, but I realize that's a tricky issue.

I do wish this bit of information would have been mentioned in the biki page at some point. I thought I'd start learning scripting by creating a few little dialogs.. just to run against the very same wall as you have. Totally put me off of modding Arma2 for months. :(

Edit: I see it IS mentioned, if not exactly prominently. Stupid me, then.

Edited by karstux

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  

×