Нужна помощь?
Создайте тему в соответствующем разделе
Не нужно писать всё в чат!Загляните на торговую площадку
Там вы можете купить
всё что касается игровых серверовНе хотите бан?
Пожалуйста, ознакомьтесь с нашими правилами
Не нарушайте порядок!Продаёте или покупаете?
Пользуйтесь услугами гаранта
Мы сделаем вашу сделку безопасной
-
Объявления
-
⚙️ Новые онлайн-инструменты для DayZ 07/26/26
-
- 0
-
Похожие публикации
-
Автор: paranoyk
©
Инструкция по базовой установке животных на сервер. (базовые понятия)
Задача дать начальные понятия в установке животных на сервер. Вопросы лута, поведения, расстановки-не рассматриваем.
(визги и смешочки "олдфагов" вынесем за скобки, мы в курсе что когда вы начинали даже Богемии ещё не было)
Будем всё делать на основе примера мода, карты Чернорусь и согласно простому правилу "не думай что ты умнее бегемотов".
Берём общедоступный мод Radioactive Animals
Для начала просто подключаем мод к серверу (тестовому , то же правило-имейте сервер для тестов), после чего пытаемся заспавнить животных админкой. Получилось, животные ведут себя после спавна адекватно, нормально выглядят - идём дальше, если нет-жалуемся автору мода.
Открываем папку dayzOffline.chernarusplus и создаём папку mod (или как захотите, но без кириллицы). Открываем созданную папку.
Первая задача-создать файл "types" с новыми объектами. Иногда с модом идёт уже готовый файл. Если он есть-копируем его в папку. Можете переименовать его как хотите. (остальные действия настройки как при создании его с нуля).
Если его нет-не беда, нам нужно только узнать ID обьектов, а вот они то всегда есть в описании или в стиме или в папке с модом. (если нет, то только вскрыв мод или переписав значения при спавне админкой).
Мод из примера НЕ имеет готового тайпса. Но есть ID (класснеймы) в отдельном файле.
Создаём в папке mod файл Atypes.xml . Отрываем его, вставляем
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <types> </types> Верхней строчкой файл тайпс начинается, нижней заканчивается.
Список класснеймов мода
Radioactive_Bear_juggernaut
Radioactive_Bear_Beast
Radioactive_Bear_Tough
Radioactive_bear_pelt
Radioactive_Wolf_juggernaut
Radioactive_Wolf_Beast
Radioactive_Wolf_Tough
Radioactive_wolf_pelt
Radioactive_bear_Meat
Radioactive_wolf_Meat
Их нам внести в нами созданный файл, плохо что нет описания, что куда, но....ясно что у нас животные, их шкуры и мясо. С начало вносим животных. Из ванильного, серверного тайпс копируем значения для любого животного, к примеру
<type name="Animal_BosTaurusF_Brown"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> и подставляя класснеймы модовых животных заполняем созданный тайпс. В конце концов он примет вид
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <types> <type name="Radioactive_Bear_juggernaut"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Bear_Beast"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Bear_Tough"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_juggernaut"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_Beast"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_Tough"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> </types> Можно изменить <lifetime>1800</lifetime> на любое значение какое захотите (максимум 3888000). Это время жизни вашего животного когда рядом нет игрока на дистанции из <saferadius> файла events.
После таким же способом добавляем шкуру и мясо. (опять таки копируем ванильное значение и меняем класснейм на модовый). В результате файл придёт к виду:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <types> <type name="Radioactive_Bear_juggernaut"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Bear_Beast"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Bear_Tough"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_juggernaut"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_Beast"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_Wolf_Tough"> <nominal>0</nominal> <lifetime>1800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> </type> <type name="Radioactive_bear_pelt"> <nominal>0</nominal> <lifetime>28800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="1" deloot="0"/> <category name="tools"/> </type> <type name="Radioactive_wolf_pelt"> <nominal>0</nominal> <lifetime>28800</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="1" deloot="0"/> <category name="tools"/> </type> <type name="Radioactive_bear_Meat"> <nominal>0</nominal> <lifetime>14400</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="1" deloot="0"/> <category name="food"/> </type> <type name="Radioactive_wolf_Meat"> <nominal>0</nominal> <lifetime>14400</lifetime> <restock>0</restock> <min>0</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="1" deloot="0"/> <category name="food"/> </type> </types>
Проверяем кодировку, проверяем валидатором, (добавление-лично я проверяю окончания строчек что бы они совпадали с ванильным файлом).
Основной файл для спавна создан. Теперь создаём файл событий.
Создаём в папке mod файл Aevents.xml . Отрываем его, вставляем
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <events> </events> Верхней строчкой файл ивент начинается, нижней заканчивается.
У нас два вида животных-медведь и волк, в каждом из которых три класса. Тут важно сразу решить, какие у нас будут "ивенты". Один для одного вида или несколько для одного вида и каждого класса. Для примера делаем по событию для каждого вида. Открываем ванильный events.xml и копируем в созданный файл два ивента - медведя и волка.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <events> <event name="AnimalBear"> <nominal>0</nominal> <min>2</min> <max>2</max> <lifetime>180</lifetime> <restock>0</restock> <saferadius>200</saferadius> <distanceradius>0</distanceradius> <cleanupradius>0</cleanupradius> <flags deletable="0" init_random="0" remove_damaged="1"/> <position>fixed</position> <limit>custom</limit> <active>1</active> <children> <child lootmax="0" lootmin="0" max="1" min="1" type="Animal_UrsusArctos"/> </children> </event> <event name="AnimalWolf"> <nominal>8</nominal> <min>4</min> <max>6</max> <lifetime>180</lifetime> <restock>0</restock> <saferadius>200</saferadius> <distanceradius>0</distanceradius> <cleanupradius>0</cleanupradius> <flags deletable="0" init_random="0" remove_damaged="1"/> <position>fixed</position> <limit>child</limit> <active>1</active> <children> <child lootmax="0" lootmin="0" max="6" min="2" type="Animal_CanisLupus_Grey"/> <child lootmax="0" lootmin="0" max="4" min="0" type="Animal_CanisLupus_White"/> </children> </event> </events> Теперь меняем event name. Для животных он всегда должно начинаться с "Animal" . Называем соответственно (пример) AnimalBearA и AnimalWolfA .
Далее количество событий <nominal> котрое вам требуется.
Количество особей в "отряде". <min> <max>.
Дистанции - расстояние до игрока, расстояние до другого "события", расстояние "уборки" события от игрока (начало отсчёта времени жизни или начало уборки трупов животных).
Позиция. Оставляем , если хотим что бы событие спавнилось вне зависимости есть ли игрок рядом. Или делаем <position>player как у зомби, тогда спавн будет при приблежениии игрока.
Лимит....Приведу просто выдержку из одного описания
custom-limit refer to an external file like for animals territories.
child-limit refer to the min and max attributes of the each child.
parent-limit refer to the min and max attributes of the event itself.
mixed-limit is a mix of both child et parent.
То есть если берём что нужно (проще-для медведя что в ванили,для стайных-как у волков)
Актив-1 конечно...
Переделываем под модовые и получаем,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <events> <event name="AnimalBearA"> <nominal>5</nominal> <min>1</min> <max>3</max> <lifetime>180</lifetime> <restock>0</restock> <saferadius>200</saferadius> <distanceradius>10</distanceradius> <cleanupradius>300</cleanupradius> <flags deletable="0" init_random="0" remove_damaged="1"/> <position>fixed</position> <limit>custom</limit> <active>1</active> <children> <child lootmax="0" lootmin="0" max="1" min="1" type="Radioactive_Bear_juggernaut"/> <child lootmax="0" lootmin="0" max="1" min="1" type="Radioactive_Bear_Beast"/> <child lootmax="0" lootmin="0" max="1" min="1" type="Radioactive_Bear_Tough"/> </children> </event> <event name="AnimalWolfA"> <nominal>8</nominal> <min>4</min> <max>6</max> <lifetime>180</lifetime> <restock>0</restock> <saferadius>200</saferadius> <distanceradius>0</distanceradius> <cleanupradius>0</cleanupradius> <flags deletable="0" init_random="0" remove_damaged="1"/> <position>fixed</position> <limit>child</limit> <active>1</active> <children> <child lootmax="0" lootmin="0" max="6" min="2" type="Radioactive_Wolf_juggernaut"/> <child lootmax="0" lootmin="0" max="4" min="0" type="Radioactive_Wolf_Beast"/> <child lootmax="0" lootmin="0" max="4" min="0" type="Radioactive_Wolf_Tough"/> </children> </event> </events> Опять таки проверяем кодировку,валидатором и на соответствие с ванильным файлом. Даже если есть предоставленный автором мода готовый- просмотрите, поправите, исправите.
Теперь подключаем созданные файлы.
Открываем ванильный файл cfgeconomycore.xml
И вписываем между </defaults> и </economycore>
<ce folder="mod"> <file name="Atypes.xml" type="types" /> <file name="Aevents.xml" type="events" /> </ce> Мы создали два подключаемых файла с тайпс и событиями и подключили их.
Открываем папку env и создаём два файла bearA_territories.xml и wolfA_territories.xml
Это файлы территорий спавна. Один из способов их заполнить-работа через СE Editor. (здесь нет описания) Другой-вручную спавнится к каждой точке спавна и снимать координаты, в не зависимости как вы поступаете нужно сделать следующее.
ОТкрываем файл , к примеру , bearA_territories.xml
Заполняем его следующем образом.
<?xml version="1.0" encoding="UTF-8"?> <territory-type> </territory-type> Так начинается и заканчивается этот файл, между ними вбиваем точки спавна. Для примера приведу ДВЕ точки спавна для ДВУХ событий.
<?xml version="1.0" encoding="UTF-8"?> <territory-type> <territory color="4291611852"> <zone name="Water" smin="0" smax="0" dmin="0" dmax="0" x="4822.5" z="13657.5" r="60"/> <zone name="Water" smin="0" smax="0" dmin="0" dmax="0" x="4897.5" z="13815" r="60"/> <zone name="Rest" smin="0" smax="0" dmin="0" dmax="0" x="4997.5" z="13127.5" r="232.5"/> <zone name="HuntingGround" smin="0" smax="0" dmin="0" dmax="0" x="4960" z="13105" r="292.5"/> </territory> <territory color="4291611852"> <zone name="Water" smin="0" smax="0" dmin="0" dmax="0" x="6030" z="11485" r="45"/> <zone name="Rest" smin="0" smax="0" dmin="0" dmax="0" x="7477.5" z="11970" r="180"/> <zone name="HuntingGround" smin="0" smax="0" dmin="0" dmax="0" x="7462.5" z="11970" r="217.5"/> <zone name="HuntingGround" smin="0" smax="0" dmin="0" dmax="0" x="6457.5" z="12210" r="210"/> </territory> </territory-type> territory color="4291611852" - цветовой код для СЕ. Совет делать его не разным для всего события и уникальным.
zone name="Water" - название зоны спавна (разные названия влияют на поведение животных после спавна, "Water","Rest","HuntingGround",Graze". использование зон куриц и кроликов и их действие на животных-непроверено)
далее идёт количество статических и динамических обьектов при спавне (если в ивенте "лимит" ссылается на эти значения -сделать отличными от нуля)
Далее координаты точки и радиус в котором произойдёт спавн.
Ещё для примера wolfA_territories.xml
<?xml version="1.0" encoding="UTF-8"?> <territory-type> <territory color="4290666866"> <zone name="Water" smin="0" smax="0" dmin="3" dmax="4" x="4822.5" z="13657.5" r="100"/> <zone name="Rest" smin="0" smax="0" dmin="3" dmax="4" x="4997.5" z="12927.5" r="200"/> <zone name="HuntingGround" smin="0" smax="0" dmin="3" dmax="4" x="5060" z="12805" r="292.5"/> </territory> <territory color="4290666866"> <zone name="Water" smin="0" smax="0" dmin="3" dmax="4" x="7897.5" z="7515" r="100"/> <zone name="Rest" smin="0" smax="0" dmin="3" dmax="4" x="7477.5" z="7070" r="150"/> <zone name="HuntingGround" smin="0" smax="0" dmin="3" dmax="4" x="7560" z="7105" r="250.5"/> </territory> </territory-type> Опять всё проверяем,кодировка, проверка, схожесть, проверяем, сохраняем
(не делайте ошибки по типу
<?xml version="1.0" encoding="UTF-8"?> <territory-type> <territory color="4291611852"> <zone name="Water" smin="0" smax="0" dmin="3" dmax="4" x="4822.5" z="13657.5" r="60"/> <zone name="Water" smin="0" smax="0" dmin="3" dmax="4" x="4897.5" z="13815" r="60"/> <zone name="Water" smin="0" smax="0" dmin="3" dmax="4" x="6030" z="13485" r="45"/> <zone name="Rest" smin="0" smax="0" dmin="3" dmax="4" x="6997.5" z="12127.5" r="232.5"/> <zone name="Rest" smin="0" smax="0" dmin="3" dmax="4" x="7477.5" z="11970" r="180"/> <zone name="HuntingGround" smin="0" smax="0" dmin="3" dmax="4" x="6960" z="12105" r="292.5"/> <zone name="HuntingGround" smin="0" smax="0" dmin="3" dmax="4" x="7462.5" z="11970" r="217.5"/> <zone name="HuntingGround" smin="0" smax="0" dmin="3" dmax="4" x="6457.5" z="12210" r="210"/> </territory> </territory-type> в таком виде это блок точек для ОДНОГО события. Но если у вас в планах именно так, то....почему и нет?)))
Теперь подключаем наши события из файла инит
Открываем ванильный файл cfgeventspawns.xml
И между <event name="AnimalRoeDeer" /> и <event name="AnimalWolf" /> вписываем
<event name="AnimalBearA" />
<event name="AnimalWolfA" />
Названия для ивента взяты из созданного нами файла Aevents.xml
(кодировка, проверка, схожесть, проверяем, сохраняем)
Открываем ванильный файл cfgenvironment.xml
В блок file path
<file path="env/wolfA_territories.xml" /> <file path="env/bearA_territories.xml" /> Мы указали на путь к файлам с точками спавна.
В блок с territory type вписываем
<territory type="Herd" name="WolfA" behavior="DZWolfGroupBeh"> <file usable="wolfA_territories" /> </territory> <territory type="Herd" name="BearA" behavior="BlissBearGroupBeh"> <file usable="bearA_territories"/> </territory> Где
name= - общее имя для территорий животного (использую всегда окончание названия ивента -подобие ваниле ибо там так)
behavior="DZWolfGroupBeh" - подключение поведения. должен совпадать с установками в самом моде. Да, можно попробовать волкам прописать модель поведения коровы.Не проверял.
file usable="bearA_territories подключение файла территории.
Проверяем, сохраняем, вайпаем сервер.
Далее.....Всё. Быстрее сделать чем рассказать.
Почему файлы тайпс и ивент создаём сами и подключаем отдельно.
Одна цитата от "богемии"
because of a limit on xml file-size
Да и проще работать когда всё разложено по полкам.
Кому не удобно и просто лень-мешайте в одну кучу.
Все права принадлежат на публикацию данного материала принадлежат и автору ©
-
Автор: DrTauren
В этом гайде мы разберёмся как настроить стартовый лут на сервере DayZ Standalone. Наверняка многие знают как это сделать, но, думаю, не все
Инструкция:
1) Открываем файл init.c, который находится в папке mpmissions вашего сервера и ищем такие строки:
EntityAI itemEnt; ItemBase itemBs; Сразу после них находится блок примерно такого вида:
itemEnt = player.GetInventory().CreateInInventory("Rag"); itemBs = ItemBase.Cast(itemEnt); itemBs.SetQuantity(4); SetRandomHealth(itemEnt); itemEnt = player.GetInventory().CreateInInventory("RoadFlare"); itemBs = ItemBase.Cast(itemEnt); Именно здесь и задаётся стартовый лут персонажа. Видим что в стартовом луте прописан фаер и четыре бинта.
itemEnt = player.GetInventory().CreateInInventory("Rag"); - Rag это класснейм предмета (бинта) itemBs.SetQuantity(4); - количество бинтов и т.д. в пачке, коробке и т.д. Эти два блока нам и нужно удалить и заменить на свои.
2) Открываем файл types.xml. В этом файле прописаны класснеймы предметов, имеющихся в игре. Находим нужные и оформляем файл init.c под себя. Добавим, например, рюкзак, бобы, каску, куртку, штаны и колу:
// рюкзак itemEnt = player.GetInventory().CreateInInventory("AliceBag_Black"); itemBs = ItemBase.Cast(itemEnt); // бобы itemEnt = player.GetInventory().CreateInInventory("BakedBeansCan"); itemBs = ItemBase.Cast(itemEnt); // каска itemEnt = player.GetInventory().CreateInInventory("BallisticHelmet_Black"); itemBs = ItemBase.Cast(itemEnt); // куртка itemEnt = player.GetInventory().CreateInInventory("BomberJacket_Grey"); itemBs = ItemBase.Cast(itemEnt); // штаны itemEnt = player.GetInventory().CreateInInventory("CargoPants_Black"); itemBs = ItemBase.Cast(itemEnt); // кола itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola"); itemBs = ItemBase.Cast(itemEnt); Таким образом, весь файл init.c должен выглядеть примерно так:
Подробности о том как заспавнить оружие с магазинами, машины, предметы и тому подобное написаны в разделе init.c тут:
-
Автор: exploadead
Всем приветы! Облазил много забугорных форумов, решения не нашел, может тут что подскажете:)
На сервере создаётся виртуальный арсенал в ящике... не полный, а заранее настроенный... через BIS_fnc_addVirtualItemCargo и тд. для всей экипировки... Всё норм работает.
Проблема в том, что всем доступна кнопка ЗАГРУЗИТЬ. Таким образом заранее определённый набор в арсенале теряет смысл, т.к. особо умные люди могут предварительно в виртуальном арсенале игры (не заходя на сервер) наделать себе наборы, сохранить их, а на сервере просто загружать через эту кнопку... Получая таким способом запрещенные оружия, форму и предметы...
Так вот кто-нибудь знает как можно отключить эту кнопку в диалоге арсенала на сервере?:)
Заранее всем спасибо!
-
Автор:
Jdinovich
Добрый день,как можно уменьшить спавн ботов патруля какой файл и строчка отвечают за это,а то слишком много их спавнятся и прибегают все к трейдам?
-
-
Наш выбор

