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

createDialog problem

Recommended Posts

I have a problem with creating dialog.

I have dialogs, that I can show in game (for example vehicle purchase dialogs), and I can run them any times (once, twice, 3 times and so on). But have trouble with respawn dialog.

One of my dialogs - respawn dialog - is opened only in the first death. In further events of death it doesn't open, though the script, which calls it is executed (checked with globalChat command that it works). Why could that be?

Here's the script which calls the dialog:

// mca_onPlayerKilled.sqf
// version 1.0

private ["_caller"];
_caller = _this select 0;
_caller globalChat "I was killed.";//dbg
// поÑле Ñмерти, но до реÑпа, Ñ Ð½Ð° Ñтороне CIV, но значение player ÑохранÑетÑÑ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð¼Ñƒ в редакторе (RU_player_1, например)

if ( _caller in RU_players) then // Ð´Ð»Ñ Ñ€ÑƒÑÑких
{
if (dialog) then
{
	closeDialog 1;
};
createDialog "mca_respawn";
{
	lbAdd [101, _x] ;
} forEach mcti_fieldHospitals_ru;
{
	lbAdd [101, _x] ;
} forEach mcti_mashes_ru;
lbAdd [101, "Mobile Headquarters (MHQ)"];
lbSetCurSel [101, (lbSize 101) - 1]; //default selected is MHQ (last)
//waitUntil { !dialog };
sleep 5;
closeDialog 1;

};

and here's the dialog's .hpp:

class mca_respawn
{
name=mca_respawn;
idd=1;
movingEnable=1;
controlsBackground[]={ mca_respawn_bg, mca_respawn_bgf1, mca_respawn_bgf2, mca_respawn_bgf3, mca_respawn_bgf4 };
objects[]={};
controls[]={ mca_respawn_lb1, mca_respawn_title };

class mca_respawn_bg : RscBackground
{
	x = 0.1; y = 0.1; w = 0.8; h = 0.8;
};

class mca_respawn_bgf1 : RscBackground
{
	x = 0.1; y = 0.1; w = 0.8; h = 0.005;
};
class mca_respawn_bgf3 : RscBackground
{
	x = 0.1; y = 0.9-0.005; w = 0.8; h = 0.005;
};

class mca_respawn_bgf2 : RscBackground
{
	x = 0.1; y = 0.1; w = 0.005; h = 0.8-0.005;
};	
class mca_respawn_bgf4 : RscBackground
{
	x = 0.9-0.005; y = 0.1; w = 0.005; h = 0.8-0.005;
};

class mca_respawn_lb1 : RscListBox //List
{
	idc = 101;
	x = 0.1; y = 0.25; w = 0.35; h = 0.6;
	rows = 10; columns = 1;
	style = LB_TEXTURES;
};

class mca_respawn_title : RscText
{
	x = 0.2; y = 0.1; w = 0.5; h = 0.1; 
	text = "Select your Respawn Place"; 
};

};

---------- Post added at 23:34 ---------- Previous post was at 23:29 ----------

.rpt has following text:

Unsupported language Russian in stringtable

Unsupported language Russian in stringtable

Unsupported language Russian in stringtable

Unsupported language Russian in stringtable

Unsupported language Russian in stringtable

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_13

Remote entity want to supply: RU_player_13

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_13

Remote entity want to supply: RU_player_12

Remote entity want to supply: RU_player_12

Remote entity want to supply: RU_player_2

Remote entity want to supply: RU_player_2

Remote entity want to supply: RU_player_2

Remote entity want to supply: RU_player_13

Remote entity want to supply: RU_player_12

Remote entity want to supply: RU_player_2

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_2

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_11

Remote entity want to supply: RU_player_3

Remote entity want to supply: RU_player_10

Remote entity want to supply: RU_player_3

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

Remote entity want to supply: RU_player_6

---------- Post added at 23:45 ---------- Previous post was at 23:34 ----------

I have added player check to script, now it doesn't write anything to .rpt, but dialog is still not created... why?

---------- Post added at 23:46 ---------- Previous post was at 23:45 ----------

// mca_onPlayerKilled.sqf
// version 1.0

private ["_caller"];
_caller = _this select 0;
// поÑле Ñмерти, но до реÑпа, Ñ Ð½Ð° Ñтороне CIV, но значение player ÑохранÑетÑÑ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð¼Ñƒ в редакторе (RU_player_1, например)

if (not isServer) then
{
if (player == _caller) then
{
	_caller globalChat "I was killed.";//dbg
	if ( _caller in RU_players) then // Ð´Ð»Ñ Ñ€ÑƒÑÑких
	{
		if (dialog) then
		{
			closeDialog 1;
		};
		createDialog "mca_respawn";
		{
			lbAdd [101, _x] ;
		} forEach mcti_fieldHospitals_ru;
		{
			lbAdd [101, _x] ;
		} forEach mcti_mashes_ru;
		lbAdd [101, "Mobile Headquarters (MHQ)"];
		lbSetCurSel [101, (lbSize 101) - 1]; //default selected is MHQ (last)
		//waitUntil { !dialog };
		sleep 5;
		closeDialog 1;

	};

};

};

