Как написать скрипт для dayz
File Setup
You will require official DayZ Tools where the Workbench tool is located and a way to unpack PBOs, using either the WorkDrive to unpack all the PBOs to your P:\ drive (recommended) or manually extract the script .pbo files (located inside your steam folder, by default C:\Program Files (x86)\Steam\steamapps\common\DayZ\dta\) using the BankRev tool.
P:\ drive with extracted PBOs
Note: For script debugging, only the script.pbo file needs to be extracted, containing the scripts\ folder.
This will allow you to debug the running script.
It is recommended to extract everything as Workbench has additional tools that can help you with modding.
Персональный скин, точка спавна, и сет с лутом при респавне, стартовый лут для всех!
123new опубликовал тему в Версия 1.0 и выше, 8 марта 2019
Скрипт, добавляющий админу сервера возможность указывать для каждого игрока индивидуальный скин спавна, его персональную точку спавна и один из имеющихся на сервере стартовых наборов с лутом, которые можно составить самим.Connecting Workbench to DayZ
The DayZDiag_x64.exe is able to act as a client or as a server (with the addition of the -server command line parameter).
It takes all the other parameters like the base executable.
With workbench running, open the Script Editor module.
It has it's own Resource Browser but you can open .c files from the base Resource Browser by double clicking them, which automatically opens the Script Editor and loads the selected file.
When both the diagnostic executable and the Script Editor are running, it should automatically connect them, which will be announced by a brief popup window in the lower right part of your screen.
Now you will be able to see text Output that the diagnostic executable is printing for debug purposes and also debug your code by inserting breakpoints and step through the execution.
Note: If you only want to see the console output, then extracting and loading PBOs is not needed, Script Editor should connect to the diagnostic executable without them, but then only the console output is available.
Basics
Code blocks
Code block is bordered by curly brackets and defines a scope. Variables defined inside scope are accessible only from inside of it.
Program structure
Enfusion script consists of classes and functions. All code must be declared inside a function.
Variables
Variables are defined by type and name.
Functions
Functions are basic feature of Enfusion script. Function declaration consist of return value type, function name and list of parameters.
- Functions can be declared in global scope or inside class declaration
- Function parameters are fixed and typed (cannot be changed during run-time, no variadic parameters)
- Functions can be overloaded
- Keyword 'out' before parameter declaration ensures, that the parameter is passed by reference (you can pass more than one value from a function this way, can be used only in native functions)
- Enfusion script supports default parameter
Comments
Constants
Constants are like variables but read only. They are declared by const keyword.
Создайте аккаунт или войдите в него для комментирования
Вы должны быть пользователем, чтобы оставить комментарий
Script Breakpoints
You can pause the script execution when it reaches a certain line in the script by inserting a Breakpoint - locate the line you are interested in and then by pressing F9 a red dot should appear to the left, indicating the execution will stop once it reaches that line.
If a yellow exclamation mark in a red circle appears instead, it means that that line of code is never really executed and the script will not stop there.
When the script reaches the indicated line, it will pause it's execution and show you where by a yellow arrow.
Basic controls and what you can do now are displayed in the top menu under Debug option. Here you also have to switch to the Debug Server option if you want to debug the script running on the server.
Note: You can also add and remove Breakpoints by left clicking where the red dots appear. Right clicking adds a blue Bookmark - these don't have any inherent function except marking script in interesting places so you can then easily navigate to them.
Создаем свой серверный мод. [DayZ 1.4 to Discontined]
123new опубликовал тему в Версия 1.0 и выше, 9 июля 2019
В данной теме я распишу возможность создания серверного мода для сервера на собственном примере и объясню как его собрать.Object-oriented programming specifics
- All member functions and variables are public by default. You can use 'private' or 'protected' keyword to control access
- Class member functions are virtual and can be overriden by child class
- Use override keyword for overriding base class methods(to avoid accidental overriding)
- Class can inherit from one parent class using keyword 'extends'
- Objects are not initialized and destroyed automatically, use 'new' and 'delete' (or 'autoptr' feature)
- Class variables are cleared to default values upon creation
Inheritance
Constructor & Destructor
Constructor and destructor are special member functions
- Every class can have one constructor and one destructor
- Constructor is function called when object is created(by 'new') and has same name as class ( e.g. 'void ClassName()' )
- Destructor is called when object is going to be destroyed (by 'delete'/'autoptr') and has same name as class with tilde character at beginning ( e.g. 'void
Managed class & pointer safety
- Since script does not do garbage collecting automatically, all plain pointers are considered unsafe
- All classes inherited from Managed class work soft links instead of plain pointers. Soft link is weak reference that does not keep the object alive and is zeroed upon their destruction so they are never invalid
- All objects available in game module should be Managed, so they should be using soft links by default (they all inherits from Managed class)
Automatic Reference Counting
Enforce Script has support of automatic reference counting. In a spirit of flexibility, you can choose if your class should or shouldn't be managed, by choosing to inherit from Managed class.
Simple "C++" like classes remains an option for high performance, but less secure scripts
- objects referenced by plain C pointers
- no automatic memory management, owner must delete them
For common gameplay scripts/mods/etc there are managed objects, which are
- slightly slower (due indirect weak pointer object accessing)
- internally ref-counted and automatically deleted when not needed
- objects referenced by weak pointers (pointer is always valid or NULL, never points to deleted memory etc.)
Strong and weak references
- strong reference increases reference count - holds object alive
- weak reference just pointing to an object, but doesn't increase reference count
In the code above at the end of function main, object 'a' has zero strong references thus is deleted, destructor releases m_child, and so the object 'b' also has zero strong references and it is deleted.
Usage of ref keyword
In the Enforce script by default all variables are weak references, ref keyword is marking that variable is strong reference. In some special cases, variables are strong references by default
- local variables inside functions
- function arguments
- function return value
and are released after their scope ends.
While an object is stored in at least one strong reference, it's being kept alive. When the last strong reference is destroyed or overwritten, the object is destroyed and all other (only weak refs left) references are set to NULL. When an object is deleted manually by delete command (e.g., 'delete a;'), it is deleted immediately ignoring reference count, and all references (weak and strong) are set to NULL.
Optimal usage of references in Enforce script is to have exactly one strong reference per object, placed in "owner" object who creates it. This way of usage ensures
- no cyclic references
- proper order of object destruction - object is destroyed when its "creator" is destroyed
[Enscript] Учимся основам скриптинга
Dayz транспорт
Статус NOT BANNED означает, что вы МОЖЕТЕ заспавнить предмет, но вам или дадут бан, или у вас не получится
DayZ - означает то что вы можете заспавнить, и этот предмет также можно найти в игре Dayz.
Operators
Operator Priority: Priority of operators is similar to C language, more info.
Arithmetic Operators
Operation | Symbol |
---|---|
Add | + |
Subtract | - |
Multiply | * |
Divide | / |
Modulo | % |
Assignments
Operation | Symbol |
---|---|
Assign value to variable | = |
Increment variable by value | += |
Decrement variable by value | -= |
Multiply variable by value | *= |
Divide variable by value | /= |
Bitwise-OR by value | |= |
Bitwise-AND by value | &= |
Left-shift variable by value | <<= |
Right-shift variable by value | >>= |
Increment variable by 1 | ++ |
Decrement variable by 1 | -- |
Relational (conditional)
Operation | Symbol |
---|---|
More than value | > |
Less than value | < |
More or equal to the value | >= |
Less or equal to the value | <= |
Equal | == |
Not equal | != |
Others
Script Overriding
Index Operator
Overriding the index operator can be achieved through the Set and Get methods. You can have any number of overloads as long as there is no ambiguity with the types.
Note: If you want to assign a pre-parsed vector with instance[index] = "1 1 1" the setter needs to accept a string as _value parameter and convert it explicitly using _value.ToVector() before an assignment.
Modding
Modded class
Modded class is used to inject inherited class into class hierarchy without modifying other scripts, which is required for proper modding:
Filepatching
Filepatching allows you to work with unpacked data, saving you the need to repack your pbo every time you make a change.
It works by loading your packed mod in a standard fashion while at the same time using -filePatching launch parameter and having unpacked data present in your steam DayZ folder.
If such data is found, the existing data from the packed mod will be patched by the unpacked data.
- You need to pack your unpacked data at least once - this packed version will be used when launching the game with -mod=Mod parameter.
If you add/remove additional files, you will have to repack the pbo as well
- Your folder with unpacked data needs to be present in your steam DayZ root folder ( path\Steam\steamapps\common\DayZ )
- Structure of the unpacked folder has to be the same as the packed pbo, including the prefix - If your pbo named MyMod is in P:\Mods\MyMod\. and is built with Mods\MyMod prefix then your unpacked data have to be present in path\DayZ\Mods\MyMod\. as well
- Your DayZDiag_x64.exe has to be launched with -filePatching (both client and server)
- If in multiplayer environment (DayZDiag_x64.exe with -server launch parameter), you will need to have allowFilePatching = 1; setting in serverDZ.cfg
Workbench Setup
Launch the Workbench from Dayz Tools\Bin\Workbench\workbenchApp.exe or using the tool launcher.
From the top menu, navigate to "Workbench -> Options" and point the Source Data directory to where you have your data extracted, ideally just P:\
After confirming it will prompt for a restart (let it), after which you should be able to see the project structure in the Workbench Resource Browser just as they appear on your P:\ drive.
Читы для Dayz
В этой статье вы узнаете как читерить в Dayz, спавнить вещи и некоторые интересные факты о Dayz.
В статье написаны все Id предметов и сказано, как ими пользоваться, как можно добыть вещи за 1 секунду, а также есть полезная программа (skriptexecuter2 + Коробки) для создании скриптов, с помощью которой вы сможете сделать себе в игре то, что вы хотите. Здесь вы увидите многое, чего нет на других сайтах. Информация была отредактирована и усовершенствована. К стандартным спискам скриптов добавлены те предметы, которых явно не хватает в игре, и убраны те, что могут мешать
Control Structures
Conditional structures
If statement
Switch statement
Switch statement supports switching by numbers, constants and strings.
Iteration structures
The for loop consists of three parts: declaration, condition and increment.
Foreach
Simpler and more comfortable version of for loop.
While
Types
Primitive Types
Type name | Range | Default Value |
---|---|---|
int | from -2,147,483,648 to +2,147,483,647 | 0 |
float | from ±1.401298E-45 to ±3.402823E+38 | 0.0 |
bool | true or false | false |
string | - | "" (empty string) |
vector | see float | (0.0,0.0,0.0) |
void | - | - |
Class | - | null |
typename | - | null |
Strings
- Strings are passed by value, like primitive types
- Can be concatenated by + operator
- Strings are initialized and destroyed automatically
- Strings can contain standardized escape sequences. These are supported: \n \r \t \\ \"
Vectors
- Vectors are passed by value, like primitive types
- Vector values are accessible by [, ] operator, like static arrays
- Vectors are initialized and destroyed automatically
- Vector can be initialized by three numeric values in double quotes e.g. "10 22 13"
Objects
- Objects in enforce script are references and are passed by reference
- All member functions and variables are public by default. Use 'private' keyword to make them private
- 'autoptr' keyword before object variable declaration ensures that compiler automatically destroys the object when the scope is terminated (e.g. function call ends)
Example of this & super:
Enums
Enumerators are set of named constant identifiers.
- enums have int type
- enum item value can be assigned in definition, otherwise it is computed automatically (previous item value plus one)
- enum can inherit from another enum (item value continues from last parent item value)
- enum name used as type behaves like ordinary int (no enum value checking on assign)
Templates
Enfusion script has template feature similar to C++ Templates, which allows classes to operate with generic types.
- Generic type declaration is placed inside <, > (e.g. "class TemplateClass<class GenericType>" )operators after template class name identifier
- Enfusion script supports any number of generic types per template class
Arrays
Static Arrays
- Arrays are indexed from 0
- Arrays are passed by reference, like objects
- Static arrays are initialized and destroyed automatically
- Size of static arrays can be set only during compilation time
- Elements are accessible by array access operator [ ]
Dynamic Arrays
- Dynamic arrays support change of size at runtime by inserting/removing array items
- Dynamic arrays are provided through 'array' template class
- Dynamic arrays are passed by reference
- Dynamic Arrays are objects and therefore they must be created and destroyed like objects, so don't forget to use "autoptr" or delete operator!
- Elements are accessible by "Get" function or by array access operator [ ]
- There are already defined typedefs for primitive type arrays:
- array<string> = TStringArray
- array<float> = TFloatArray
- array<int> = TIntArray
- array<class> = TClassArray
- array<vector> = TVectorArray
Automatic type detection
The variable type will be detected automatically at compile time when the keyword auto is used as placeholder.
Advanced Configuration
Additional configuration options are possible using the dayz.gproj file in the Workbench directory
FileSystem allows you to specify path where workbench looks for data which is needed for browsing files and creating ScriptModulePaths.
This is the source data directory which you are setting in workbench options, so path to your P: is not necessary if you have set it there instead.
Be aware of prefixes! When launching Workbench with -mod=YourUnpackedMod parameter to set the ScriptModulePaths automatically, FileSystemPath is used as part of the final path.
This means that if your mod folder is located inP:\OtherMods\MyMod
and it's ScriptModulePath in config.cpp is
MyMod/scripts/etc
then your file system has to point to
OR the path in config.cpp has to be updated to
OtherMods/MyMod/scripts/etc
in order to create correct full path(FileSystemPath+ScriptModulePath) which will work in Script Editor.
ScriptModules are paths which are required for script editor functionalities. They are automatically set when you launch Workbench with a -mod=YourUnpackedMod parameter, only set these if you require a custom setupDebugging Modded Scripts
You need to load your modded scripts into Workbench if you want to debug them.
Run workbenchApp.exe with
-mod=pathToFolder\YourModFolder;pathToFolder\YourOtherModFolder
If done correctly, after opening the Script Editor you should see all your .c mod files in the Script Editor Resource Browser, in the root of the module that you are modding.
So for example if you are modding the Mission module using class missionScriptModule in your config.cpp, all your scripts should appear directly under Mission(scripts/5_Mission) in the Script Editor. You should also be able to find them using the search functions of the script editor.Note: You can still use your own folder structure/custom folders inside the script module path in whatever way you want, since the script does not care where the files are placed beside them being in a correct script module.
With the above example, placing the scripts in a scripts/5_Mission/ModdedScripts might help with a visibility while sorting in workbench.
You will also need to have your packed mod properly loaded in the game, which means launching the DayZDiag_x64.exe with
-mod=pathToFolder/YourPackedModFolder
Make sure that your packed mod folder has identical data as your unpacked mod folder loaded into workbench.
If they are not the same, breakpoints might not work at all.
For debugging with unpacked data, see Filepatching below.
If you are debugging in a multiplayer environment (DayZDiag_x64.exe with -server launch parameter), you may need to change some of the following settings in serverDZ.cfgУвеличение карты х2
vitacite опубликовал тему в Картостроение, 6 октября 2020
Доброго времени суток комрады. После успешного портирования карты 2048 на 2048 ProvingGrounds, решил исполнить свою "детскую мечту" и сделать ее большой ;)))) С этой целью для начала я решил увеличить ее в два раза.О проекте S-Platoon
. На нашем сайте вы сможете найти множество гайдов по установке различных дополнений и скриптов для DayZ EPOCH, DayZCC, а так же таких модов как DayZ Origins, Overpoch, Overwatch, Epidemic и ARMA3: DayZ EPOCH, гайды по ARMA3: Exile, ARMA3: Altis Life, админский софт, античиты и различные программы для упрощения работы с серверами и модами, дополнения для карты Черноруси, Napf и остальных, а так же всегда сможете задать интересующий вас вопрос в разделе помощи по серверам.
Будущее проекта S-Platoon
Наш проект имеет огромные амбиции, а команда портала делает всё что бы помочь пользователям и не дать угаснуть идее. Мы всем сердцем хотим развиваться и не стоять на месте. Именно наш настрой, а так же дружелюбный коллектив пользователей форума является первым шагом и фундаментом к дальнейшей работе и развитию.--> Первостепенным направлением проекта является создание серверов DayZ Standalone и создание серверов DayZ мода. На нашем сайте вы сможете найти множество гайдов по установке различных дополнений и скриптов для DayZ EPOCH, DayZCC, а так же таких модов как DayZ Origins, Overpoch, Overwatch, Epidemic и ARMA3: EPOCH, гайды по ARMA3: Exile, ARMA3: Altis Life, админский софт, античиты и различные программы для упрощения работы с серверами и модами, дополнения для карты Черноруси, Napf и остальных, а так же всегда сможете задать интересующий вас вопрос в разделе помощи по серверам.
Войти
Наш выбор
Keywords
Function/method modifiers
Keyword Description private The method can be called only from inside of the same class method protected The method can be called only from inside of class method or methods of its extended classes static The method can be called without object pointer, just by className.methodName() , only static members of the same class can be accessed from inside of static method override Compiler checks if is method present in base class and if method signature match proto Prototyping of internal function (C++ side) native Native call convention of internal function (C++ side) Variable modifiers
Keyword Description private Variable can be accessed only from inside of class methods. Mutually exclusive with "protected" protected Variable can be accessed only from inside of class methods or methods of its extended classes. Mutually exclusive with "private" static Variable can be accessed without object pointer, using className.variable autoptr Modifier for variables of class pointer type. Pointer target will be automatically destroyed upon end of variable lifetime (end of scope or deletion of class which contains it) proto Prototyping of internal function (C++ side) ref Variable is a strong reference const Constant, cannot be modified out Modifier for function parameters, variable will be changed by a function call inout Modifier for function parameters, variable will be used and then changed by a function call Class modifiers
Keyword Description modded Inheritance-like behaviour for modding Other keywords
Keyword Description new Create new object instance delete Destroy object instance class Class declaration extends Class inheritence typedef Type definition return Terminates function & returns value (if specified) null null value this Address of the object, on which the member function is being called super Refers to the base class for the requested variable/function thread Declared before the function call, runs the function on a new thread DayZ:Workbench Script Debugging
Using the diagnostic version of the game executable (DayZDiag_x64.exe), it is possible to connect Workbench tool to a running instance of the game client/server and break and debug it's execution.
Создать аккаунт
Зарегистрируйтесь для получения аккаунта. Это просто!
Читайте также: