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


Фотография

Прошу помощи с написанием скипта


Лучший Ответ Ilias , 08 September 2015 - 18:26



 

Ilias,

scountwest <= 2 * scountingwestv

Спасибо, вот это запомню,

Schatten,

vlad333000,

Спасибо за помощь, всё работает)

Одна ещё вещь: не знаете какой нибудь способ сообщать игрокам что либо даже если они в зевсе? //Все стороны могут быть; , свои hint и commandChat они не видят.

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


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

#41 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 19:46

 

init.sqf

if (!isDedicated) then {execVM "count.sqf"}; // count.sqf запустится только на клиентском компе

count.sqf

_marker = createMarkerLocal ["marker", getMarkerPos "countmp"];

_marker setMarkerTypeLocal "Dot";

while {true} do {
	_markerText = switch (playerSide) do {
		case blufor: {str (blufor countSide allPlayers)};
		case opfor: {str (opfor countSide allPlayers)};
		default {""};
	};

	_marker setMarkerTextLocal _markerText;

	sleep 60;
};

 

Как указать count's ?


  • 0

#42 OFFLINE   Schatten

Schatten

    Капитан

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

Отправлено 05 September 2015 - 19:47

Как указать count's ?

В смысле?


  • 0

#43 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 19:54

 

Как указать count's ?

В смысле?

 

 

{str (blufor countSide allPlayers)};

Как это понять?


Сообщение отредактировал Ilias: 05 September 2015 - 19:54

  • 0

#44 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 20:03

vlad333000

Schatten

 

init.sqf

if (!isDedicated) then {execVM "count.sqf"};

count.sqf

_marker = createMarkerLocal ["markercount", getMarkerPos "countmp"];
_marker setMarkerTypeLocal "Dot";

_countwest = 7;
_counteast = 7;
_countingwestv = 1;
_countingeastv = 1;

while {true}
     do {

          _countwest = _countwest + _countingwestv;
          _counteast = _counteast + _countingeastv;

          _markerText = switch (playerSide)
               do {
                    case blufor: {str (_countwest)};
                    case opfor: {str (_counteast)};
                    default {""};
               };
          _marker setMarkerTextLocal _markerText;

          sleep 60;

     }; 

?


Сообщение отредактировал Ilias: 05 September 2015 - 20:25

  • 0

#45 OFFLINE   vlad333000

vlad333000

    Полковник

  • Пользователи
  • 3224 сообщений
  • Откуда:Кострома

Отправлено 05 September 2015 - 20:06

Ilias, грубый перевод слово в слово: (перевести в тип строка (запад посчитать этой стороны всех игроков))
  • 0

#46 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 20:13

Ilias, грубый перевод слово в слово: (перевести в тип строка (запад посчитать этой стороны всех игроков))

 

Тоесть он будет ставить текст Количество игроков?


Сообщение отредактировал Ilias: 05 September 2015 - 20:14

  • 0

#47 OFFLINE   vlad333000

vlad333000

    Полковник

  • Пользователи
  • 3224 сообщений
  • Откуда:Кострома

Отправлено 05 September 2015 - 20:29

Ilias, сие чудо в итоге:
Преобразовывает из типа int в трип string кол-во игроков стороны west
  • 1

#48 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 20:31

 

Ilias, сие чудо в итоге:
Преобразовывает из типа int в трип string кол-во игроков стороны west

 

Меня вообщедто количество игроков не волнует)

Посмотрите так получиться наконец?

vlad333000

Schatten

 

init.sqf

if (!isDedicated) then {execVM "count.sqf"};

count.sqf

_marker = createMarkerLocal ["markercount", getMarkerPos "countmp"];
_marker setMarkerTypeLocal "hd_dot";

_countwest = 7;
_counteast = 7;
_countingwestv = 1;
_countingeastv = 1;

while {true}
     do {

          _countwest = _countwest + _countingwestv;
          _counteast = _counteast + _countingeastv;

          _markerText = switch (playerSide)
               do {
                    case blufor: {str (_countwest)};
                    case opfor: {str (_counteast)};
                    default {""};
               };
          _marker setMarkerTextLocal _markerText;

          sleep 60;

     }; 

?


Сообщение отредактировал Ilias: 05 September 2015 - 20:35

  • 0

#49 OFFLINE   Schatten

Schatten

    Капитан

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

Отправлено 05 September 2015 - 20:42

_countwest и _counteast будут хранить одинаковые значения, зачем тогда эти две переменные и switch? И что вообще должно получиться?


  • 1

#50 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 20:56

Они не будут одинаковыми (Возможно) Это подсчёт средств для CTI игры на моём сервере, у меня почти всегда настроен Freeplay (MCC, zeuses) и подсчёт средств производится самими игроками за создаваемые единицы, этот скипт + с тригерами на карте будет хорошим дополнением.

Кто хочет как нибудь интересно поиграть, присоединяйтесь.

Skype: Ilias48rus .

 

Играем через Tunngle .

В последнее время играем с:

Arma 3 Extended + PWS collection

 

Скрипт кажется работает, проверю с другими игроками, если будет работать нажму Вопрос решён.