Share this post


Link to post
Share on other sites

I think RU_players doesn't contain player. Note that unit before and after respawn isn't the same object! So in this array you have player's body not player.

Share this post


Link to post
Share on other sites

ok, I modified script, to see if it executed actually...

// mca_onPlayerKilled.sqf
// version 1.0

private ["_caller"];
_caller = _this select 0;
// поÑле Ñмерти, но до реÑпа, Ñ Ð½Ð° Ñтороне CIV, но значение player ÑохранÑетÑÑ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð¼Ñƒ в редакторе (RU_player_1, например)

if (not isServer) then
{
if (player == _caller) then
{

	if ( _caller in RU_players) then // Ð´Ð»Ñ Ñ€ÑƒÑÑких
	{
		_caller globalChat "I was killed.";//dbg
		if (dialog) then
		{
			closeDialog 1;
		};
		createDialog "mca_respawn";
		{
			lbAdd [101, _x] ;
		} forEach mcti_fieldHospitals_ru;
		{
			lbAdd [101, _x] ;
		} forEach mcti_mashes_ru;
		lbAdd [101, "Mobile Headquarters (MHQ)"];
		lbSetCurSel [101, (lbSize 101) - 1]; //default selected is MHQ (last)
		sleep 5;
		closeDialog 1;
		waitUntil { !dialog };
		_caller globalChat "Dialog is closed now.";//dbg

	};

};

};

and... it doesn't show text second time I'm killed.

so... I have another question then...

as I have learned, when I am killed I am on CIV (side command shows civilians side), how do I know that I am east or west ?

---------- Post added at 00:15 ---------- Previous post was at 00:06 ----------

I added player check:

// mca_onPlayerKilled.sqf
// version 1.0

private ["_caller"];
_caller = _this select 0;
// поÑле Ñмерти, но до реÑпа, Ñ Ð½Ð° Ñтороне CIV, но значение player ÑохранÑетÑÑ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð¼Ñƒ в редакторе (RU_player_1, например)

if (not isServer) then
{
if (player == _caller) then
{
	_caller globalChat format ["_caller=%1, side _caller=%2, RU_players=%3, I'm in RU_players=%4", _caller, side _caller, RU_players, (_caller in RU_players)];//dbg	
	_caller globalChat format ["player=%1, side player=%2, RU_players=%3, I'm in RU_players=%4", player, side player, RU_players, (player in RU_players)];//dbg	
	if ( _caller in RU_players) then // Ð´Ð»Ñ Ñ€ÑƒÑÑких
	{
		_caller globalChat "Starting Dialog.";//dbg
		if (dialog) then
		{
			closeDialog 1;
		};
		createDialog "mca_respawn";
		{
			lbAdd [101, _x] ;
		} forEach mcti_fieldHospitals_ru;
		{
			lbAdd [101, _x] ;
		} forEach mcti_mashes_ru;
		lbAdd [101, "Mobile Headquarters (MHQ)"];
		lbSetCurSel [101, (lbSize 101) - 1]; //default selected is MHQ (last)
		sleep 5;
		closeDialog 1;
		waitUntil { !dialog };
		_caller globalChat "Dialog is closed now.";//dbg

	};

};

};

both, first and second times OF DEATH it says player=_caller=RU_player_1, but 1st time I'm in array, but second time I'm not in array... why?

RU_player_1 is in array in mission's init.sqf.

---------- Post added at 00:18 ---------- Previous post was at 00:15 ----------

// players ///////////////////////////////////////////////////////

RU_players = [RU_player_1, RU_player_2, RU_player_3, RU_player_4, RU_player_5, RU_player_6, RU_player_7, RU_player_8, RU_player_9, RU_player_10, RU_player_11, RU_player_12, RU_player_13, RU_player_14, RU_player_15];

publicVariable "RU_players";

it is in init.sqf of mission

---------- Post added at 00:20 ---------- Previous post was at 00:18 ----------

how can I know MY SIDE ? (not CIV, as globalChat says)

---------- Post added at 00:21 ---------- Previous post was at 00:20 ----------

well, I can use a my_side global variable, setting it on mission start, but not publishing it with publicVariable, can I ?

Share this post


Link to post
Share on other sites

RU_player_1 is in array in mission's init.sqf.

No, after 1st death and respawn, RU_player_1 is not in this array. Because then you have body in array instead of respawned player (which is new object).

You have to update this array after every respawn or find other solution.

Maybe put in this array classes (which are always constant, even after death) of RU soldier and check:

(type _caller) == RU_soldier_class

Share this post


Link to post
Share on other sites

can I use my_side variable without publishing it? (this method works now, but I'm not sure that this variable is really not broadcasted somehow to others. Who knows what OFP engine will show us next second? =) )

---------- Post added at 00:34 ---------- Previous post was at 00:31 ----------

I define this variable in client's script (with isServer check).

Share this post


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

×