Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
We welcome contributions, even tiny one, by anyone who wants to share knowledge with NativeDB.
You can leave a trace of your passage by adding your username below (Discord, Nexus or GitHub). You can increment a counter each time you make a change request if you wish.
In alphabetical order, many thanks to:
manavortex
psiberx
Rayshader · x12
rfuzzo
RollermineC · x1
roms1383 · x12
Seijax · x1
void*
When Codeware is installed, you can use this function without issues. Otherwise, you may need to get [GameInstance] through other functions like [GameObject.GetGame] for example.
This function will only work when the game engine is initialized, meaning a [GameInstance] do exists.
Use this function to write in logs, along with [FTLogWarning] and [FTLogError].
See wiki for more about logging.
See [FTLog] instead.
This guide describes how documentation should be written. It also explains what should be documented or not, and why.
The goal of this documentation is to share acquired knowledge about the codebase. It is not useful to document every single class and functions of this entire codebase.
Guidelines below are not hard rules that you must absolutely and always follow. The purpose is to give you (and contributors) a common ground to start from.
One big rule is to add documentation when a class / a function is not explicit.
For example, the name of the class is not clear for someone who only played the game. In this case it is useful to add a sentence describing that Prevention means NCPD / the police.
DO add documentation to describe a behavior that is not already explicit.
DON'T add documentation about a class like , only to say "Class of the player".
DON'T add documentation about a function like , only to say "Return true when player is moving, false otherwise".
One phrase, one idea.
Reading is hard, keep it as short as possible. Below are patterns you can reuse to structure your comment:
When a general description is somehow required and useful to provide context.
Short description (up to 3 phrases).
Elaborate description (optional, when short description is not enough to fit knowledge).
Provide related resources / references (optional, when related and newcomers are not aware of it).
Short description (optional).
Argument with description and optionally the default value / a list of known values.
Patterns above are propositions. It is easier as a reader to see and read documentation when it uses the same format everywhere. It might take a bit of an effort to get used to it as a writer.
This documentation is not about showing how to use a snippet of code: be it in Redscript, Lua or else. In this spirit, writing code in the documentation should be avoided. If it is deemed really useful, it should be as short as possible.
More than often, people played the game and knows about the vocabulary it uses. It is preferable to use game's vocabulary to be on the same page.
For example, it is preferred to tell Prevention is about NCPD. This way, when you document other parts of the game related to Prevention, you can use the keyword NCPD. Others will understand what you're talking about.
A function might need some kind of predefined data as arguments. Think about the CName
type, it is a string-like type but values are not listed like enums. We don't know about them. In this case, a modder will have to dig and search what values the function accepts as a CName
.
If you know all or even only one valid value, you should list them when documenting the function. This way, others know what data to use when they need to call this function too.
If the list of values is very big, use a link instead to reference some Sheet-like document containing all known values.
If the list of values is accessible using WolvenKit, add a note about it and provide the path where to look for the data.
An argument of a function is optional when marked with the opt
prefix. It can be helpful to describe what default value is used. It can look like this:
In this case, you can add the comment "CDPR only". It is short and explicit enough to tell other modders:
There is nothing to see for modding purpose.
After reading this, you should better grasp what you can document and how. Don't hesitate to go through the current documentation. It can be helpful to see how other parts are already documented, to get more familiar with these guidelines.
When behavior is already explicit, but an argument requires a description and more information like a default value, , etc.
is already present to share knowledge about the code and scripting in general. You should share your findings in this space, not in this documentation.
As another example, you can write V when talking about the . It should be explicit for anyone, and is shorter to write than the player.
In the codebase, you can find features that are not related to the gameplay, saves, the world, etc. For example, you should not care nor mess around with the .
An Entity
is essentially a "thing" in the game world. This can be a player character, NPC, vehicle, or an object like a weapon or a door. Each entity has specific attributes, like health, position, and abilities, that define how it behaves and interacts with the environment.
Components: these are smaller parts that make up an entity, such as physics, animations, and behaviors. Components are what give an entity its abilities, like moving, interacting, or taking damage.
Properties: these are data fields that define things like health, speed, size, or position in the world.
Events: entities can send and receive events to trigger actions. For instance, an NPC can trigger an event when it detects the player.
Whether [this.QueueEvent] is currently available or not.
Mark entity for disposal.
Retrieve any component on entity by name.
Retrieve currently applied appearance.
Enqueue event for entity on game's events loop.
Space to store and share documentation of RTTI definitions.
This space stores documentation and is used to show it when browsing RTTI dump using NativeDB.
If you have an issue or feedback to share, come and talk about it on NativeDB@wiki channel.
If you want to contribute, please go to the next guide:
Components in the game define the functionality of various objects and NPCs, such as physics, animations, interactions, and more. IComponent
serves as a base class for all the specific components that can be attached to entities.
Modularity: components can be thought of as modules that add specific functionality to an entity. For example, you could add a physics component to give an object physical interactions with the environment or an AI component to allow an NPC to make decisions.
Reuse: since components are reusable, you can apply the same component to different entities. This makes it easier to add consistent behavior across various objects or NPCs.
Separation of Concerns: each component is responsible for handling a specific aspect of an entity. This makes it easier to focus on one feature at a time (such as movement, interaction, or combat behavior).
Retrieve entity owner.
This guide explains what syntax you can use to format the documentation for NativeDB.
🟢 fully supported
🟠 partially supported
🔴 not supported
Blocks | Markdown | Description | |
---|---|---|---|
Don't hesitate to look at other classes to see how the syntax is used, and how it looks like in NativeDB. If you are not sure, you can always come and ask on Discord.
The following example is only made to show all possible syntax options. There is nothing related to the game:
This guide will give you a tour of everything you need to know to document the codebase of NativeDB.
This space is used to write and store documentation. It will synchronize the data in a GitHub repository. NativeDB get the documentation from this repository to show it when browsing the codebase.
GitHub Api limits free access to 60 requests per hour. It doesn't require you to login with a GitHub account from NativeDB. It should be good enough for now.
If you never used GitBook before, you'll see that it is easy to use after learning some basics. to learn you're way around.
NativeDB provides buttons to quickly open GitBook in the right place:
NativeDB expects a custom format and structure to get the data from GitBook, and to show it as beautifully as possible. You first need to learn a few rules, you can start with this guide. It will also explain some guidelines on what to write or not when documenting.
Now that you made a change request, wrote some documentation, you can request a review. An administrator will check it, and if it is alright, merge your change request.
NativeDB will store the documentation in your browser as a cache. It helps improve performance and it reduces the usage of the network's bandwidth. It will only refresh the list of documented classes every 10 minutes (to see if there are changes to update locally). If NativeDB is already open, it will not show your last merged change request. You can wait up to 10 minutes or hit F5
to refresh your tab.
Thank you for your contributions!
If you get lost, If you think a guide lack information, If you think a guide is not clear enough, If you have any other feedback to share,
Please do reach us on Discord in the NativeDB@wiki channel.
Responsible for managing all audio-related functionality within the game. This system controls everything from background music and sound effects to character dialogue and environmental sounds.
Game sounds can be browsed and listened to on .
Sounds can be replaced with , with predefined .
If you need more control over how sounds can be played in-game, you might want to consider .
Play a sound by its event name, optionally specifying an entity as emitter with its name.
Emitter name is used with chatters and subtitles.
Stop a previously played sound, optionally defined on an entity with specific name.
Switch from one sound to another, optionally specifying an entity as emitter with its name.
Whether entity's voice (a.k.a voiceover) can be heard from where player stands.
Allows creating custom callbacks to use in-game with [DelaySystem].
If you're looking to trigger callbacks outside of game sessions, see for custom events.
Method which gets automatically called after delay, see [DelayCallback] and [DelaySystem.DelayCallbackNextFrame].
Paragraph
🟢
Some text
Basic block to show text.
Code
🟢
`content`
Useful to highlight arguments of a function.
Note: it doesn't support complex code block with a language (like ```lua ```
).
URL
🟢
[label](https://)
You can add URL link with a label. URL must starts with https://
.
Lists
🟠
- Item A
- Item B
1. Item 1
2. Item 2
You can add ordered lists, unordered lists and tasks lists. In all cases, they will be visible as unordered lists using -
as a prefix.
Note: you must not add newlines per item. It is not supported for now and formatting will not work as expected in NativeDB.
Markdown example will look like this: - Item A - Item B - Item 1 - Item 2 - Item T - Item D
Bold / Italic
🔴
**bold**
*italic*
Headers
🔴
# H1 ## H2 ### H3
Hint
🔴
{% hint %} {% endhint %}
Class reference
🟢
[ClassName]
Write the native name / alias name of a class between brackets ([]
). NativeDB will automatically format it as a link to navigate to the class.
Property reference
🟢
[this.prop] [ClassName.prop]
When documenting a class, you can reference its own properties using this.
followed by the name of the property.
You can also reference properties of other classes using ClassName.
instead of this.
.
It must be surrounded by brackets ([]
) in both cases.
Function reference
🟢
[this.GetStuff] [ClassName.SetStuff]
When documenting a class, you can reference its own functions using this.
followed by the name of the function.
You can also reference functions of other classes using ClassName.
instead of this.
.
It must be surrounded by brackets ([]
) in both cases.
Enum / Bitfield reference
🟢
[Enum.Value] [Bitfield.Value]
You can reference value of an enum and value of a bitfield.
Allows to schedule callbacks, events or system requests in various ways. Time / delay is expressed in seconds.
callback is triggered only once, but nothing prevents from rescheduling it manually at your convenience.
callback will not get triggered when set over a certain delay (like 1 or 3 minutes), but nothing prevents from rescheduling while keeping track of how long has elapsed, with a timestamp (see [TimeSystem]).
[DelayID] can be kept around to interrupt a running callback, event or tick anytime (see [this.CancelDelay], [this.CancelEvent] and [this.CancelTick]). You can also check how long remains before being eventually called (see [this.GetRemainingDelayTime]).
timeToDelay
: delay duration in seconds.
isAffectedByTimeDilation
: whether callback will be slowed down based on current active time dilation (e.g. when time slows during Sandevistan).
More info and code snippets there.
Supports any class inheriting from [Event], including custom ones.
More info and code snippets there.
How long remains before associated callback, event or tick gets called.
More info and code snippets there.
You can get a list of [IMappin], see the function provided by Codeware.
Allows triggering callbacks on [ScriptableSystem].
Prefer [DelayCallback] whenever possible.
More info and code snippets there.
Cancel currently running request.
A GameObject
is any in-game item or structure that the player or NPCs can interact with. This includes things like weapons, doors, vending machines, lootable containers, and even some environmental elements.
name
(of action) is allowed but using known object (e.g. [PlayerPuppet]) as listener
is a source of potential issues. Mods should always declare and use a custom listener object, like in this example.
Used by functions of [TargetingSystem], to specify the parameters for searches of targets.
[this.testedSet] decides the shape of the area of the search (in the limits of [this.maxDistance]). [TargetingSet.Frustum] covers the whole cone of vision of the instigator. [TargetingSet.Visible] and [TargetingSet.ClearlyVisible] additionally require differing degrees of line-of-sight. [TargetingSet.Complete] covers a sphere around the instigator.
[this.searchFilter] identifies the nature of the objects that will qualify for the search. See REDmod script resources for examples of currently used filters, like [TSF_NPC].
Only available in-game, and re-created on each load.
See Codeware ScriptableService if you need to add logic outside of game sessions.
Whether session was restored (e.g. on save load), or not (e.g. on new game).
Whether saving is currently disabled or not (e.g. during combat).
Automatically called when attached to game session (e.g. on save load).
Automatically called when detached from game session (e.g. on exit to main menu).
Automatically called when restoring game session (e.g. on save load).
Blackboard is a kind of shared data storage and a framework to access/notify/listen to the data in the storage. Similar to a real blackboard, [GameObject]s put their data on the board ([IBlackboard]). Other objects can observe, react to and update the data.
Blackboard uses a key-value pattern to store data. Keys are defined through a [BlackboardDefinition]. You can know what keys (ids) a [IBlackboard] is using with its corresponding [BlackboardDefinition]. A list of known definitions can be found in [AllBlackboardDefinitions].
See also this post on StackExchange.
Known relative paths for fontFamilyPath
, in root path base\gameplay\gui\fonts\
:
foreign\chinese_traditional\ar_fang_xing_run_yuan\ar_fang_xing_run_yuan.inkfontfamily
foreign\arabic\ara_es_nawar\ara_es_nawar.inkfontfamily
arame\arame.inkfontfamily
arial\arial.inkfontfamily
blender\blender.inkfontfamily
digital_readout\digitalreadout.inkfontfamily
industry\industry.inkfontfamily
foreign\chinese_traditional\jing_xi_heig_b5\jing_xi_heig_b5.inkfontfamily
foreign\chinese\jing_xi_heig\jing_xi_heig.inkfontfamily
foreign\korean\kbiz_go\kbiz_go.inkfontfamily
foreign\japanese\mgenplus\mgenplus.inkfontfamily
foreign\korean\nanum_square\nanum_square.inkfontfamily
orbitron\orbitron.inkfontfamily
foreign\thai\printable4u\printable4u.inkfontfamily
foreign\russian\raj_rus.inkfontfamily
raj\raj.inkfontfamily
foreign\japanese\smart_font_ui\smart_font_ui.inkfontfamily
foreign\thai\th_sarabun_new\th_sarabun_new.inkfontfamily
This call is not enough to redraw the widget with the new font style. You can trigger a redraw by calling another function too, for example using SetText
or SetFontSize
with the same current value.
fontStyle
values are unique per font family, you can find them in .inkfontfamily
files using WolvenKit. List of known values: Regular
, Light
, Medium
, Heavy
, Semi-Bold
, Bold
, Extra Bold
, Italic
, Bold Italic
, Black
, Demi
, Book
, Book Italic
.
Represents non-player characters (NPCs) in the game.
These are the characters that the player interacts with but doesn't directly control, such as enemies, civilians, vendors, and allies.
AI Behaviors: contains the logic for how NPCs think and act. This includes things like combat AI (how an enemy attacks, seeks cover, or flees), daily routines (what civilians do during the day), and response behaviors (like reacting to gunfire or the player's presence).
Factions: NPCs can belong to factions (e.g., gangs or corporate groups), and this affects how they interact with other factions and the player. You can adjust faction relationships, which influences whether NPCs are hostile, friendly, or neutral.
See of Codeware to learn more about creating a UI. You should install too. It provides a powerful InkInspector
tool to help you design a UI while in-game.
Bind a style to a property of a widget, based on the current theme of the game. You must define a style resource using [this.SetStyle], otherwise this function will have no effect.
Example to use the red color of the game on a widget: BindProperty(n"tintColor", n"MainColors.Red")
.
You must define an .inkstyle
file to use [this.BindProperty]. When you add a widget with a script, this call is required on each widget you create.
A common styleResPath
used to define colors is: r"base\\gameplay\\gui\\common\\main_colors.inkstyle"
. You can see a Json representation of this file on .
You can find other styles using WolvenKit.
Use with everything time-based:
real time
time in V's storyline
REDengine simulation time
time dilation (e.g. when activating Sandevistan)
Time elapsed in V's storyline.
Real time, as a .
REDengine simulation time.
Whether V or NPCs are currently using time dilation (usually via cyberware, e.g. Sandevistan).
Convert from real-time seconds to game time.
See wiki of Codeware for more about ResRef.
Value is meaningless as-this. You can convert the value to KPH or MPH by replicating the code from script car_hud.
Dispatched throughout game session to trigger gameplay logic, for various purposes:
combat
traffic
...
Event can be dispatched in-game on instances of class inheriting from [Entity].
More info and code snippets there.
If you're looking to dispatch events outside of game sessions, see wiki of Codeware for custom events.
className
must be the native name (Pseudocode). For example, you must use n"entEntity"
instead of n"Entity"
.
See also Safe downcasting to use a straightforward syntax.
Main entry-point to get systems for gameplay / environment / etc.
See the global function [GetGameInstance] which explains how to get a `GameInstance`.
CDPR only.
Get system used to execute callback functions after a delay. It runs functions asynchronously in game loop.
Get elapsed time since the simulation started. Time is reset when navigating between menu and in-game scenes. Time is paused when game is paused (e.g. inventory menu is open).
CDPR only.
Get system used to teleport a [GameObject] to [Vector4] coordinates or to a [NodeRef].
Get system used to change game time, including time dilation.
Get system used to summon vehicles and unlock vehicles in V's garage.
See also [VehicleObject], [VehicleComponent] and [vehicleController] to access more vehicle behaviours.
Known currency values: n"money"
.
Known currency values: n"money"
.
Known currency values: n"money"
.
This guide explains the structure to follow when writing documentation for NativeDB.
One sub-page = one class
One sub-page = one struct
Sub-page of a class or a struct must be within page "CLASSES".
Order sub-pages alphabetically (from A to Z).
It is useful to quickly navigate between classes and to add new classes.
You have to follow a small set of rules to write documentation about a class. The format described below is required to show the documentation in NativeDB.
A minimal example shows you how it should look like with Markdown, at the end of this guide.
Option "Page description" must be turned off in "Page options". You can find the feature when moving your mouse over the title of the page.
Title of the page must be the native name of the class. You can configure code syntax in NativeDB with option Pseudocode · Legacy
to only show native names.
DO write vehicleBaseObject
DON'T write VehicleObject
Add header "Description" using block "Heading 1".
DO write Description
DON'T write anything else, like descriptionS
After this header, you can add content (like a paragraph) to describe useful knowledge about the class. It will be visible like this in NativeDB:
Add header "Functions" using block "Heading 1", if it doesn't exist already. You can then add functions after this header, as described below.
DO write Functions
DON'T write anything else, like Methods
Add a function using block "Heading 3". This header must be the signature of the function using the Pseudocode · Legacy
code syntax.
If the signature of the function is not valid, you're change request will not be merged.
You should use the feature provided by NativeDB to quickly copy the signature of a function in your clipboard. You can do so like this:
As an example with the function FindEntityById
, it will look like this in your clipboard, ready to paste in GitBook:
Like with the description, you can then add content below the header of the function to describe it.
You don't have to write both sections (Description and Functions) when creating a new class. You need to at least add one of the two sections, be it Description or Functions.
When present, the section Description must be at the very top of the page.
You're ready to go on with the next guide: