Перейти к содержимому


Фотография

remoteExec не работает в Arma 1.68


Лучший Ответ Targon , 28 March 2017 - 14:39

Разобрался. allowedTargets=2; перевел в allowedTargets=1; Все заработало.

Перейти к сообщению


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 2

#1 OFFLINE   Targon

Targon

    Ефрейтор

  • Пользователи
  • 36 сообщений

Отправлено 26 March 2017 - 07:09

Прошу помочь в решении вопроса.

 

После обновления Arma 3 перестал работать мой скрипт по аномалиям.

Подхожу к маркеру - реакции нет. 

 

Скрипт создания маркеров.

if (isNil("spawnanomaly")) then { spawnanomaly = true; };
if (isNil("creatanomaly")) then { creatanomaly = true; };
if (isNil("deleteanomaly")) then { deleteanomaly = false; };

while {spawnanomaly} do {
	if (creatanomaly) then {
		_num = round(random 200);
		MarkerH = "anomaly" + str(_num);
		_blum = round(random 112);
		namemark = "azona" + str(_blum);
		_mPos = getMarkerPos namemark;
		_pos = [_mPos,10,400,0,0,20,0]call BIS_fnc_findSafePos; 
		createMarker [MarkerH,_pos];  
		MarkerH setMarkerType "mil_objective"; 
		_namearray = ["gravy","jarka","electra","teleport"];
		randomname = _namearray select floor random count _namearray;
		MarkerH setMarkerText randomname;  
		MarkerH setMarkerColor "ColorRed";
	};
	
	if (deleteanomaly) then {
		_nums = round(random 200);
		MarkerS = "anomaly" + str(_nums);
		deleteMarker MarkerS;
	};
	
	sleep 0.02;
};	

скрипт активации при приближении игрока к маркеру.

if (isDedicated) exitWith {};
sleep 3;

while {isNil "tf_Anomalies"} do {diag_log "sleep";sleep 1;};

_null = [] spawn {
	private ["_Aname, _Aactive, _Adist"];
	while {true} do
	{
	  sleep 0.4; 

	_count_units = count AllUnits;	  
	for [{_c = 0}, {_c <= _count_units}, {_c = _c + 1}] do 
	{
		_jednotka = AllUnits select _c;
	 if (alive _jednotka) then
		{
			{
				_Adist = markerPos _x distance (_jednotka);
				_Adist2 = markerPos _x distance (player);
				_Aactive = VAR getVariable [_x,false];
					if (!_Aactive) then
					{ 				
						if (_Adist < 7) then      	
						{
						  VAR setVariable [_x, true, true];
						  [_x,true,false] remoteExecCall ["anomaly_fnc_Aview"];
						};
					};
					if (_Aactive)	then
					{
						
						if (_Adist2 < 3) then 
						{
						  [_x,player,true,false] remoteExecCall ["anomaly_fnc_Ahit"];
						};
						
						if (_Adist < 3) then 
						{
						  [_x,_jednotka,true,false] remoteExecCall ["anomaly_fnc_Ahit"];
						};
					};
					if (_Aactive)	then
					{
						if (_Adist2 < 3) then 
						{
						   nul = [_x] spawn anomaly_fnc_Aeffect;
						};
					};
			} forEach tf_Anomalies;
		};
		};
	};
};

description.ext

class cfgFunctions
{
	class weather {
		class main {
			file = "ALthunder\load";
			class alias_thunder_one_effect {};
			class alias_thunder_two_effect {};
			class alias_weather_effect {};
		};
	};
	class anomaly {
		class main {
			file = "script\load";
			class Aview {};
			class Ahit {};
			class AhitElectra {};
			class Aeffect {};
			class Ahide {};
		};
	};
};

class CfgRemoteExec
{
    class Functions
    {
        mode = 1;
        jip = 0;
		class anomaly_fnc_Aeffect { 
			allowedTargets=2;
			jip = 0;
		};
		class anomaly_fnc_Aview { 
			allowedTargets=2; 
			jip = 0;
		};
		class anomaly_fnc_Ahit { 
			allowedTargets=2; 	
			jip = 0;
		}; 
		class anomaly_fnc_Ahide { 
			allowedTargets=2; 	  
			jip = 0;
		}; 
		class anomaly_fnc_AhitElectra { 
			allowedTargets=2; 	
			jip = 0;
		};
		class alias_thunder_one_effect { 
			allowedTargets=2; 	  
			jip = 0;
		}; 
		class alias_thunder_two_effect { 
			allowedTargets=2; 	
			jip = 0;
		}; 
		class alias_weather_effect { 
			allowedTargets=2; 	
			jip = 0;
		};
    };
    class Commands
    {
        mode = 0;
    };
};

Сообщение отредактировал Targon: 26 March 2017 - 07:22

  • 0

#2 OFFLINE   Schatten

Schatten

    Капитан

  • Пользователи
  • 1808 сообщений

Отправлено 26 March 2017 - 13:58

Пара замечаний:

1 В коде, вызываемом с помощью spawn, не нужно использовать private.

2 В цикле for условие его завершения должно быть строгое:

for [{_c = 0}, {_c < _count_units}, {_c = _c + 1}] do {...};

Ну, и самое главное, где отчёт из RPT-файла?


  • 0

#3 OFFLINE   Targon

Targon

    Ефрейтор

  • Пользователи
  • 36 сообщений

Отправлено 28 March 2017 - 14:39   Лучший Ответ

Разобрался. allowedTargets=2; перевел в allowedTargets=1; Все заработало.


  • 0




Яндекс.Метрика