Спасибо за помощь.


Сообщение отредактировал Ilias: 05 September 2015 - 21:18

  • 0

#51 OFFLINE   Schatten

Schatten

    Капитан

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

Отправлено 05 September 2015 - 21:04

Они не будут одинаковыми

Начальные значения одинаковые, приращение тоже, так что можно обойтись одной переменной, но если не хотите...
 

_marker = createMarkerLocal ["markercount", getMarkerPos "countmp"];
_marker setMarkerTypeLocal "hd_dot";

_countwest = 7;
_counteast = 7;
_countingwestv = 1;
_countingeastv = 1;

while {true}
	do {
		_markerText = switch (playerSide)
			do {
				case blufor: {
					_countwest = _countwest + _countingwestv;

					str _countwest
				};
				case opfor: {
					_counteast = _counteast + _countingeastv;

					str _counteast
				};
				default {""};
			};

		_marker setMarkerTextLocal _markerText;

		sleep 60;
	};

  • 2

#52 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 05 September 2015 - 21:05

 

Они не будут одинаковыми

Начальные значения одинаковые, приращение тоже, так что можно обойтись одной переменной, но если не хотите...

Я буду менять.


  • 0

#53 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 06 September 2015 - 18:02

Немного расширил крипт, вот здесь | что-то не так, буду очень признателен за помощь.

                                                             \/


while {true}
	do {
		switch (playerSide)
			do {
				case blufor:
					{
						if (scountwest < scountingwestv or scountwest = scountingwestv)
							then {
								[playerSide,"HQ"] commandChat "We out of supplyes, You have lover then 15 minutes to deliver it.";
							};
						else
							{
								if (scountwest < (2 x scountingwestv) or scountwest = (2 x scountingwestv))
									then {
										[playerSide,"HQ"] commandChat "Supplyes is low, You have lover then 35 minutes to deliver it.";
									};							};
			};

		sleep 300;

	};


  • 0

#54 OFFLINE   vlad333000

vlad333000

    Полковник

  • Пользователи
  • 3224 сообщений
  • Откуда:Кострома

Отправлено 06 September 2015 - 18:36

1. = - присвоение
== - проверка на равенство
2. Синтаксис if:
if (condition) then {   ...code...} else {   ...code...};
Если не понятно

3. Где еще одна закрывающая фигурная скобка? (У вас открывающих 7 шт, закрывающих - 6)
4. Где вы откопали "х" как оператор? Такого вообще нет ни в одном языке: вам нужна * (shift + 8 )

Сообщение отредактировал vlad333000: 06 September 2015 - 18:37

  • 0

#55 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 06 September 2015 - 19:52


shift + 8

)


while {true}
	do {

		switch (playerSide)
			do {
				case blufor:
					{
						if (scountwest < scountingwestv or scountwest == scountingwestv)
							then [
								[playerSide,"HQ"] commandChat "We out of supplyes, You have lover then 15 minutes to deliver it.";
							]
						else
							[
								if (scountwest < (2 * scountingwestv) or scountwest == (2 * scountingwestv))
									then [
										[playerSide,"HQ"] commandChat "Supplyes is low, You have lover then 35 minutes to deliver it.";
									]
								else
									]
										if (scountwest < (3 * scountingwestv) or scountwest == (3 * scountingwestv))
											then [
												[playerSide,"HQ"] commandChat "Supplyes is lover then for 55 minutes";
											];
									];
							];
					};
				case opfor:
					{
						if (scounteast < scountingeastv or scounteast == scountingeastv)
							then [
								[playerSide,"HQ"] commandChat "We out of supplyes! \nYou have lover then 15 minutes to deliver it.";
							]
						else
							[
								if (scounteast < (2 * scountingeastv) or scounteast == (2 * scountingeastv))
									then [
										[playerSide,"HQ"] commandChat "Supplyes is low /nYou have lover then 35 minutes to deliver it.";
									]
								else
									[
										if (scounteast < (3 * scountingeastv) or scounteastt == (3 * scountingeastv))
											then [
												[playerSide,"HQ"] commandChat "Supplyes is lover then for 55 minutes";
											];
									];
		
							];
					};
			};

		sleep 300;

	};

Как сейчас?


Сообщение отредактировал Ilias: 06 September 2015 - 19:55

  • 0

#56 OFFLINE   vlad333000

vlad333000

    Полковник

  • Пользователи
  • 3224 сообщений
  • Откуда:Кострома

Отправлено 06 September 2015 - 20:19

Ilias,починили одно, сломали другое (которое уже чинились в прошлом)
If () then {} else {};
А не
If () then [] else [];
Хватит путать скобки! Каждая скобка отвечает за свое и не "совместима" с другой!
  • 0

#57 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 06 September 2015 - 20:24

vlad333000,

Чёрт, извини, мне показалось тут [ ]


if (condition) then { ...code...} else { ...code...};

)

А кроме этого?


  • 0

#58 OFFLINE   vlad333000

vlad333000

    Полковник

  • Пользователи
  • 3224 сообщений
  • Откуда:Кострома

Отправлено 06 September 2015 - 20:33