Всем привет помогите пожалуйста кто разбираеться что нужно поменять в этом файле чтоб при старте сервера было чаше солнечная погода и чистое небо и сменялся на дождик там например за процес игры,а то сейчас при старте сервера постоянно облока какие то. С меня Огромное спасибо и +
private ["_initialFog", "_initialOvercast", "_initialRain", "_initialWind", "_debug"]; private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_rainIntervalRainProbability", "_windChangeProbability"]; private ["_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumRain", "_maximumRain", "_minimumWind", "_maximumWind", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_forceRainToStopAfterOneRainInterval", "_maxWind"]; if (isNil "_this") then { _this = []; }; if (count _this > 0) then { _initialFog = _this select 0; } else { _initialFog = -1; }; if (count _this > 1) then { _initialOvercast = _this select 1; } else { _initialOvercast = -1; }; if (count _this > 2) then { _initialRain = _this select 2; } else { _initialRain = -1; }; if (count _this > 3) then { _initialWind = _this select 3; } else { _initialWind = [-1, -1]; }; if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // The following variables can be changed to tweak weather behaviour // Minimum time in minutes for the weather (fog && overcast) to change. Must be greater than || equal to 1 && less than || equal to // _maxWeatherChangeTimeMin. When weather changes, it is fog || overcast that changes, not both at the same time. (Suggested value: 10). _minWeatherChangeTimeMin = 15; // Maximum time in minutes for the weather (fog && overcast) to change. Must be greater than || equal to _minWeatherChangeTimeMin. // (Suggested value: 20). _maxWeatherChangeTimeMin = 30; // Minimum time in minutes that weather (fog && overcast) stays constant between weather changes. Must be less than || equal to 0 && // greater than || equal to _minWeatherChangeTimeMin. (Suggested value: 5). _minTimeBetweenWeatherChangesMin = 5; // Maximum time in minutes that weather (fog && overcast) stays unchanged between weather changes. Must be greater than || equal to // _minWeatherChangeTimeMin. (Suggested value: 10). _maxTimeBetweenWeatherChangesMin = 15; // Fog intensity never falls below this value. Must be between 0 && 1 && less than || equal to _maximumFog // (0 = no fog, 1 = pea soup). (Suggested value: 0). _minimumFog = 0; // Fog intensity never exceeds this value. Must be between 0 && 1 && greater than || equal to _minimumFog // (0 = no fog, 1 = pea soup). (Suggested value: 0.8). _maximumFog = 0.1; // Overcast intensity never falls below this value. Must be between 0 && 1 && less than || equal to _maximumOvercast // (0 = no overcast, 1 = maximum overcast). (Suggested value: 0). _minimumOvercast = 0; // Overcast intensity never exceeds this value. Must be between 0 && 1 && greater than || equal to _minimumOvercast // (0 = no overcast, 1 = maximum overcast). (Suggested value: 1). _maximumOvercast = 1; // When raining, rain intensity never falls below this value. Must be between 0 && 1 && less than || equal to _maximumRain // (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0); _minimumRain = 0; // When raining, rain intensity never exceeds this value. Must be between 0 && 1 && greater than || equal to _minimumRain // (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8); _maximumRain = 0.1; // Wind vector strength never falls below this value. Must be greater || equal to 0 && less than || equal to _maximumWind. // (Suggested value: 0); _minimumWind = 0; // Wind vector strength never exceeds this value. Must be greater || equal to 0 && greater than || equal to _minimumWind. // (Suggested value: 8). _maximumWind = 0; // Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will // change every time the weather (fog || overcast) start to change. (Suggested value: 25); _windChangeProbability = 5; // A "rain interval" is defined as "a time interval during which it may rain in any intensity (|| it may not rain at all)". When overcast // goes above 0.75, a chain of rain intervals (defined below) is started. It cycles on until overcast falls below 0.75. At overcast // below 0.75 rain intervals never execute (thus it cannot rain). // Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100 // if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then // lower this value && vice versa. (Suggested value: 50). _rainIntervalRainProbability = 0; // Minimum time in minutes for rain intervals. Must be greater || equal to 0 && less than || equal to _maxRainIntervalTimeMin. // (Suggested value: 0). _minRainIntervalTimeMin = 0; // Maximum time in minutes for rain intervals. Must be greater than || equal to _minRainIntervalTimeMin. (Suggested value: // (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2). _maxRainIntervalTimeMin = (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2; // If set to true, then the rain is forced to stop after one rain interval during which it has rained (use this for example if you only want // small occational cloudbursts ). If set to false, then the rain may stop, but it may also just change intensity for an // immedeate new rain interval. (Suggested value: false). _forceRainToStopAfterOneRainInterval = false; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Don't touch anything beneath this line drn_DynamicWeather_DebugTextEventArgs = []; // Empty "drn_DynamicWeather_DebugTextEventArgs" addPublicVariableEventHandler { drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal; }; /* * Summary: Shows debug text on local client. * Arguments: * _text: Debug text. */ drn_fnc_DynamicWeather_ShowDebugTextLocal = { private ["_minutes", "_seconds"]; if (!isNull player) then { player sideChat (_this select 0); }; _minutes = floor (time / 60); _seconds = floor (time - (_minutes * 60)); diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0)); }; /* * Summary: Shows debug text on all clients. * Arguments: * _text: Debug text. */ drn_fnc_DynamicWeather_ShowDebugTextAllClients = { drn_DynamicWeather_DebugTextEventArgs = _this; publicVariable "drn_DynamicWeather_DebugTextEventArgs"; drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal; }; if (_debug) then { ["Starting script WeatherEffects.sqf..."] call drn_fnc_DynamicWeather_ShowDebugTextLocal; }; drn_DynamicWeatherEventArgs = []; // [current overcast, current fog, current rain, current weather change ("OVERCAST", "FOG" || ""), target weather value, time until weather completion (in seconds), current wind x, current wind z] drn_AskServerDynamicWeatherEventArgs = []; // [] drn_fnc_DynamicWeather_SetWeatherLocal = { private ["_currentOvercast", "_currentFog", "_currentRain", "_currentWeatherChange", "_targetWeatherValue", "_timeUntilCompletion", "_currentWindX", "_currentWindZ"]; _currentOvercast = _this select 0; _currentFog = _this select 1; _currentRain = _this select 2; _currentWeatherChange = _this select 3; _targetWeatherValue = _this select 4; _timeUntilCompletion = _this select 5; _currentWindX = _this select 6; _currentWindZ = _this select 7; // Set current weather values 0 setOvercast _currentOvercast; 0 setFog _currentFog; drn_var_DynamicWeather_Rain = _currentRain; setWind [_currentWindX, _currentWindZ, true]; // Set forecast if (_currentWeatherChange == "OVERCAST") then { _timeUntilCompletion setOvercast _targetWeatherValue; }; if (_currentWeatherChange == "FOG") then { _timeUntilCompletion setFog _targetWeatherValue; }; }; if (!isServer) then { "drn_DynamicWeatherEventArgs" addPublicVariableEventHandler { drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal; }; waitUntil {!isNil "drn_var_DynamicWeather_ServerInitialized"}; drn_AskServerDynamicWeatherEventArgs = [true]; publicVariable "drn_AskServerDynamicWeatherEventArgs"; }; if (isServer) then { drn_fnc_DynamicWeather_SetWeatherAllClients = { private ["_timeUntilCompletion", "_currentWeatherChange"]; _timeUntilCompletion = drn_DynamicWeather_WeatherChangeCompletedTime - drn_DynamicWeather_WeatherChangeStartedTime; if (_timeUntilCompletion > 0) then { _currentWeatherChange = drn_DynamicWeather_CurrentWeatherChange; } else { _currentWeatherChange = ""; }; drn_DynamicWeatherEventArgs = [overcast, fog, drn_var_DynamicWeather_Rain, _currentWeatherChange, drn_DynamicWeather_WeatherTargetValue, _timeUntilCompletion, drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ]; publicVariable "drn_DynamicWeatherEventArgs"; drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal; }; "drn_AskServerDynamicWeatherEventArgs" addPublicVariableEventHandler { call drn_fnc_DynamicWeather_SetWeatherAllClients; }; drn_DynamicWeather_CurrentWeatherChange = ""; drn_DynamicWeather_WeatherTargetValue = 0; drn_DynamicWeather_WeatherChangeStartedTime = time; drn_DynamicWeather_WeatherChangeCompletedTime = time; drn_DynamicWeather_WindX = _initialWind select 0; drn_DynamicWeather_WindZ = _initialWind select 1; if (_initialFog == -1) then { _initialFog = (_minimumFog + random (_maximumFog - _minimumFog)); } else { if (_initialFog < _minimumFog) then { _initialFog = _minimumFog; }; if (_initialFog > _maximumFog) then { _initialFog = _maximumFog; }; }; 0 setFog _initialFog; if (_initialOvercast == -1) then { _initialOvercast = (_minimumOvercast + random (_maximumOvercast - _minimumOvercast)); } else { if (_initialOvercast < _minimumOvercast) then { _initialOvercast = _minimumOvercast; }; if (_initialOvercast > _maximumOvercast) then { _initialOvercast = _maximumOvercast; }; }; 0 setOvercast _initialOvercast; if (_initialOvercast >= 0.75) then { if (_initialRain == -1) then { _initialRain = (_minimumRain + random (_minimumRain - _minimumRain)); } else { if (_initialRain < _minimumRain) then { _initialRain = _minimumRain; }; if (_initialRain > _maximumRain) then { _initialRain = _maximumRain; }; }; } else { _initialRain = 0; }; drn_var_DynamicWeather_Rain = _initialRain; 0 setRain drn_var_DynamicWeather_Rain; _maxWind = _minimumWind + random (_maximumWind - _minimumWind); if (drn_DynamicWeather_WindX == -1) then { if (random 100 < 50) then { drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind); } else { drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind); }; }; if (drn_DynamicWeather_WindZ == -1) then { if (random 100 < 50) then { drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind); } else { drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind); }; }; setWind [drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ, true]; sleep 0.05; publicVariable "drn_var_DynamicWeather_Rain"; drn_var_DynamicWeather_ServerInitialized = true; publicVariable "drn_var_DynamicWeather_ServerInitialized"; // Start weather thread [_minWeatherChangeTimeMin, _maxWeatherChangeTimeMin, _minTimeBetweenWeatherChangesMin, _maxTimeBetweenWeatherChangesMin, _minimumFog, _maximumFog, _minimumOvercast, _maximumOvercast, _minimumWind, _maximumWind, _windChangeProbability, _debug] spawn { private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumWind", "_maximumWind", "_windChangeProbability", "_debug"]; private ["_weatherType", "_fogLevel", "_overcastLevel", "_oldFogLevel", "_oldOvercastLevel", "_weatherChangeTimeSek"]; _minWeatherChangeTimeMin = _this select 0; _maxWeatherChangeTimeMin = _this select 1; _minTimeBetweenWeatherChangesMin = _this select 2; _maxTimeBetweenWeatherChangesMin = _this select 3; _minimumFog = _this select 4; _maximumFog = _this select 5; _minimumOvercast = _this select 6; _maximumOvercast = _this select 7; _minimumWind = _this select 8; _maximumWind = _this select 9; _windChangeProbability = _this select 10; _debug = _this select 11; // Set initial fog level _fogLevel = 2; _overcastLevel = 2; while {true} do { // Sleep a while until next weather change sleep floor (_minTimeBetweenWeatherChangesMin * 60 + random ((_maxTimeBetweenWeatherChangesMin - _minTimeBetweenWeatherChangesMin) * 60)); if (_minimumFog == _maximumFog && _minimumOvercast != _maximumOvercast) then { _weatherType = "OVERCAST"; }; if (_minimumFog != _maximumFog && _minimumOvercast == _maximumOvercast) then { _weatherType = "FOG"; }; if (_minimumFog != _maximumFog && _minimumOvercast != _maximumOvercast) then { // Select type of weather to change if ((random 100) < 50) then { _weatherType = "OVERCAST"; } else { _weatherType = "FOG"; }; }; // DEBUG //_weatherType = "OVERCAST"; if (_weatherType == "FOG") then { drn_DynamicWeather_CurrentWeatherChange = "FOG"; // Select a new fog level _oldFogLevel = _fogLevel; _fogLevel = floor ((random 100) / 25); while {_fogLevel == _oldFogLevel} do { _fogLevel = floor ((random 100) / 25); }; if (_fogLevel == 0) then { drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * random 0.05; }; if (_fogLevel == 1) then { drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.05 + random 0.2); }; if (_fogLevel == 2) then { drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.25 + random 0.3); }; if (_fogLevel == 3) then { drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.55 + random 0.45); }; drn_DynamicWeather_WeatherChangeStartedTime = time; _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60); drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek; if (_debug) then { ["Weather forecast: Fog " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients; }; }; if (_weatherType == "OVERCAST") then { drn_DynamicWeather_CurrentWeatherChange = "OVERCAST"; // Select a new overcast level _oldOvercastLevel = _overcastLevel; //_overcastLevel = floor ((random 100) / 25); _overcastLevel = 3; while {_overcastLevel == _oldOvercastLevel} do { _overcastLevel = floor ((random 100) / 25); }; if (_overcastLevel == 0) then { drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * random 0.05; }; if (_overcastLevel == 1) then { drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.05 + random 0.3); }; if (_overcastLevel == 2) then { drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.35 + random 0.35); }; if (_overcastLevel == 3) then { drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.7 + random 0.3); }; // DEBUG /* if (overcast > 0.8) then { drn_DynamicWeather_WeatherTargetValue = 0.5; } else { drn_DynamicWeather_WeatherTargetValue = 0.85; }; */ drn_DynamicWeather_WeatherChangeStartedTime = time; _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60); drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek; if (_debug) then { ["Weather forecast: Overcast " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients; }; }; // On average every one fourth of weather changes, change wind too if (random 100 < _windChangeProbability) then { private ["_maxWind"]; _maxWind = _minimumWind + random (_maximumWind - _minimumWind); if (random 100 < 50) then { drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind); } else { drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind); }; if (random 100 < 50) then { drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind); } else { drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind); }; if (_debug) then { ["Wind changes: [" + str drn_DynamicWeather_WindX + ", " + str drn_DynamicWeather_WindZ + "]."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients; }; }; call drn_fnc_DynamicWeather_SetWeatherAllClients; sleep _weatherChangeTimeSek; }; }; // Start rain thread if (_rainIntervalRainProbability > 0) then { [_minimumRain, _maximumRain, _forceRainToStopAfterOneRainInterval, _minRainIntervalTimeMin, _maxRainIntervalTimeMin, _rainIntervalRainProbability, _debug] spawn { private ["_minimumRain", "_maximumRain", "_forceRainToStopAfterOneRainInterval", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_rainIntervalRainProbability", "_debug"]; private ["_nextRainEventTime", "_forceStop"]; _minimumRain = _this select 0; _maximumRain = _this select 1; _forceRainToStopAfterOneRainInterval = _this select 2; _minRainIntervalTimeMin = _this select 3; _maxRainIntervalTimeMin = _this select 4; _rainIntervalRainProbability = _this select 5; _debug = _this select 6; if (rain > 0) then { drn_var_DynamicWeather_Rain = rain; publicVariable "drn_var_DynamicWeather_Rain"; }; _nextRainEventTime = time; _forceStop = false; while {true} do { if (overcast > 0.75) then { if (time >= _nextRainEventTime) then { private ["_rainTimeSec"]; // At every rain event time, start || stop rain with 50% probability if (random 100 < _rainIntervalRainProbability && !_forceStop) then { drn_var_DynamicWeather_rain = _minimumRain + random (_maximumRain - _minimumRain); publicVariable "drn_var_DynamicWeather_rain"; _forceStop = _forceRainToStopAfterOneRainInterval; } else { drn_var_DynamicWeather_rain = 0; publicVariable "drn_var_DynamicWeather_rain"; _forceStop = false; }; // Pick a time for next rain change _rainTimeSec = _minRainIntervalTimeMin * 60 + random ((_maxRainIntervalTimeMin - _minRainIntervalTimeMin) * 60); _nextRainEventTime = time + _rainTimeSec; if (_debug) then { ["Rain set to " + str drn_var_DynamicWeather_rain + " for " + str (_rainTimeSec / 60) + " minutes"] call drn_fnc_DynamicWeather_ShowDebugTextAllClients; }; }; } else { if (drn_var_DynamicWeather_rain != 0) then { drn_var_DynamicWeather_rain = 0; publicVariable "drn_var_DynamicWeather_rain"; if (_debug) then { ["Rain stops due to low overcast."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients; }; }; _nextRainEventTime = time; _forceStop = false; }; if (_debug) then { sleep 1; } else { sleep 10; }; }; }; }; }; [_rainIntervalRainProbability, _debug] spawn { private ["_rainIntervalRainProbability", "_debug"]; private ["_rain", "_rainPerSecond"]; _rainIntervalRainProbability = _this select 0; _debug = _this select 1; if (_debug) then { _rainPerSecond = 0.2; } else { _rainPerSecond = 0.03; }; if (_rainIntervalRainProbability > 0) then { _rain = drn_var_DynamicWeather_Rain; } else { _rain = 0; }; 0 setRain _rain; sleep 0.1; while {true} do { if (_rainIntervalRainProbability > 0) then { if (_rain < drn_var_DynamicWeather_Rain) then { _rain = _rain + _rainPerSecond; if (_rain > 1) then { _rain = 1; }; }; if (_rain > drn_var_DynamicWeather_Rain) then { _rain = _rain - _rainPerSecond; if (_rain < 0) then { _rain = 0; }; }; } else { _rain = 0; }; 3 setRain _rain; sleep 3; }; };Поделиться сообщением
Ссылка на сообщение
Поделиться на других сайтах