На коде выше после 2-ого else скобка не в ту сторону повернута (если не исправил)

Ну пока что ошибок не виду, все зависит от того что до и после написаго, где запускается и необходимого результата (Вы добились того чего хотели?)
  • 0

#59 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 07 September 2015 - 10:39

vlad333000,

 

init.sqf 

if (!isDedicated) then {execVM "countms.sqf"};
if (!isDedicated) then {execVM "counting.sqf"};
//if (!isDedicated) then {execVM "scounting.sqf"};
if (!isDedicated) then {execVM "scountme.sqf"};

countms.sqf

_countm = createMarkerLocal ["countmn", getMarkerPos "countmp"];
_countm setMarkerTypeLocal "hd_dot";
_countingm = createMarkerLocal ["countingmn", getMarkerPos "countingmp"];
_countingm setMarkerTypeLocal "hd_dot";

_scountm = createMarkerLocal ["scountmn", getMarkerPos "scountmp"];
_scountm setMarkerTypeLocal "hd_dot";
_Scountingm = createMarkerLocal ["scountingmn", getMarkerPos "scountingmp"];
_Scountingm setMarkerTypeLocal "hd_dot";

countwest = 20;
counteast = 15;
countingwestv = 1;
countingeastv = 1;

scountwest = 35;
Scounteast = 20;

while {true}
	do {

		_countmt = switch (playerSide)
			do {
				case blufor: {str (countwest)};
				case opfor: {str (counteast)};
				default {""};
			};
		_countm setMarkerTextLocal _countmt;
		_countingmt = switch (playerSide)
			do {
				case blufor: {"+" + str (countingwestv)};
				case opfor: {"+" + str (countingeastv)};
				default {""};
			};
		_countingm setMarkerTextLocal _countingmt;

scountingwestv = west countSide allUnits;
scountingeastv = east countSide allUnits;

		_scountmt = switch (playerSide)
			do {
				case blufor: {str (scountwest)};
				case opfor: {str (scounteast)};
				default {""};
			};
		_scountm setMarkerTextLocal _scountmt;
		_scountingmt = switch (playerSide)
			do {
				case blufor: {str (scountingwestv)};
				case opfor: {str (scountingeastv)};
				default {""};
			};
		_scountingm setMarkerTextLocal _scountingmt;

		sleep 1;

	};

conting.sqf

scountwestsv = 0;
scounteastsv = 0;

while {true}
	do {

		sleep 1200;

			countwest = countwest + countingwestv;
			counteast = counteast + countingeastv;

				switch (playerSide)
					do {
						case blufor: {
							if (scountwest > scountingwestv or scountwest == scountingwestv) then {
								scountwest = scountwest - scountingwestv;
								scountwestsv = 0;
							}
							else {
								_hint "Need supply";
								scountwestsv = scountwestsv + 1;
							};
						};
						case opfor: {
							if (scounteast > scountingeastv or scounteast == scountingeastv) then {
								scounteast = scounteast - scountingeastv;
								scounteastsv = 0;
							}
							else {
								_hint "Need supply";
								scounteastsv = scounteastsv + 1;
							};
						};
					};
			
	};

scountme.sqf

while {true}
	do {

		sleep 300;

		switch (playerSide)
			do {
				case blufor:
					{
						if (scountwest < scountingwestv or scountwest == scountingwestv)
							then {
								{playerSide,"HQ"} commandChat "We out of supplyes, You have lover then 15 minutes to deliver it.";
							}
						else
							{
								if (scountwest < (2 * scountingwestv) or scountwest == (2 * scountingwestv))
									then {
										{playerSide,"HQ"} commandChat "Supplyes is low, You have lover then 35 minutes to deliver it.";
									{
								else
									}
										if (scountwest < (3 * scountingwestv) or scountwest == (3 * scountingwestv))
											then {
												{playerSide,"HQ"} commandChat "Supplyes is lover then for 55 minutes";
											};
									};
							};
					};
				case opfor:
					{
						if (scounteast < scountingeastv or scounteast == scountingeastv)
							then {
								{playerSide,"HQ"} commandChat "We out of supplyes! \nYou have lover then 15 minutes to deliver it.";
							}
						else
							{
								if (scounteast < (2 * scountingeastv) or scounteast == (2 * scountingeastv))
									then {
										{playerSide,"HQ"} commandChat "Supplyes is low /nYou have lover then 35 minutes to deliver it.";
									}
								else
									{
										if (scounteast < (3 * scountingeastv) or scounteastt == (3 * scountingeastv))
											then {
												{playerSide,"HQ"} commandChat "Supplyes is lover then for 55 minutes";
											};
									};
							};
					};
			};
	};

Что то не так, подсчёт остановился после добавления визуализаций.


Сообщение отредактировал Ilias: 07 September 2015 - 18:28

  • 0

#60 OFFLINE   Ilias

Ilias

    Прапорщик

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

Отправлено 07 September 2015 - 19:02

vlad333000,

 

Верно ли вот это?

if (scountwest < (2 * scountingwestv) or scountwest == (2 * scountingwestv))










Сообщение отредактировал Ilias: 07 September 2015 - 19:03

  • 0




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