diff --git a/docs/genome/inventory/index.md b/docs/genome/inventory/index.md new file mode 100644 index 0000000000..0c91e6b8f8 --- /dev/null +++ b/docs/genome/inventory/index.md @@ -0,0 +1,29 @@ +# Inventory + +The `gCInventory_PS` property set manages the inventory of an entity (such as NPC, Hero or chest). +The inventory is a list of inventory stacks (`gCInventoryStack`). +Each inventory stack references a `Template` that is the blueprint for the item contained in the stack. +The `Quality` and `Amount` of the item is also stored as part of the stack. +When an item gets equipped to a slot, a physical object with a 3D mesh, physics, and location is spawned in the world and attached to the holding entity (see `Slot` and `Item`). +The inventory can contain multiple stacks referencing the same template, but with a different quality, equip status or stack type. + +Both the category of an item (`gCItem.Category`) and the stack type with which the item gets inserted into the inventory (see also [Treasure Sets](treasure_sets.md)) control in which contexts an inventory stack is visible and usable: + +- Regular inventory +- Trade inventory +- Plunder inventory +- Skills +- Spellbook +- ... + +## Skills and Spells +The skills and spells that the hero can learn are represented by items in his inventory with the category `gEItemCategory_Spellbook` respectively `gEItemCategory_Skill`. + +The `ActivationCount` of a stack is only relevant for stacks containing skills or spells. Its content is related to the `Learned` flag of the stack, because if `ActivationCount` has a value > 0, the skill or spell is activated for the hero. + +The difference between the two is important: + +- If `Learned` is set to `true`, the hero has permanently learned the skill or spell and can no longer unlearn it. +- The `ActivationCount`, on the other hand, is always increased by 1 when the hero equips an item that grants this skill or spell as a bonus. When the item is unequipped, the counter is decreased by 1 again. If all items are unequipped, the skills are no longer active for the hero. + +Since the hero receives his skills, spells, etc. via code at the start of the game, setting the `ActivationCount` or `Learned` flag for a stack is of no practical use. diff --git a/docs/genome/inventory/treasure_sets.md b/docs/genome/inventory/treasure_sets.md new file mode 100644 index 0000000000..7b42c31877 --- /dev/null +++ b/docs/genome/inventory/treasure_sets.md @@ -0,0 +1,127 @@ +# Treasure Sets + +Treasure Sets are templates (located in `Templates/Treasure`) that are used to define NPC weapon loadouts, NPC plunder/pickpocket/trade inventories, and the contents of chests. +Up to five treasure sets can be assigned to an NPC via the `TreasureSet1` to `TreasureSet5` properties of its `gCInventory_PS` property set. + +## Plunder Inventory + +### gETreasureDistribution_Plunder +```text +TransferStacks = Random selection from the interval [MinTransferStacks, MaxTransferStacks] + +If TransferStacks < 1: + TransferStacks = 1 + +Repeat TransferStacks times: + Stack = Select a random stack from the TreasureSet + + If Stack.Amount > 1: + Amount = Random selection from the interval [Stack.Amount / 2, Stack.Amount] + Otherwise: + Amount = Stack.Amount + + Inventory.Add(Stack.Template, Amount, GetCombinedQuality(Stack), gEStackType_Treasure) +``` + +### gETreasureDistribution_Unique +```text +Stack = Stack with the lowest gold value among all stacks of the TreasureSet that are not yet marked as already generated + +If all stacks are already marked as generated: + Stack = Random stack from the TreasureSet + +If Stack.Amount > 1: + Amount = Random selection from the interval [Stack.Amount / 2, Stack.Amount] +Otherwise: + Amount = Stack.Amount + +Inventory.Add(Stack.Template, Amount, GetCombinedQuality(Stack), gEStackType_Treasure) + +Mark Stack as generated +``` + +### gETreasureDistribution_Trophy +```text +Repeat for each stack: + If Stack.UseType == gEUseType_TrophyTeeth and the player has NOT learned Perk_TrophyTeeth: + Skip stack + + If Stack.UseType == gEUseType_TrophyFur and the player has NOT learned Perk_TrophyFur: + Skip stack + + If Stack.UseType == gEUseType_TrophySkin and the player has NOT learned Perk_TrophySkin: + Skip stack + + Inventory.Add(Stack.Template, Stack.Amount, GetCombinedQuality(Stack), gEStackType_Treasure) +``` + +### gETreasureDistribution_Mining +```text +Repeat for each stack: + If the player has learned Perk_Mining: + Amount = 2 * Stack.Amount + Otherwise: + Amount = Stack.Amount + + Inventory.Add(Stack.Template, Amount, Stack.Quality, gEStackType_Treasure) +``` + +## Trade Inventory + +### gETreasureDistribution_Trade_Generate +```text +TransferStacks = Random selection from the interval [MinTransferStacks, MaxTransferStacks] + +Repeat TransferStacks times: + Stack = Select a random stack from the TreasureSet + + If Stack.Amount > 1: + Amount = Random selection from the interval [Stack.Amount / 2, Stack.Amount] + Otherwise: + Amount = Stack.Amount + + Inventory.Add(Stack.Template, Amount, GetCombinedQuality(Stack), gEStackType_Merchandise) +``` + +### gETreasureDistribution_Trade_Refresh +```text +Repeat for each stack: + If Stack.Amount > 1: + Amount = Random selection from the interval [Stack.Amount / 2, Stack.Amount] + Otherwise: + Amount = Stack.Amount + + Inventory.Add(Stack.Template, Amount, GetCombinedQuality(Stack), gEStackType_Merchandise) +``` + +### gETreasureDistribution_Trade_NotRandom +Each stack is generated into the trade inventory in exactly the specified amount. (see also Modder Handbook 1.7.6) +```text +Repeat for each stack: + Inventory.Add(Stack.Template, Stack.Amount, Stack.Quality, gEStackType_Merchandise) +``` +## Pickpocket Inventory + +### gETreasureDistribution_Pickpocket +```text +Stack = Select a random stack + +Inventory.AddAndEquip(Stack.Template, Stack.Amount, Stack.Quality, gEStackType_Normal) +``` + +## Weaponry + +### gETreasureDistribution_Weaponry +```text +Repeat for each stack: + Quality = Stack.Quality + if ( Stack.UseType != gEUseType_Arrow and Stack.UseType != gEUseType_Bolt ) + Quality |= gEItemQuality_Worn; + Inventory.AddAndEquip(Stack.Template, Stack.Amount, Quality, gEStackType_Normal) +``` + +Min/MaxTransferStacks do not matter for Weaponry treasure sets. The engine simply processes the full list of stacks contained in the TreasureSet. Also note, that only the first Weaponry treasure set is considered. + +If alternative balancing is enabled, once an NPC has been defeated by the hero (`PSNpc::DefeatedByPlayer == true`), that NPC's weaponry is no longer derived from its TreasureSets, but instead the NPC receives a standard weapon that depends on its species (Orc or Human) and political alignment. + + diff --git a/docs/genome/tools/index.md b/docs/genome/tools/index.md index ccf868efcc..44cb36c287 100644 --- a/docs/genome/tools/index.md +++ b/docs/genome/tools/index.md @@ -8,3 +8,16 @@ Piranha Bytes did not release a modkit for their Genome engine, but the modding ## Gothic 3 SDK Georgeto, inspired by NicoDE's Risen SDK, has created an SDK for Gothic 3. It can be used to manipulate the engine in the similar way Union is able to manipulate ZenGin. [GitHub repository](https://github.com/georgeto/gothic3sdk) + +## g3dit +g3dit is a world data editor for Gothic 3 that allows you to view and edit .lrentdat, .node, .tple, and several other file types used by Gothic 3. +[GitHub repository](https://github.com/georgeto/g3dit) +[World of Gothic release thread](https://forum.worldofplayers.de/forum/threads/1330059-Tool-g3dit-Weltdaten-Editor) + +## G3IQ +G3IQ, the Gothic 3 info and quest editor, makes it possible to edit info and quest files, as well as the stringtrable.ini. +[World of Gothic download](https://www.worldofgothic.de/dl/download_502.htm) + +## g3blend +g3blend is a Blender addon to import and export Gothic 3 actors (`.xact`) and animations (`.xmot`). +[GitHub repository](https://github.com/georgeto/g3blend) diff --git a/docs/zengin/anims/.pages b/docs/zengin/anims/.pages index 84b9c152a5..f9fc0a6d68 100644 --- a/docs/zengin/anims/.pages +++ b/docs/zengin/anims/.pages @@ -1,3 +1,5 @@ nav: + - naming.md - ... + - events.md - tutorials \ No newline at end of file diff --git a/docs/zengin/anims/events.md b/docs/zengin/anims/events.md index ed2f2a43b1..9164c407c8 100644 --- a/docs/zengin/anims/events.md +++ b/docs/zengin/anims/events.md @@ -61,10 +61,9 @@ General Syntax: | [eventSFX](#eventsfx) | create sound effect | | [eventSFXGRND](#eventsfxgrnd) | create sound effect on the ground | | [eventTag](#eventtag) | generic event, does action specified in parameters | -| Defined in engine but never used ? | | | [eventPFXGRND](#eventpfxgrnd) | create particle effect on the ground | | [eventSetMesh](#eventsetmesh) | ? | -| [modelTag](#modeltag) | same as eventTag, but applies to morphmesh? | +| [modelTag](#modeltag) | same as eventTag, but applies to all amiations in aniEnum | ### eventCamTremor @@ -125,7 +124,7 @@ Syntax: Both `INTENSITY` and `HOLD_TIME` can be specified in the MMS script. All gothic morph meshes specify those values in .MMS, therefore behavior when both specified in eventMMStartAni and .MMS file is unknown/untested -## eventPfx +### eventPfx Start particle effect at the specified bone. @@ -155,7 +154,7 @@ Syntax: `ATTACH` is used to create demons burning hand during the attack, while without this keyword dust particles are made to stay at the position where NPC landed after falling. -## eventPFXStop +### eventPFXStop Stops particle effect previously started by [eventPfx](#eventpfx) @@ -177,7 +176,7 @@ Syntax: `PFX_HANDLE` - an integer value. *Handle* of the particle effect, that should be destroyed. Particle effect must be spawned using the same handle by [eventPfx](#eventpfx) first -## eventSwapMesh +### eventSwapMesh Move mesh from source `NODE` to target node. Item should be present in the node already. Only mesh of the Items is moved, engine internally still keeps a reference to items in the original slot? Never used in game? @@ -201,7 +200,7 @@ Syntax: !!! Note In some rare occasions duplicates item -## eventSfx +### eventSfx Play sound effect. It can be either `SFX` instance from scripts, or `.WAV` file. @@ -230,7 +229,7 @@ Syntax: A lot of original game animations contain `EMTPY_SLOT` instead of `EMPTY_SLOT` which was probably unintended. Gothic therefore acts as no keyword was provided, which causes a lot of sound interruptions. Therefore be mindful of spelling when copying original MDS scripts -## eventSfxGrnd +### eventSfxGrnd the same as [eventSfx](#eventsfx) with only one difference, the sound effect name is appended with the current material name. @@ -263,7 +262,7 @@ Depending on the material of the texture, the character is standing on, the game NPC running on grass texture, with material set to EARTH in world editor, will play sound `Run_Earth` by using `*eventSFXGrnd (12 "Run")` in run animation. `_Earth` suffix is determined and added by the engine. -## eventTag +### eventTag This is a generic type of event that does different actions based on the first parameter after the frame parameter. It was probably later in development to extend MDS functionality without the need to expand parser itself. All parameters except `FRAME` are passed inside quotes Further parameters are specific for every `EVENT_TAG_TYPE`. @@ -848,27 +847,25 @@ ani ("s_1hAttack" 1 "s_1hAttack" 0.0 0.1 M. "Hum_1hAttackComboT3_M05.asc +### eventPfxGrnd - -## eventPfxGrnd - -Not used anywhere in the original game. Could possibly spawn particle effect like [eventPfx](#eventpfx) but with an added suffix similar to how [eventSfxGrnd](#eventsfxgrnd) works. Needs to be investigated. +Not used anywhere in the original game. Probably meant to spawn particle effect like [eventPfx](#eventpfx) but with an added suffix similar to how [eventSfxGrnd](#eventsfxgrnd) works. In practice, it does nothing. Syntax: ```dae *eventPFXGRND (FRAME) ``` -## eventSetMesh +### eventSetMesh Unknown Syntax: ```dae -*eventSETMESH (FRAME "NODE_NAME") +*eventSETMESH (FRAME "ASC_NAME") ``` -## modelTag +### modelTag Should work similarly to [eventTag](#eventtag), but can be defined inside aniEnum block and applies to all animations of the Model. diff --git a/docs/zengin/anims/index.md b/docs/zengin/anims/index.md index dcfeebb98f..21e7f943da 100644 --- a/docs/zengin/anims/index.md +++ b/docs/zengin/anims/index.md @@ -1,50 +1,93 @@ # Animation +Animations in ZenGin consist of animation files and animation scripts. Working with them requires deep understanding of the architecture and concepts. This section provides information necessary to effectively work with animations within the engine. +## Types +There are two main types of animations - `skeletal` and `morphmesh`. Skeletal animations are used for animating characters and objects with a skeleton, while morph mesh animations are used for animating facial expressions and other models that require vertex-based deformations. -# Animations in ZenGin -Animations are (apart from maybe advanced programming work using Ikarus or Union) one of the most advanced modding techniques, since you not only must understand the way they work, but also know how to write the animation script and understand the whole scheme selection system, naming convention and of course know how to animate (that is my biggest problem :D). To get a new animation into ZenGin (the Gothic engine) is not difficult per se, I would describe it as tedious. +## Formats -Luckily, there are tools to help us to achieve our goal - get a new animation to be used by the engine, and in effect, to be used and seen in the game. +### Raw -To describe the whole process, I constructed this small tutorial, to help other people to get animations working and to spare them many hours of searching the excellent forum posts, that describe parts of the process. -__ +**Animation files** -Excluding advanced programming work with Ikarus or Union, animations are arguably the most advanced modding discipline of ZenGin engine. Its difficulty stems for the fact that you not only have to understand the general concept, but also learn how to write the animation scripts and understand the whole scheme selection system, including naming conventions and, most important for last - actually know how to animate. Adding new animations into ZenGin is more tedious than actually difficult. +ZenGin uses the `.ASC` file format for raw animation files. Following things could be saved as the `.ASC` file: -There are tool to help with this endeavor - to get a new animation implemented in the engine, and seeing its effects in game. Following tutorial has been constructed to help others to get their animations working without having to scour old forum posts for hours. +- Animation model (skeleton + skin or morph mesh) +- Actual animation data (keyframes) +- Animation targets (like doors, beds etc.) -## Prerequisites - Tools & Materials -1. Gothic Mod Development Kit (MDK) - - Gothic 1 MDK - [link](https://github.com/PhoenixTales/gothic-devkit) - - Gothic 2 MDK - [link](https://www.worldofgothic.de/dl/download_94.htm) -2. [Blender](https://www.blender.org/) -3. [Kerrax's Import Export plugin](https://gitlab.com/Patrix9999/krximpexp) - follow the installation instructions to install the plugin, make sure to set up the texture paths too -4. Tool for decompiling animations [GothicSourcer](https://worldofplayers.ru/threads/41942/), or use [phoenix](https://github.com/lmichaelis/phoenix) or write your own using [ZenLib](https://github.com/Try/ZenLib) +The `.ASC` files can be imported into blender using the [KrxImpExp](#krximpexp) add-on. +**Script files** -## The workflow -This is the basic step-by-step workflow on how to get the animation into the game. +Every animated model in ZenGin has its own animation script file with the `.MDS` extension for skeleton based models and `.MMS` for morph mesh based models. These files are used to define animation data. You can find more about these files in the [MDS](mds.md) and [MMS](mms.md) sections. -1. Load the actor (character or object) into your 3D software -2. Create your animation -3. Export the animation as an `.asc` file -4. Write the MDS file -5. Run the game to compile your animations -6. Test your animations in-game using a Daedalus script or a console command +### Compiled +Raw formats are great for editing, but can be a bit heavy for the engine use (ASCII based formats are slower to parse and work with), because of that ZenGin compiles these animations into various internal formats. -Sounds simple enough, except there is a lot missing. Even though the steps start with loading the actor into blender, understanding the system of animations to get high quality assets into your mod is more important. +| Format | Extension | Content | +|--------|-----------|-------------| +| Model Animation | `.MAN` | Single animation data | +| Model Hierarchy | `.MDH` | Skeletal structure and slots for a model | +| Model Mesh | `.MDM` | Softskin mesh and proto mesh structure for a model | +| Model | `.MDL` | `.MDH` + `.MDM` combined | +| Model Script | `.MSB` | Compiled version of the `.MDS` file | +| Morph Mesh | `.MMB` | Morph mesh with its mesh and animation data | -## Animation "types" -There are two main types of animations - `skeletal` and `morphmesh` animations. Character body animations are skeletal, and we animate the skeleton and the entire model (skin) moves around it. Morph mesh animation is, on the other hand, used for facial animations such as eating, blinking or talking and for animated meshes like wave water ferns or fish in Khorinis' harbor. -This guide focuses on skeletal animations. There are few different ones, all of which will have their own demonstration in the future. Categories are: -1. Standalone animation - waving, bowing, eating -2. MOBSI animations - bed, alchemy table, anvil -3. Item animations - sweeping the floor with a broomstick, using the horn, playing the lute -4. Mandatory animations - running, walking, sneaking -5. Combined/interpolated animations - picking stuff up, aiming with a bow/crossbow +## Engine compilation +By default, animations are compiled by the engine when the model appears in the game or a game is started with `-zconvertall` parameter. -All of these animations are defined in an MDS file which will be talked about in the next sections. +!!! Danger + If you want to recompile animations, make sure that the `.MSB` or `.MMS` files are deleted, including the ones in the VDF volumes, otherwise the engine will not recompile them. + +### Graphical overview + +A star `*` means that multiple files could be used/generated. + +
+ +=== "Skeletal Animation" + ``` mermaid + flowchart TD + A[Model .ASC] --> D(Compilation) + B[Animation .ASC *] --> D + C[Model Script .MDS] --> D + D --> E[Compiled Model Script .MSB] + D --> F[Model Animation .MAN *] + D --> G[Model Hierarchy .MDH] + D --> H[Model Mesh .MDM] + ``` + + +=== "Morph Mesh Animation" + ``` mermaid + flowchart TD + A[Model .ASC] --> D(Compilation) + B[Animation .ASC *] --> D + C[Morph Mesh Script .MMS] --> D + D --> E[Morph Mesh .MMB] + ``` + +
+ + +## Tools + +### KrxImpExp +Blender add-on that implements support for Gothic 3D formats. + +[:fontawesome-brands-gitlab: GitLab](https://gitlab.com/Patrix9999/krximpexp) + +### Gothic Sourcer +Tool for decompiling animation files. + +[:octicons-arrow-right-24: Read more](../tools/gothic_sourcer.md) + +### ZenKit +C++ Library for loading and saving various ZenGin files (including some animation formats). + +[:octicons-arrow-right-24: Read More](../tools/libraries/zenkit.md) diff --git a/docs/zengin/anims/mds.md b/docs/zengin/anims/mds.md index 228f4bff12..d65d353a13 100644 --- a/docs/zengin/anims/mds.md +++ b/docs/zengin/anims/mds.md @@ -2,66 +2,78 @@ title: MDS ModelScript --- -# MDS - model animation script +# MDS - Model Script +Model script[^1] is a file describing what skeleton should be used, what body meshes work with this set of animations and how should the animations be named, how fast they run, what animation is supposed to start after the current one is finished and much more. -!!! Tip - The MDS syntax is very simple and scripts can be edited in any text editor. It is, however, easier to work in an editor with a proper syntax highlighting. [Daedalus Language Server](https://github.com/kirides/vscode-daedalus/releases)'s dev branch already merged the MDS grammar for syntax highlighting, we can expect it in the next release. - -Model animation script is a file describing what skeleton should be used, what body meshes work with this set of animations and how should the animations be named, how fast they run, what animation is supposed to start after the current one is finished and much more. These files are located in `Gothic\_work\DATA\Anims\` directory. - -Whilst the code seems long and terrifying, it is in fact rather simple, and this guide will try to explain it whole. - -!!! hint "Don't forget to use the search" - If you search this file for `t_Yes`, you will get an example of the first type of animation - "standalone" +!!! Info + If you are unfamiliar with the animation naming conventions, please read the [naming conventions](naming.md) article first. - To play the animation in game you use this console command `play ani t_yes`. +## Syntax +The MDS file consists of blocks and commands. Blocks are wrapped in curly braces `{}` and commands are single lines that end with a newline character. - ![type:video](https://www.youtube.com/embed/aOyuGVWDefc) +**Comments** +Comments start with `//` and continue to the end of the line. +```dae +// This is a comment +``` -## Syntax and keywords - -Let us get a quick look at the naming convention to get a basic idea what is going on before we start. - -The first letter indicates a type of animation (transition - `t_` - or state - `s_`). -Then depending on the animation type we have: +!!! Tip + The MDS syntax is very simple and scripts can be edited in any text editor. It is, however, easier to work in an editor with a proper syntax highlighting. [vscode-daedalus](../tools/daedalus_tools/daedalus_language_server.md) extension for Visual Studio Code supports MDS syntax highlighting. -**Transition animation** -``` -t_Run_2_Sneak -``` -Transition animation from the run animation to the sneak animation. -``` -t_BSANVIL_Stand_2_S0 +## Model +The whole script is wrapped in the `Model` block. It defines the name of the model this script belongs to. +```dae +Model ("MODEL_NAME") +{ + //... +} ``` -Transition animation for the blacksmith's anvil from standing to state 0. -**State animation** -``` -s_Run -``` -State animation for the looping animation. +### meshAndTree +This command defines the source file for the model mesh and skeleton in the neutral pose. +```dae +meshAndTree ("ASC_NAME" DONT_USE_MESH) ``` -s_BSANVIL_S0 +**Parameters** + +`ASC_NAME` - name of the source file +`DONT_USE_MESH` - optional parameter, if specified the mesh from the source file is not used, only the skeleton. This is used for humans and creatures, since different meshes could use the same skeleton. + +### registerMesh +This command registers a body mesh that can be used with this model (e.g armor or clothing). +```dae +registerMesh ("ASC_NAME") ``` -State animation for the blacksmith's anvil and its first state. +**Parameters** -### ani -This is the main command you will be using while defining new animations. +`ASC_NAME` - name of the source file -Example: +### aniEnum +This block contains all the animations for this model. ```dae -ani ("t_Yes" 2 "" 0.1 0.1 M. "Hum_Yes_M01.asc" F 1 44) +aniEnum +{ + //... +} ``` -Syntax: + +--- +#### ani +This is the main command for defining an animation. ```dae -ani (ANI_NAME LAYER NEXT_ANI BLEND_IN BLEND_OUT FLAGS ASC_NAME ANI_DIR START_FRAME END_FRAME) +ani ("ANI_NAME" LAYER "NEXT_ANI" BLEND_IN BLEND_OUT FLAGS "ASC_NAME" ANI_DIR START_FRAME END_FRAME) ``` -`ani` - is a keyword, we are defining new animation +!!! Info + Inside the `ani` command [animation events](events.md) could be used. -Let's describe all the parameters +!!! Example + ```dae + ani ("t_Yes" 2 "" 0.1 0.1 M. "Hum_Yes_M01.asc" F 1 44) + ``` +**Parameters** -`ANI_NAME` - animation name, we use it in Daedalus as animation identifier +`ANI_NAME` - animation name, used in scripts and code as identifier There is a naming convention, that is recommended and sometimes required to be used. @@ -87,7 +99,7 @@ If we set it to 0.5, it takes 0.5 seconds for this animation to take full effect - **F** - the engine ignores height coordinate - doesn't keep the model "glued" to the ground (falling/flying animation) - **I** - specifies idle animation - breathing, standing with a drawn weapon and moving the weapon -`ASC_NAME` - name of the source file exported from Blender +`ASC_NAME` - name of the source file `ANI_DIR` - direction of the animation @@ -98,17 +110,32 @@ If we set it to 0.5, it takes 0.5 seconds for this animation to take full effect `END_FRAME` - on what frame from the source file the animation ends -### aniAlias -Generally considered as one of the most useful commands, `aniAlias` is used to create an alias (hard link for UNIX users) for an already defined animation. +**Additional parameters** -Example: -```dae -aniAlias ("t_Sneak_2_Run" 1 "s_Run" 0.0 0.1 M. "t_Run_2_Sneak" R) -``` -Syntax: +Some additional parameters could be specified at the end of the command, these are optional and not used in all animations. + +`FPS:XX` - sets the frames per second for this animation + +`SPD:XX` - sets the speed multiplier + +`CVS:XX` - sets the collision volume scale + +!!! Example + ```dae + ani ("s_Run" 1 "s_Run" 0.0 0.0 M. "Hum_Run_M01.asc" F 1 30 FPS:30 CVS:0.1) + ``` + +--- +#### aniAlias +Command to create an alias (hard link for UNIX users) for an already defined animation. ```dae -aniAlias (ANI_NAME LAYER NEXT_ANI BLEND_IN BLEND_OUT FLAGS ALIAS_NAME ANI_DIR) +aniAlias ("ANI_NAME" LAYER "NEXT_ANI" BLEND_IN BLEND_OUT FLAGS "ALIAS_NAME" ANI_DIR) ``` +!!! Example + ```dae + aniAlias ("t_Sneak_2_Run" 1 "s_Run" 0.0 0.1 M. "t_Run_2_Sneak" R) + ``` +**Parameters** `ANI_NAME` - name of the new animation @@ -133,32 +160,162 @@ aniAlias ("t_Sneak_2_Run" 1 "s_Run" 0.0 0.1 M. "t_Run_2_Sneak" R) ``` In this example we are defining `t_Sneak_2_Run` animation and we are specifying that the animation after this one is finished will be `s_Run` and that it is being made by reversing animation `t_Run_2_Sneak` by specifying the `R` flag. -### aniBlend -AniBlend is used to define animations that are a result of blending of two animations. This animation is not animated by hand, but it is dynamically generated by the engine during run-time. +--- +#### aniBlend +Command to define animations that are a result of blending of two animations. This animation is not animated by hand, but it is dynamically generated by the engine during run-time. -Example +Syntax: ```dae -aniBlend ("t_RunR_2_Run" "s_Run" 0.2 0.2) +aniBlend ("ANI_NAME" "NEXT_ANI" BLEND_IN BLEND_OUT) ``` -Syntax: + +!!! Example + ```dae + aniBlend ("t_RunR_2_Run" "s_Run" 0.2 0.2) + ``` +**Parameters** + +`ANI_NAME` - name of the new animation + +`NEXT_ANI` - name of the next animations + +`BLEND_IN` - time in seconds describing animation blending at the start + +`BLEND_OUT` - time in seconds describing animation blending at the end + +--- +#### aniComb +Command that defines an animation that is created by interpolating several animations with an equal number of frames. ```dae -aniBlend (ANI_NAME NEXT_ANI BLEND_IN BLEND_OUT) +aniComb ("ANI_NAME" LAYER "NEXT_ANI" BLEND_IN BLEND_OUT FLAGS "ANI_PREFIX" NUM_ANI) ``` +!!! Example + ```dae + ani ("c_bow_1" 4 "" 0.1 0.1 .. "bow_shoot.asc" F 41 41) + ani ("c_bow_2" 4 "" 0.1 0.1 .. "bow_shoot.asc" F 43 43) + ani ("c_bow_3" 4 "" 0.1 0.1 .. "bow_shoot.asc" F 47 47) + ani ("c_bow_4" 4 "" 0.1 0.1 .. "bow_shoot.asc" F 49 49) + + aniComb ("s_bow_aim" 1 "s_bow_aim" 0.1 0.1 M. "c_bow_" 4) + ``` + + In this example, `aniComb` creates the `s_bow_aim` animation by combining four preceding `ani` phases (`c_bow_1` to `c_bow_4`). Each phase uses the same source file but different frame ranges. + +**Parameters** `ANI_NAME` - name of the new animation +`LAYER` - layer the animation is on + `NEXT_ANI` - name of the next animations `BLEND_IN` - time in seconds describing animation blending at the start `BLEND_OUT` - time in seconds describing animation blending at the end +`FLAGS` - flags, that describe animation behavior + +`ANI_PREFIX` - prefix of the animations to combine + +`NUM_ANI` – number of previous `ani` commands to combine + + +--- +#### aniMaxFPS +Sets the default maximum frame rate for all animations, if not specified, the default value (25 FPS) is used. +```dae +aniMaxFPS (FPS_VALUE) +``` +**Parameters** + +`FPS_VALUE` - maximum frames per second -### aniSync -Not used in the game. +--- +#### aniDisable +Disables an animation, so it is not played by the engine. +```dae +aniDisable ("ANI_NAME") +``` +!!! Bug + This command is broken and doesn't work as expected +**Parameters** -### aniBatch -Not used in the game. +`ANI_NAME` - name of the animation to disable + +--- +#### aniBatch +Command to combine multiple animations into one. When the combined animation is played, all the animations in the batch are played simultaneously. This could be used e.g. to split the upper and lower body animations. +```dae +aniBatch ("ANI_NAME") +{ + *aniBatch ("BATCH_ANI_NAME") + // ... +} +``` +!!! Danger + This command is not used in the game files and might not work as expected. + +!!! Example + ```dae + aniBatch ("t_1h_slash1") + { + *aniBatch ("t_1h_slash1_top") + *aniBatch ("t_1h_slash1_bot") + } + ``` +**Parameters** + +`ANI_NAME` - name of the new animation + +`BATCH_ANI_NAME` - name of the animation to be played in the batch, it must be defined previously in the script + +--- +#### aniSync +Unknown command, never used in the game files. +```dae +aniSync ("ANI_NAME" "NEXT_ANI") +``` + +## Example ModelScript +For a better understanding of the MDS syntax, here is a simple example of a human model script. + +```dae +Model ("HuS") +{ + meshAndTree ("Hum_Body_Naked0.ASC" DONT_USE_MESH) + + registerMesh ("Hum_Body_Naked0.ASC") + registerMesh ("Hum_Body_CookSmith.ASC") + + aniEnum + { + modelTag ("DEF_HIT_LIMB" "zs_RightHand") + + ani ("s_stand" 1 "s_stand" 0.5 0.5 M. "stand_pause2.asc" F 0 -1) + ani ("t_strafe_l" 1 "s_stand" 0.1 0.1 M. "Strafe_Left.asc" F 0 -1) + + aniBlend ("t_stand_2_run" "s_run") + + aniSync ("t_run_2_walk" "s_walk") + + aniAlias ("t_strafe_r" 1 "s_stand" 0.1 0.1 M. "t_strafe_l" R) + + aniBatch ("t_1h_slash1") + { + *aniBatch ("t_1h_slash1_top") + + *aniBatch ("t_1h_slash1_bot") + } + + ani ("t_1h_shield_ready" 5 "" 0.2 0.2 .. "shield_ready.asc" F 0 -1) + { + *eventSwapMesh(13 "zs_Shield" "zs_LeftArm") + } + //... + } + +} +``` ## Animation state machine More complex animations such as MOBSI animations form a state machine - an animation set. @@ -214,3 +371,5 @@ stateDiagram-v2 s_S0 --> t_S0_Try t_S0_Try --> s_S0 ``` + +[^1]: Inspired by the [MDS article](https://worldofplayers.ru/threads/36653/) by VAM. \ No newline at end of file diff --git a/docs/zengin/anims/mms.md b/docs/zengin/anims/mms.md new file mode 100644 index 0000000000..450e497364 --- /dev/null +++ b/docs/zengin/anims/mms.md @@ -0,0 +1,75 @@ +--- +title: MMS MorphMeshScript +--- + +# MMS - Morph Mesh Script +MMS files are used to define morph mesh animations. They are similar to MDS files but simpler in structure. + +## Syntax +The MMS file is a plain text file with a simple syntax. It consists of commands and parameters. + +**Comments** + +Comments start with `//` and continue to the end of the line. +```dae +// This is a comment +``` + +## morphMesh +The whole script is wrapped in the `morphMesh` block. It defines the name of the morph mesh this script belongs to. +```dae +morphMesh ("MORPH_MESH_NAME") +``` +!!! Bug + This command really does nothing and the morph mesh name is taken from the file name itself, but it is good to have it here for consistency with MDS files. + +**Parameters** + +`MORPH_MESH_NAME` - name of the morph mesh this script belongs to, usually the same as the `.ASC` file name. + +### morphRef +Defines the reference mesh for this morph mesh. The reference mesh is the base mesh that contains all the vertices that will be morphed during animations. +```dae +morphRef ("MORPH_MESH_FILE") +``` +**Parameters** + +`MORPH_MESH_FILE` - name of the source `.ASC` file that contains the reference mesh. + +### morphAni +Defines a morph animation. +```dae +morphAni ("ANI_NAME" LAYER BLEND_IN HOLDTIME BLEND_OUT FLAGS "ASC_NAME" START_FRAME END_FRAME SPD) +``` + +!!! Example + ```dae + morphAni ("S_NORMAL" 1 0.1 -1 0.1 L "Bow_Long_01.ASC" 0 0 SPD:25) + ``` + +**Parameters** + +`ANI_NAME` - name of the animation + +`LAYER` - animation layer, probably unused since morph animations can't be combined + +`BLEND_IN` - time in seconds to blend into this animation + +`HOLDTIME` - time in seconds to hold the animation after it has finished, `-1` means to hold indefinitely + +`BLEND_OUT` - time in seconds to blend out of this animation + +`FLAGS` - animation flags, can be a combination of the following: + +- **D** - discontinuity, animation frames are selected randomly +- **L** - loop, animation will loop indefinitely +- **S** - shape animation, the animation represents a complete mesh shape rather than a relative deformation +- **R** - reference mesh, the compiler will check if vertices and polygons of the next animations match the reference mesh + +`ASC_NAME` - name of the source `.ASC` file that contains the animation frames + +`START_FRAME` - starting frame of the animation in the `.ASC` file + +`END_FRAME` - ending frame of the animation in the `.ASC` file + +`SPD` - frames per second, specified as `SPD:XX` \ No newline at end of file diff --git a/docs/zengin/anims/naming.md b/docs/zengin/anims/naming.md new file mode 100644 index 0000000000..1405b2287d --- /dev/null +++ b/docs/zengin/anims/naming.md @@ -0,0 +1,66 @@ +--- +title: Naming conventions +--- +# Animation naming conventions +Animations in ZenGin follow a simple naming convention that helps to identify the purpose of each animation. + +## Type + +The animation prefix indicates a type of animation. + +### State +`s_` is used for state animation. It is usually a looping animation that represents a character's state (e.g., standing, walking, running). +``` +s_ +``` +**Examples** + +``` title="Running state animation" +s_Run +``` + +``` title="Blacksmith's anvil state 0 animation" +s_BSANVIL_S0 +``` + +### Transition +`t_` is used for transition animations. These animations are played when transitioning from one state to another. +``` +t__2_ +``` +**Examples** + +``` title="Transition from running to sneaking" +t_Run_2_Sneak +``` + +``` title="Transition for blacksmith's anvil standing to state 0" +t_BSANVIL_Stand_2_S0 +``` + +### Random +`r_` is used for random animations. These are non-looping animations that can be played randomly, often used for idle behaviors or actions. +``` +r_ +``` +**Examples** + +``` title="Random scratching head animation" +r_ScratchHead +``` + + +### Combined + +`c_` is used for parts of combined animation that are later combined with [`aniComb`](mds.md#anicomb) in MDS files +``` +c__ +``` +**Examples** + +``` title="Bow aiming" +c_bow_1 +c_bow_2 +... +s_bowAim <- final animation +``` diff --git a/docs/zengin/general_info/vdfs.md b/docs/zengin/general_info/vdfs.md index 9196accfdd..a911facd91 100644 --- a/docs/zengin/general_info/vdfs.md +++ b/docs/zengin/general_info/vdfs.md @@ -31,12 +31,16 @@ VDF=MyMod.mod MyMod_Textures.mod The community created variety of different modding tools for work with VDFS volumes over the times, such as: -### [GothicVDFS](../tools/vdfs_tools/gothic_vdfs.md) +### GothicVDFS Most popular tool for working with VDFS volumes. Allows viewing, extracting and building `.vdf` and `.mod` archives, and has CLI interface. -### [VDFS Tool](../tools/vdfs_tools/vdfs_tool.md) +[:octicons-arrow-right-24: Read more](../tools/vdfs_tools/gothic_vdfs.md) + +### VDFS Tool New tool for working with VDFS volumes, created to support features introduced by [Union](../union/index.md). Apart from viewing, extracting and building `.vdf` and `.mod` archives, it also supports optimizing and compressing them. +[:octicons-arrow-right-24: Read more](../tools/vdfs_tools/vdfs_tool.md) + ### Comparison diff --git a/docs/zengin/meshes/index.md b/docs/zengin/meshes/index.md index c63669f0b7..fc7021ee24 100644 --- a/docs/zengin/meshes/index.md +++ b/docs/zengin/meshes/index.md @@ -3,7 +3,7 @@ In 3D graphics, meshes are collections of vertices, edges, and faces that create 3D objects. ZenGin use meshes to create the world model and objects in the world. !!! Info - Not all objects that seem to be a mesh are in the "Meshes" category. Except every animated objects, the animation targets (like beds or doors) also belong to the [Animations](../anims/index.md). + Not all objects that seem to be a mesh are in the "Meshes" category. Except all animated objects, the animation targets (like beds or doors) also belong to the [Animations](../anims/index.md). ## Formats @@ -19,7 +19,10 @@ The 3DS format has some disadvantages when building levels. With very large leve ### Compiled -Source formats are great for editing, but can be a bit heavy for the engine use (ASCII based formats are slower to parse and work with), because of that ZenGin compiles these meshes into internal compiled formats. In the case of the world it is `.MSH` format and in the case of objects in the world it is the `.MRM` (multi resolution mesh) with LOD information. +Source formats are great for editing, but can be a bit heavy for the engine use, because of that ZenGin compiles these meshes into internal compiled formats. In the case of the world it is `.MSH` format and in the case of objects in the world it is the `.MRM` (multi resolution mesh) with LOD information. + +## Engine compilation +By default, `.3ds` files are compiled by the engine when they appear in the game or a game is started with `-zconvertall` parameter. ## Tools diff --git a/docs/zengin/scripts/classes/c_info.md b/docs/zengin/scripts/classes/c_info.md index 0ab5258196..f2d675d48f 100644 --- a/docs/zengin/scripts/classes/c_info.md +++ b/docs/zengin/scripts/classes/c_info.md @@ -3,47 +3,28 @@ title: C_INFO --- # C_INFO Daedalus class -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru). +The `C_INFO` class is used to define dialogues in the game[^1]. - -The `C_INFO` class is used to define dialogues in the game. -## Class definition +## Definition Class definition as it is defined in [`Scripts/Content/_intern/Classes.d`](https://github.com/PhoenixTales/gothic-devkit/blob/48193bef8fd37626f8909853bfc5ad4b7126f176/gothic/_work/data/Scripts/content/_Intern/CLASSES.D#L164) script file. -??? "C_Info Daedalus class" - ```dae - class C_Info - { - var int npc; // npc instance has the dialogue - var int nr; // number of the dialogue (for sorting) - var int important; // should the npc start the dialogue automatically - var func condition; // condition function - var func information; // function called on selecting the dialogue - var string description; // text in the dialogue box - var int trade; // should the dialogue show the trade window - var int permanent; // should the dialogue be permanent or only one time deal - }; - ``` - -## Class members - -| Variable | Type | Description | -|-----------------------------|--------|-------------------------------------------------------------------------------------| -| [npc](#npc) | int | npc instance to have the dialogue | -| [nr](#nr) | int | dialogue order number | -| [important](#important) | int | npc addresses player automatically | -| [condition](#condition) | func | condition function whether the dialogue is shown or not | -| [information](#information) | func | function called on dialogue selection - contains the dialogue lines and other logic | -| [description](#description) | string | text shown in the dialogue box | -| [trade](#trade) | int | is it a trade dialogue | -| [permanent](#permanent) | int | does the dialogue stay after being played once | - +```dae +class C_Info +{ + var int npc; // npc instance has the dialogue + var int nr; // number of the dialogue (for sorting) + var int important; // should the npc start the dialogue automatically + var func condition; // condition function + var func information; // function called on selecting the dialogue + var string description; // text in the dialogue box + var int trade; // should the dialogue show the trade window + var int permanent; // should the dialogue be permanent or only one time deal +}; +``` -## Class member overview -Description of the class member variables. +## Members -### npc +### `int` npc {: .typed .int} Sets what NPC will have this dialogue instance. Set an NPC instance. ```dae instance Info_Diego_Gamestart (C_INFO) @@ -53,7 +34,7 @@ instance Info_Diego_Gamestart (C_INFO) }; ``` -### nr +### `int` nr {: .typed .int} The `nr` member variables determines the order of shown dialogues. Dialogues are ordered in the ascending order - instances with higher `nr` are below instances with lower `nr`. ```dae @@ -67,7 +48,7 @@ instance Info_Diego_Gamestart (C_INFO) !!! Note This is why the end dialogues usually have `nr = 999;` this is the highest number out of any dialogues therefore will always show up at the bottom. (999 is not the highest number the `nr` can store, it is just considered the highest number, as there will hardly be 998 dialogue instances for a single character) -### important +### `int` important {: .typed .int} The `important` member variable determines whether the NPC will automatically address the player or not. - `important = TRUE` - the NPC will address the player @@ -75,13 +56,13 @@ The `important` member variable determines whether the NPC will automatically ad When `important` is set to `TRUE`, the description is not needed since the dialogue is never shown in the dialogue box. !!! Info - If there are multiple important dialogues that satisfy their condition function, they will be played in the order specified by [`nr`](#nr). + If there are multiple important dialogues that satisfy their condition function, they will be played in the order specified by [`nr`](#int-nr). !!! Tip `important` variable is of the type integer, and it is initialized by the engine to the value of `0`. If you do not want your dialogue to be important, you can omit the `important` member variable since it will be initialized to `0` by the engine. -### condition +### `func` condition {: .typed .func} Condition function with signature `func int f()`. If the function returns `TRUE` the dialogue is displayed, if it returns `FALSE` it is not displayed. The function name does not have to follow a particular naming convention, but a naming convention is used throughout all the Gothic scripts: `{DialogueName}_Condition`. === "Conditioned dialogue" @@ -120,13 +101,13 @@ Condition function with signature `func int f()`. If the function returns `TRUE` It is unnecessary to return `FALSE` from dialogue conditions, but in other cases it can very rarely cause subtle bugs. It is thus good practice to always return some value, even if that is `FALSE`. -### information +### `func` information {: .typed .func} The `information` function contains the function name (without double quotes `""` as `func` is a type in Daedalus) that is called when the dialogue option is selected. It contains the lines NPCs will say, items that will be transferred, quests related logic and much more. The function name does not have to follow a particular naming convention, but a naming convention is used throughout all the Gothic scripts: `{DialogueName}_Info`. ```dae --8<-- "info_diego_gamestart.d" ``` -### description +### `string` description {: .typed .string} Specify a string that will be shown in the dialogue window. ```dae @@ -140,7 +121,7 @@ instance DIA_XARDAS_GMC(C_INFO) ![Description](../../../assets/images/c_info_description.png) -### trade +### `int` trade {: .typed .int} If `trade` is set to `TRUE` the trading interface will be launched after the content `information` function is finished. ```dae title="Fisk's trade dialogue" instance Stt_311_Fisk_Trade (C_INFO) @@ -168,20 +149,25 @@ func void Stt_311_Fisk_Trade_Info() !!! Trivia Trade manager has been added to ZenGin not that long before the release of Gothic 1 (as discussed and discovered on [Phoenix the Game Discord server](https://discord.gg/CK4VAR7fpH) with the acquisition of Gothic version `0.94k`). In version 0.94 the trade manager worked quite differently and used a special (nowadays unused) Daedalus class `C_ItemReact`. -### permanent +### `int` permanent {: .typed .int} Dialogues with `permanent = TRUE` do not disappear after the dialogue is played. This is used for dialogues where you ask for directions or flavor dialogues for unnamed NPCs. !!! Bug Frequently used external function `Npc_KnowsInfo` which returns true if the dialogue instance has been played has had a bug in the implementation for a long time. This bug made it impossible to use this function with dialogue instances with `permanent = TRUE` as it would always return `FALSE`. This has been fixed in `Union 1.0m`. -## LeGo + +## Extensions + +### LeGo LeGo implements a lot of useful functions for dialogues. It makes it possible to create [Trialogues](../extenders/lego/applications/trialoge.md) and change NPCs behaviour by [Dialoggestures](../extenders/lego/applications/dialoggestures.md). Moreover, any Daedalus function can be added to NPCs AI queue via the [AI_Function](../extenders/lego/tools/ai_function.md) package. -## zParserExtender +### zParserExtender zParserExtender implements some Quality of Life features for dialogues. More information can be found in [Dialogue constants article](../extenders/zparserextender/syntax_extensions/dialogues.md). -## AF Script Packet +### AF Script Packet Enhanced Info Manager (implemented using Ikarus and LeGo) adds tons of customizations and additional features to dialogues. More information can be found in the [AFSP Enhanced Information Manager article](../extenders/afsp/index.md). -## zMultilogue -[zMultilogue](../../union/plugins/zmultilogue.md) union plugin implements a Multi-NPC dialogue system similar to LeGo's [Trialoge](../extenders/lego/applications/trialoge.md) package. \ No newline at end of file +### zMultilogue +[zMultilogue](../../union/plugins/zmultilogue.md) union plugin implements a Multi-NPC dialog system similar to LeGo's [Trialoge](../extenders/lego/applications/trialoge.md) package. + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_info/1-1-0-33). \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_menu.md b/docs/zengin/scripts/classes/c_menu.md index cf75021448..1105eafcf9 100644 --- a/docs/zengin/scripts/classes/c_menu.md +++ b/docs/zengin/scripts/classes/c_menu.md @@ -4,81 +4,58 @@ title: C_MENU # C_MENU Daedalus class -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) +Class `C_MENU` is responsible for the behavior and properties of the game menus (options, save etc.)[^1]. -Class `C_Menu` is responsible for the behavior and properties of the game menus (options, save etc.). -## Class definition +## Definition Class definition as it is defined in [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d) script file. -??? "C_Menu Daedalus class" - ```dae - class C_Menu - { - var string backPic; // Menu background image - var string backWorld; // Background ZEN-world of the game menu (Not used) - var int posx; // The top left point of the menu on the screen horizontally (X-axis) - var int posy; // The top left point of the menu on the screen vertically (Y-axis) - var int dimx; // Menu width in virtual coordinates - var int dimy; // Menu height in virtual coordinates - var int alpha; // Menu transparency - var string musicTheme; // Music track of the menu - var int eventTimerMSec; // trigger time for the event EVENT_TIMER - var string items[150]; // Menu items - var int flags; // Menu flags - var int defaultOutGame; // Menu item highlighted by default when the game is not running - var int defaultInGame; // Menu item highlighted by default when the game is running - }; - ``` - -## Class members - -| Variable | Type | Description | -|-----------------------------------|--------|-------------------------------------------------------------------------------------| -| [backPic](#backpic) | string | Menu background image | -| [backWorld](#backworld) | string | Background ZEN-world of the game menu (Not used) | -| [posx](#posx) | int | The top left point of the menu on the screen horizontally (X-axis) | -| [posy](#posy) | int | The top left point of the menu on the screen vertically (Y-axis) | -| [dimx](#dimx) | int | Menu width in virtual coordinates | -| [dimy](#dimy) | int | Menu height in virtual coordinates | -| [alpha](#alpha) | int | Menu transparency | -| [musicTheme](#musictheme) | string | Music track of the menu | -| [eventTimerMSec](#eventtimermsec) | int | The timer that triggered the event in seconds | -| [items](#items) | string | Menu items | -| [flags](#flags) | int | Menu flags | -| [defaultOutGame](#defaultoutgame) | int | Menu item highlighted by default when the game is not running | -| [defaultInGame](#defaultingame) | int | Menu item highlighted by default when the game is running | - - -## Class member overview -Description of the class member variables. - -### backPic +```dae +class C_Menu +{ + var string backPic; // Menu background image + var string backWorld; // Background ZEN-world of the game menu (Not used) + var int posx; // The top left point of the menu on the screen horizontally (X-axis) + var int posy; // The top left point of the menu on the screen vertically (Y-axis) + var int dimx; // Menu width in virtual coordinates + var int dimy; // Menu height in virtual coordinates + var int alpha; // Menu transparency + var string musicTheme; // Music track of the menu + var int eventTimerMSec; // trigger time for the EVENT_TIMER event + var string items[150]; // Menu items + var int flags; // Menu flags + var int defaultOutGame; // Menu item highlighted by default when the game is not running + var int defaultInGame; // Menu item highlighted by default when the game is running +}; +``` + +## Members + +### `string` backPic {: .typed .string} `backPic` is just a name of background image of the menu in `.tga` format. -### backWorld -!!! Warning "Deprecated setting" +### `string` backWorld {: .typed .string} +!!! Danger "Deprecated setting" The background world of the game menu in `.ZEN` format. -### posx +### `int` posx {: .typed .int} The horizontal position of the top left point of the menu on the screen, in virtual coordinates. -### posy +### `int` posy {: .typed .int} The vertical position of the top left point of the menu on the screen, in virtual coordinates. -### dimx +### `int` dimx {: .typed .int} Menu width in virtual coordinates. -### dimy +### `int` dimy {: .typed .int} Menu height in virtual coordinates. -### alpha +### `int` alpha {: .typed .int} Menu transparency. Accepts values ​​from 0 to 255. Without the `backPic` property specified, the value of this parameter is ignored. !!! Note Texture transparency can only be adjusted if the texture has an alpha channel. -### musicTheme +### `string` musicTheme {: .typed .string} Music theme of the menu. ```dae instance MENU_MAIN(C_MENU_DEF) @@ -90,7 +67,7 @@ instance MENU_MAIN(C_MENU_DEF) ``` All instances of musical themes are stored in a file [`Scripts/System/Music/MusicInst.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/Music/MusicInst.d) -### eventTimerMSec +### `int` eventTimerMSec {: .typed .int} Defines the trigger time for the event `EVENT_TIMER` in seconds. The list of constants for all menu events is described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L51) @@ -107,7 +84,7 @@ const int EVENT_SEL_PREV = 7; // Select event of the previous menu item const int EVENT_SEL_NEXT = 8; // Select event of the next menu item ``` -### items +### `string` items {: .typed .string} An array of items belonging to this menu. It is possible to use up to 150 items in one menu. The same elements can be used for different menus. The element instance is specified as the value. ```dae @@ -139,7 +116,7 @@ instance MENUITEM_MAIN_NEWGAME(C_MENU_ITEM_DEF) }; ``` -### flags +### `int` flags {: .typed .int} Menu flags. The list of flag constants can be found in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L43) @@ -163,17 +140,18 @@ const int MENU_SHOW_INFO = 64; // Display information at the bottom of - **MENU_ALIGN_CENTER** - Align the menu to the center of the screen. - **MENU_SHOW_INFO** - Display information at the bottom of menu description from menu item `text[1]`. -### defaultOutGame +### `int` defaultOutGame {: .typed .int} The menu item that is highlighted by default when the game is not running. A value of -1 enables automatic selection of the first selectable element. Items with the `~IT_SELECTABLE` flag are not selected. -### defaultInGame +### `int` defaultInGame {: .typed .int} Menu item highlighted by default when the game is running. A value of -1 enables automatic selection of the first selectable element. Items with the `~IT_SELECTABLE` flag are not selected. +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_menu/1-1-0-36). \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_menuitem.md b/docs/zengin/scripts/classes/c_menuitem.md index a8b04deb25..f644d46e88 100644 --- a/docs/zengin/scripts/classes/c_menuitem.md +++ b/docs/zengin/scripts/classes/c_menuitem.md @@ -3,89 +3,46 @@ title: C_MENU_ITEM --- # C_MENU_ITEM Daedalus class +Class `C_MENU_ITEM` describes the elements of the game menu (sliders, checkboxes, buttons, etc.)[^1]. -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) - -Class `C_Menu_Item` describes the elements of the game menu (sliders, checkboxes, buttons, etc.) . -## Class definition +## Definition Class definition as it is defined in [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d) script file. -??? "C_Menu_Item Daedalus class" - ```dae - CONST INT MAX_USERSTRINGS = 10; - CONST INT MAX_ITEMS = 150; - CONST INT MAX_EVENTS = 10; - CONST INT MAX_SEL_ACTIONS = 5; - CONST INT MAX_USERVARS = 4; +```dae +class C_Menu_Item +{ + var string fontName; // Font of the menu item + var string text[10]; // Text of the interface element + var string backPic; // Background image of menu items + var string alphaMode; // Transparency blending mode of menu items + var int alpha; // Transparency of the menu item + var int type; // Type of the interface element + var int onSelAction[5]; // Array of commands executed when selecting the menu item + var string onSelAction_S[5]; // Arguments for commands specified in the onSelAction property + var string onChgSetOption; // Gothic.ini file parameter modified by this menu item + var string onChgSetOptionSection; // Section of the Gothic.ini file where the modified parameter is located + var func onEventAction[10]; // Call the required function by a constant identifier + var int posx; // Top-left point of the menu item on the screen horizontally (X-axis) + var int posy; // Top-left point of the menu item on the screen vertically (Y-axis) + var int dimx; // Width of the menu item in virtual coordinates + var int dimy; // Height of the menu item in virtual coordinates + var float sizeStartScale; // Initial size of the item. Not used + var int flags; // Flags of the menu item + var float openDelayTime; // Delay before opening the item. Not used + var float openDuration; // Opening time. Not used + var float userFloat[4]; // Digital settings of menu items + var string userString[4]; // String settings of menu items + var int frameSizeX; // Text offset inside the frame on the X-axis + var int frameSizeY; // Text offset inside the frame on the Y-axis + var string hideIfOptionSectionSet; // Section of Gothic.ini file where the option determining the display of this menu item is located + var string hideIfOptionSet; // Gothic.ini file parameter determining the display of this menu item + var int hideOnValue; // Value of the Gothic.ini file parameter at which this interface element is not displayed +}; +``` - class C_Menu_Item - { - var string fontName; // Font of the menu item. - var string text[MAX_USERSTRINGS]; // Text of the interface element. - var string backPic; // Background image of menu items. - var string alphaMode; // Transparency blending mode of menu items. - var int alpha; // Transparency of the menu item. - var int type; // Type of the interface element. - var int onSelAction[MAX_SEL_ACTIONS]; // Array of commands executed when selecting the menu item. - var string onSelAction_S[MAX_SEL_ACTIONS]; // Arguments for commands specified in the onSelAction property. - var string onChgSetOption; // Gothic.ini file parameter modified by this menu item. - var string onChgSetOptionSection; // Section of the Gothic.ini file where the modified parameter is located. - var func onEventAction[MAX_EVENTS]; // Call the required function by a constant identifier. - var int posx; // Top-left point of the menu item on the screen horizontally (X-axis). - var int posy; // Top-left point of the menu item on the screen vertically (Y-axis). - var int dimx; // Width of the menu item in virtual coordinates. - var int dimy; // Height of the menu item in virtual coordinates. - var float sizeStartScale; // Initial size of the item. Not used. - var int flags; // Flags of the menu item. - var float openDelayTime; // Delay before opening the item. Not used. - var float openDuration; // Opening time. Not used. - var float userFloat[MAX_USERVARS]; // Digital settings of menu items. - var string userString[MAX_USERVARS]; // String settings of menu items. - var int frameSizeX; // Text offset inside the frame on the X-axis. - var int frameSizeY; // Text offset inside the frame on the Y-axis. - var string hideIfOptionSectionSet; // Section of Gothic.ini file where the option determining the display of this menu item is located. - var string hideIfOptionSet; // Gothic.ini file parameter determining the display of this menu item. - var int hideOnValue; // Value of the Gothic.ini file parameter at which this interface element is not displayed. - }; - ``` +## Members -## Class members - -| Property | Type | Description | -|---------------------------------|--------|-------------------------------------------------------------------------| -| [fontName](#fontname) | string | Font of the menu item. | -| [text](#text) | string | Text of the interface element. | -| [backPic](#backpic) | string | Background image of menu items. | -| [alphaMode](#alphamode) | string | Transparency blending mode of menu items. | -| [alpha](#alpha) | int | Transparency of the menu item. | -| [type](#type) | int | Type of the interface element. | -| [onSelAction](#onselaction) | int | Array of commands executed when selecting the menu item. | -| [onSelAction_S](#onselaction_s) | string | Arguments for commands specified in the onSelAction property. | -| [onChgSetOption](#onchgsetoption) | string | Gothic.ini file parameter modified by this menu item. | -| [onChgSetOptionSection](#onchgsetoptionsection) | string | Section of the Gothic.ini file where the modified parameter is located. | -| [onEventAction](#oneventaction) | Func | Call the required function by a constant identifier. | -| [posx](#posx) | int | Top-left point of the menu item on the screen horizontally (X-axis). | -| [posy](#posy) | int | Top-left point of the menu item on the screen vertically (Y-axis). | -| [dimx](#dimx) | int | Width of the menu item in virtual coordinates. | -| [dimy](#dimy) | int | Height of the menu item in virtual coordinates. | -| [sizeStartScale](#sizestartscale) | float | Initial size of the item. Not used. | -| [flags](#flags) | int | Flags of the menu item. | -| [openDelayTime](#opendelaytime) | float | Delay before opening the item. Not used. | -| [openDuration](#openduration) | float | Opening time. Not used. | -| [userFloat](#userfloat) | float | Digital settings of menu items. | -| [userString](#userstring) | string | String settings of menu items. | -| [frameSizeX](#framesizex) | int | Text offset inside the frame on the X-axis. | -| [frameSizeY](#framesizey) | int | Text offset inside the frame on the Y-axis. | -| [hideIfOptionSectionSet](#hideifoptionsectionset) | string | Section of Gothic.ini file where the option determining the display of this menu item is located. | -| [hideIfOptionSet](#hideifoptionset) | string | Gothic.ini file parameter determining the display of this menu item. | -| [hideOnValue](#hideonvalue) | int | Value of the Gothic.ini file parameter at which this interface element is not displayed. | - -## Class member overview - -Description of the class member variables. - -### fontName +### `string` fontName {: .typed .string} `*.TGA` file defining the font of the displayed text of the menu item. To create a color change effect, two fonts are needed: @@ -95,12 +52,12 @@ To create a color change effect, two fonts are needed: This creates a highlighting effect. -### text +### `string` text {: .typed .string} Text inside a menu item. -Used to determine possible values ​​for game settings. See [onChgSetOptionSection](#onchgsetoptionsection). +Used to determine possible values ​​for game settings. See [onChgSetOptionSection](#string-onchgsetoptionsection). -Also used to display hints about the item at the bottom of the menu when the `MENU_SHOW_INFO` [flag](#flags) is set. +Also used to display hints about the item at the bottom of the menu when the `MENU_SHOW_INFO` [flag](#int-flags) is set. ```dae // Text displayed in the element @@ -118,7 +75,7 @@ text[0] = "off|on"; text[1] = "Start a new adventure"; ``` -### backPic +### `string` backPic {: .typed .string} Background image of the menu item in `*.TGA` format. ```dae @@ -128,8 +85,8 @@ instance MENUITEM_MAIN_NEWGAME(C_MENU_ITEM_DEF) } ``` -### alphaMode -Texture transparency blending mode. Used in conjunction with the [alpha](#alpha) property. This parameter's value is ignored if the [backPic](#backpic) property is not specified. +### `string` alphaMode {: .typed .string} +Texture transparency blending mode. Used in conjunction with the [alpha](#int-alpha) property. This parameter's value is ignored if the [backPic](#string-backpic) property is not specified. **Supported modes:** @@ -151,13 +108,13 @@ Texture transparency blending mode. Used in conjunction with the [alpha](#alpha) - `MUL` and `MUL2` Multiplies the alpha channel of the texture by the background. -### alpha -Menu element transparency. Accepts values ​​from 0 to 255. Without specifying the [backPic](#backpic) property, the value of this parameter is ignored. +### `int` alpha {: .typed .int} +Menu element transparency. Accepts values ​​from 0 to 255. Without specifying the [backPic](#string-backpic) property, the value of this parameter is ignored. -The alpha channel rendering mode is determined using the [alphaMode](#alphamode) property. +The alpha channel rendering mode is determined using the [alphaMode](#string-alphamode) property. -### type -Interface element type. Some interface elements have their own settings determined by the [userFloat](#userfloat) and [userString](#userstring) properties. +### `int` type {: .typed .int} +Interface element type. Some interface elements have their own settings determined by the [userFloat](#float-userfloat) and [userString](#string-userstring) properties. Constants for menu item types are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L18-L25). @@ -176,13 +133,13 @@ CONST INT MENU_ITEM_LISTBOX = 7; // Frame Undefined element type. Not used in scripts. - `MENU_ITEM_TEXT` - Menu item type "Text". Text can be multiline by setting the `IT_MULTILINE` [flag](#flags). + Menu item type "Text". Text can be multiline by setting the `IT_MULTILINE` [flag](#int-flags). - `MENU_ITEM_SLIDER` Menu item type "Slider". Additional settings are provided for the slider. - - [`userFloat[0]`](#userfloat) property determines the number of divisions for the slider. - - [`userFloat[1]`](#userfloat) property determines the width of the slider. - - [`userString[0]`](#userstring) property determines the background image for the slider thumb. + - [`userFloat[0]`](#float-userfloat) property determines the number of divisions for the slider. + - [`userFloat[1]`](#float-userfloat) property determines the width of the slider. + - [`userString[0]`](#string-userstring) property determines the background image for the slider thumb. ```dae INSTANCE MENUITEM_AUDIO_MUSICVOL_SLIDER(C_MENU_ITEM_DEF) @@ -209,11 +166,11 @@ CONST INT MENU_ITEM_LISTBOX = 7; // Frame - `MENU_ITEM_BUTTON` Button. Not used in scripts. - - The [`userString[0]`](#userstring) property determines which image will be used for the disabled button. The [backPic](#backpic) property is responsible for the background image of the enabled button. + - The [`userString[0]`](#string-userstring) property determines which image will be used for the disabled button. The [backPic](#string-backpic) property is responsible for the background image of the enabled button. - `MENU_ITEM_LISTBOX` Menu item type used in the "Quest Log" menu. - - The [`userString[0]`](#userstring) property determines which task list will be displayed in this element. + - The [`userString[0]`](#string-userstring) property determines which task list will be displayed in this element. ```dae userstring[0] = "CURRENTMISSIONS"; @@ -222,10 +179,10 @@ CONST INT MENU_ITEM_LISTBOX = 7; // Frame userstring[0] = "LOG"; ``` -### onSelAction +### `int` onSelAction {: .typed .int} Array of commands executed when selecting the menu item. -Each command receives parameters in the [`onSelAction_S`](#onselaction_s) property. +Each command receives parameters in the [`onSelAction_S`](#string-onselaction_s) property. Constants are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L8-L15). @@ -240,8 +197,8 @@ CONST INT SEL_ACTION_PLAY_SOUND = 6; // Play sound from C_SFX instance CONST INT SEL_ACTION_EXECCOMMANDS = 7; // Execute command specified in the onSelAction_S field using RUN or EFFECT commands ``` -### onSelAction_S -Arguments for commands specified in the [`onSelAction`](#onselaction) property. +### `string` onSelAction_S {: .typed .string} +Arguments for commands specified in the [`onSelAction`](#int-onselaction) property. Below are commands and their arguments: @@ -441,7 +398,7 @@ Below are commands and their arguments: There are also two commands, `SETDEFAULT` and `SETALTERNATIVE`, which set control settings. The first restores default settings, and the second uses alternative character control settings. -### onChgSetOption +### `string` onChgSetOption {: .typed .string} Parameter of the `Gothic.ini` file that will be modified by this menu item. @@ -465,12 +422,12 @@ highlightMeleeFocus=2 ; ... here you can turn on an optional focus highlight effect during fighting ``` -### onChgSetOptionSection +### `string` onChgSetOptionSection {: .typed .string} The section of the Gothic.ini file in which the parameter being changed is located. -See [onChgSetOption](#onchgsetoption) above. +See [onChgSetOption](#string-onchgsetoption) above. -### onEventAction +### `func` onEventAction {: .typed .func} Allows a user to call a function on a specified event. The list of constants is described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L51-L59). @@ -505,35 +462,34 @@ func int ShowIntro() }; ``` -### posx +### `int` posx {: .typed .int} The horizontal position of the top left point of the menu on the screen, measured in virtual coordinates. !!! Example "Virtual coordinates" Virtual coordinates divide the menu into 8192 parts (`0 - 8191`) horizontally and vertically. The position of the menu item is calculated based on these values. -### posy +### `int` posy {: .typed .int} The vertical position of the top left point of the menu on the screen, measured in virtual coordinates. -### dimx +### `int` dimx {: .typed .int} The width of the menu item in virtual coordinates. !!! Tip To automatically determine the width, enter `-1`. In this case, the width is calculated based on the text contained in the element. -### dimy - +### `int` dimy {: .typed .int} The height of the menu item in virtual coordinates. !!! Tip To automatically determine the element's height, enter a value of `-1`. In this case, the height is calculated taking into account the text contained in the element. -### sizeStartScale +### `float` sizeStartScale {: .typed .float} -!!! Warning "Deprecated setting" +!!! Danger "Deprecated setting" Size of the menu item at the beginning. -### flags +### `int` flags {: .typed .int} Flags of the menu item. Constants for all flags are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L27-L41). @@ -595,7 +551,7 @@ const int IT_EXTENDED_MENU = 1 << 14; // Advanced menu flag Empty flag. Not used. - `IT_EFFECTS_NEXT` - This flag affects the next neighboring element, i.e., the element specified in the [`items`](./c_menu.md#items) list of the [`C_MENU`](./c_menu.md) class. + This flag affects the next neighboring element, i.e., the element specified in the [`items`](./c_menu.md#string-items) list of the [`C_MENU`](./c_menu.md) class. ```dae instance MENU_OPT_GAME(C_MENU_DEF) @@ -651,31 +607,31 @@ const int IT_EXTENDED_MENU = 1 << 14; // Advanced menu flag - `IT_EXTENDED_MENU` Flag indicating that this element is part of the "Extended Menu." It is displayed only if the `extendedMenu` parameter in the `Gothic.ini` file is set to `1`. -### openDelayTime +### `float` openDelayTime {: .typed .float} -!!! Warning "Deprecated setting" +!!! Danger "Deprecated setting" Delay before opening a menu item. -### openDuration +### `float` openDuration {: .typed .float} -!!! Warning "Deprecated setting" +!!! Danger "Deprecated setting" The time the menu item was opened. -### userFloat +### `float` userFloat {: .typed .float} -Numerical settings of the interface element. Depending on the interface element, the purpose of the property changes. See [type](#type). +Numerical settings of the interface element. Depending on the interface element, the purpose of the property changes. See [type](#int-type). -### userString +### `string` userString {: .typed .string} -String settings of the interface element. The purpose of the property changes depending on the interface element. See [type](#type)`. +String settings of the interface element. The purpose of the property changes depending on the interface element. See [type](#int-type)`. -### frameSizeX +### `int` frameSizeX {: .typed .int} Indentation of text inside the frame along the X axis. This applies the padding to both sides of the frame. Measured in virtual coordinates from 0 to 4095. Frames are a special tool designed to work with the log of tasks and quests. -Used for elements of [type](#type) `MENU_ITEM_LISTBOX`. +Used for elements of [type](#int-type) `MENU_ITEM_LISTBOX`. ```dae instance MENU_ITEM_LIST_MISSIONS_ACT(C_MENU_ITEM_DEF) @@ -694,19 +650,19 @@ As a result, we get the following frame (Source: [Gothic-Library](http://www.got ![](../../../assets/images/c_menu_item_farmesize.png) -And the width and height of the frame are set, as for all elements, by the [dimx](#dimx) and [dimy](#dimy) properties. +And the width and height of the frame are set, as for all elements, by the [dimx](#int-dimx) and [dimy](#int-dimy) properties. -### frameSizeY +### `int` frameSizeY {: .typed .int} Indentation of text inside the frame along the Y axis. In this case, the indentation is applied at the top and bottom of the frame. Measured in virtual coordinates from 0 to 4095. -See [frameSizeX](#framesizex) above. +See [frameSizeX](#int-framesizex) above. -### hideIfOptionSectionSet +### `string` hideIfOptionSectionSet {: .typed .string} The section of the `Gothic.ini` file with the option which value of determines the display of this menu item. -This property works together with the [`hideIfOptionSet`](#hideifoptionset) and [`hideOnValue`](#hideonvalue) properties. +This property works together with the [`hideIfOptionSet`](#string-hideifoptionset) and [`hideOnValue`](#int-hideonvalue) properties. In the example below, the interface element will not be displayed until the `useGothic1Controls` parameter in the GAME section is set to 1, i.e., enabled. @@ -723,17 +679,17 @@ instance MENU_ITEM_NEXTMENU(C_MENU_ITEM_DEF) ``` !!! Tip - `Gothic.ini` settings can also be changed through the main menu. See [`onChgSetOption`](#onchgsetoption) and [`onChgSetOptionSection`](#onchgsetoptionsection). + `Gothic.ini` settings can also be changed through the main menu. See [`onChgSetOption`](#string-onchgsetoption) and [`onChgSetOptionSection`](#string-onchgsetoptionsection). -### hideIfOptionSet +### `string` hideIfOptionSet {: .typed .string} The `Gothic.ini` file parameter, the value of which determines the display of this menu item. -See [hideIfOptionSectionSet](#hideifoptionsectionset). +See [hideIfOptionSectionSet](#string-hideifoptionsectionset). -### hideOnValue +### `int` hideOnValue {: .typed .int} The value of the `Gothic.ini` file parameter at which this interface element is not displayed. -See [hideIfOptionSectionSet](#hideifoptionsectionset). +See [hideIfOptionSectionSet](#string-hideifoptionsectionset). ## Predefined instances There are a lot of predefined class instances in the menu `C_MENU_ITEM` performing a strictly defined function. They cannot be renamed, but they can be configured to a certain extent. @@ -763,3 +719,5 @@ There are a lot of predefined class instances in the menu `C_MENU_ITEM` performi | MENU_ITEM_LEARN | The number of available training points in the statistics window. | | MENU_ITEM_ATTRIBUTE_1 - MENU_ITEM_ATTRIBUTE_4 | Character attributes in the statistics window. | | MENU_ITEM_ARMOR_1 - MENU_ITEM_ARMOR_4 | Character protection in the statistics window. | + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_menu_item/1-1-0-37). \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_musicsys_cfg.md b/docs/zengin/scripts/classes/c_musicsys_cfg.md index 3973e39e62..63dedec558 100644 --- a/docs/zengin/scripts/classes/c_musicsys_cfg.md +++ b/docs/zengin/scripts/classes/c_musicsys_cfg.md @@ -3,57 +3,44 @@ title: C_MUSICSYS_CFG --- # C_MUSICSYS_CFG Daedalus class +Class `C_MUSICSYS_CFG` defines the global settings for the game's music[^1]. -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) +!!! Danger + An instance of this class is declared only once and should be named `musicSysConfig`. - -Class `C_MusicSys_CFG` defines the global settings for the game's music. - -An instance of this class is declared only once. -## Class definition +## Definition Class definition as it is defined in [`Scripts/System/_intern/Music.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Music.d#L40) script file. -??? "C_MusicSys_CFG Daedalus class" - ```dae - class C_MusicSys_CFG - { - var float volume; // Music volume - var int bitResolution; // Sound quality - var int globalReverbEnabled; // Enable global reverb - var int sampleRate; // Frequency - var int numChannels; // Sound channels - var int reverbBufferSize; // Reverb buffer size - }; - ``` -## Class members - -| Variable | Type | Description | -|---------------------------------------------|--------|--------------------------------------------------------------| -| [volume](#volume) | float | Overall game music volume | -| [bitResolution](#bitresolution) | int | Sound quality | -| [globalReverbEnabled](#globalreverbenabled) | int | Enable global reverb | -| [sampleRate](#samplerate) | int | Frequency | -| [numChannels](#numchannels) | int | Number of sound channels | -| [reverbBufferSize](#reverbbuffersize) | int | The size of reverb buffer | - -## Class member overview -Description of the class member variables. - -### volume +```dae +class C_MusicSys_CFG +{ + var float volume; // Music volume + var int bitResolution; // Sound quality + var int globalReverbEnabled; // Enable global reverb + var int sampleRate; // Frequency + var int numChannels; // Sound channels + var int reverbBufferSize; // Reverb buffer size +}; +``` + +## Members + +### `float` volume {: .typed .float} The overall volume of the background music (soundtrack). From 0.0 to 1.0. -### bitResolution +### `int` bitResolution {: .typed .int} Sound quality. 8 or 16 bit. -### globalReverbEnabled +### `int` globalReverbEnabled {: .typed .int} Enable global reverb. -### sampleRate +### `int` sampleRate {: .typed .int} Frequency. From 11050 to 44100. -### numChannels +### `int` numChannels {: .typed .int} Number of sound channels. From 16 to 32. -### reverbBufferSize -The size of the reverb buffer. \ No newline at end of file +### `int` reverbBufferSize {: .typed .int} +The size of the reverb buffer. + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_musicsys_cfg/1-1-0-40). \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_musictheme.md b/docs/zengin/scripts/classes/c_musictheme.md index 6516bbbb39..d017aed6b4 100644 --- a/docs/zengin/scripts/classes/c_musictheme.md +++ b/docs/zengin/scripts/classes/c_musictheme.md @@ -3,58 +3,42 @@ title: C_MUSICTHEME --- # C_MUSICTHEME Daedalus class +Class `C_MUSICTHEME` describes musical themes[^1]. -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) - -Class `C_MusicTheme` describes musical themes. -## Class definition +## Definition Class definition as it is defined in [`Scripts/System/_intern/Music.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Music.d#L52) script file. -??? "C_MusicTheme Daedalus class" - ```dae - class C_MusicTheme - { - var string file; // Sound file in DirectMusic `.sgt` format - var float vol; // Sound volume - var int loop; // Enable cycle - var float reverbMix; // Reverb mixing - var float reverbTime; // Reverb time - var int transType; // Type of transition to the next theme - var int transSubType; // Subtype of transition to the next theme song - }; - ``` -## Class members - -| Variable | Type | Description | -|-----------------------------------|--------|-------------------------------------------------------------------------------------| -| [file](#file) | string | Sound file in DirectMusic `.sgt` format | -| [vol](#vol) | float | Sound volume | -| [loop](#loop) | int | Enable/disable cycle | -| [reverbMix](#reverbmix) | float | Reverb mixing | -| [reverbTime](#reverbtime) | float | Reverb time | -| [transType](#transtype) | int | The type of transition to the next theme song | -| [transSubType](#transsubtype) | int | The subtype of transition to the next theme song | - -## Class member overview -Description of the class member variables. - -### file +```dae +class C_MusicTheme +{ + var string file; // Sound file in DirectMusic `.sgt` format + var float vol; // Sound volume + var int loop; // Enable cycle + var float reverbMix; // Reverb mixing + var float reverbTime; // Reverb time + var int transType; // Type of transition to the next theme + var int transSubType; // Subtype of transition to the next theme song +}; +``` + +## Members + +### `string` file {: .typed .string} DirectMusic sound in *.sgt format or MIDI file. -### vol +### `float` vol {: .typed .float} The volume of the theme song. From 0.0 to 1.0. -### loop +### `int` loop {: .typed .int} Enable/disable theme music looping. Disabled = 0. Enabled = 1. -### reverbMix +### `float` reverbMix {: .typed .float} Reverb mixing. Measured in decibels. -### reverbTime +### `float` reverbTime {: .typed .float} Reverberation time in milliseconds. -### transType +### `int` transType {: .typed .int} The type of transition to the next theme song. The list of constants for all transitions types is described in the file [`Scripts/System/_intern/Music.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Music.d#L24) @@ -69,7 +53,7 @@ const int TRANSITION_TYPE_END = 6; // End topic const int TRANSITION_TYPE_ENDANDINTRO = 7; // End and start new ``` -### transSubType +### `int` transSubType {: .typed .int} The subtype of transition to the next theme song. The list of constants for all transitions subtypes is described in the file [`Scripts/System/_intern/Music.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Music.d#L33) @@ -115,4 +99,6 @@ instance OWD_NGT_STD(C_MUSICTHEME_STANDARD) }; ``` !!! Tip - In G2 the `C_MUSICTHEME_STANDARD`, `C_MUSICTHEME_THREAT` and `C_MUSICTHEME_FIGHT` prototypes are used by default. \ No newline at end of file + In G2 the `C_MUSICTHEME_STANDARD`, `C_MUSICTHEME_THREAT` and `C_MUSICTHEME_FIGHT` prototypes are used by default. + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_musictheme/1-1-0-41). \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_npc.md b/docs/zengin/scripts/classes/c_npc.md new file mode 100644 index 0000000000..972f884603 --- /dev/null +++ b/docs/zengin/scripts/classes/c_npc.md @@ -0,0 +1,451 @@ +--- +title: C_NPC +--- + +# C_NPC Daedalus class + +Class `C_NPC` describes the character and monsters[^1]. The playable character is also an NPC. + +!!! Tip + You can call externals inside the instance of `C_NPC` class e.g. to give an item or customize look of the NPC. + + ```dae + instance PC_HERO (C_NPC) + { + // ... + CreateInvItems (self, ItFo_Wine, 10); + // ... + }; + ``` + +## Definition +`C_NPC` class definition differs between Gothic 1 and Gothic 2 Addon. + +=== "G1" + + Class definition as it is defined in [`Scripts/Content/_intern/Classes.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Classes.d#L11-L59) script file. + + ```dae + class C_Npc + { + var int id; // NPC id + var string name[5]; // NPC name + var string slot; // Slot (deprecated) + var int npcType; // NPC type + var int flags; // NPC flags + var int attribute[8]; // Attribute values + var int protection[8]; // Protection values + var int damage[8]; // Damage values + var int damagetype; // Type of damage + var int guild; // NPC guild + var int level; // NPC level + var func mission[5]; // Missions (deprecated) + var int fight_tactic; // NPC fight tactic + var int weapon; // Current comabt mode + var int voice; // SVM voice assigned to the NPC + var int voicePitch; // Pitch of the voice + var int bodymass; // Body mass (deprecated) + + // Routine + var func daily_routine; // Starting daily routine of the NPC + var func start_aistate; // Starting AI state of the NPC + + // Respawn + var string spawnPoint; // Spawn point (deprecated) + var int spawnDelay; // Spawn delay (deprecated) + + // Senses + var int senses; // NPC senses + var int senses_range; // NPC senses range + + // AI + var int aivar[50]; // AI variables + var string wp; // Currently tracked waypoint + + // Experience + var int exp; // Experience points + var int exp_next; // Experience points needed for the next level + var int lp; // Learning points + }; + ``` + +=== "G2A" + + Class definition as it is defined in [`Scripts/Content/_intern/Classes.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Classes.d#L12-L68) script file. + + ```dae + class C_Npc + { + var int id; // NPC id + var string name[5]; // NPC name + var string slot; // Slot (deprecated) + var string effect; // Visual effect + var int npcType; // NPC type + var int flags; // NPC flags + var int attribute[8]; // Attribute values + var int hitChance[5]; // Fight skill values + var int protection[8]; // Protection values + var int damage[8]; // Damage values + var int damagetype; // Type of damage + var int guild; // NPC guild + var int level; // NPC level + var func mission[5]; // Missions (deprecated) + var int fight_tactic; // NPC fight tactic + var int weapon; // Current comabt mode + var int voice; // SVM voice assigned to the NPC + var int voicePitch; // Pitch of the voice + var int bodymass; // Body mass (deprecated) + + // Routine + var func daily_routine; // Starting daily routine of the NPC + var func start_aistate; // Starting AI state of the NPC + + // Respawn + var string spawnPoint; // Spawn point (deprecated) + var int spawnDelay; // Spawn delay (deprecated) + + // Senses + var int senses; // NPC senses + var int senses_range; // NPC senses range + + // AI + var int aivar[100]; // AI variables + var string wp; // Currently tracked waypoint + + // Experience + var int exp; // Experience points + var int exp_next; // Experience points needed for the next level + var int lp; // Learning points + + var int bodyStateinterruptableOverride; // Possibility to interrupt the current body state + var int noFocus; // Disable focus on the NPC + }; + ``` + +## Members + +### `int` id {: .typed .int} +Unique identification number used for human NPCs. + +### `string` name {: .typed .string} +Name of the NPC. Only the first name from array is used. + +### `string` slot {: .typed .string} +!!! Danger "Deprecated setting" + Slot. + +### `string` effect {: .typed .string} +VFX visual effect aplied to the NPC. The effect must be defined as `CFx_Base` instance. + +!!! Warning + This property is only available in Gothic 2 Addon. + +### `int` npcType {: .typed .int} +Type of NPC. + +=== "G1" + NPC type constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L71-L86) file. + + ```dae + const int NPCTYPE_AMBIENT = 0; // Ambient NPC + const int NPCTYPE_MAIN = 1; // Main NPC + const int NPCTYPE_GUARD = 2; // Guard NPC + const int NPCTYPE_FRIEND = 3; // Friend + const int NPCTYPE_MINE_AMBIENT = 4; // Ambient NPC in mines + const int NPCTYPE_MINE_GUARD = 5; // Guard NPC in mines + const int NPCTYPE_OW_AMBIENT = 6; + const int NPCTYPE_OW_GUARD = 7; + const int NPCTYPE_ROGUE = 8; // Rogue/Bandit + ``` + +=== "G2A" + + NPC type constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L529-L540) file. + + ```dae + const int NPCTYPE_AMBIENT = 0; // Ambient NPC + const int NPCTYPE_MAIN = 1; // Main NPC + const int NPCTYPE_FRIEND = 2; // Friend + const int NPCTYPE_OCAMBIENT = 3; // Ambient NPC in Valley of Mines + const int NPCTYPE_OCMAIN = 4; // Main NPC in Valley of Mines + const int NPCTYPE_BL_AMBIENT = 5; // Ambient NPC in Bandit Camp + const int NPCTYPE_TAL_AMBIENT = 6; + const int NPCTYPE_BL_MAIN = 7; // Main NPC in Bandit Camp + ``` + +### `int` flags {: .typed .int} +NPC flags. + +=== "G1" + NPC flag constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L21-L25) file. + + ```dae + CONST INT NPC_FLAG_FRIEND = 1 << 0; // Friend (not used) + CONST INT NPC_FLAG_IMMORTAL = 1 << 1; // Immmortal + ``` + +=== "G2A" + NPC flag constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L44-L49) file. + + ```dae + CONST INT NPC_FLAG_FRIEND = 1 << 0; // Friend (not used) + CONST INT NPC_FLAG_IMMORTAL = 1 << 1; // Immmortal + CONST INT NPC_FLAG_GHOST = 1 << 2; // Ghost effect + ``` + +### `int` attribute {: .typed .int} +Array of NPC attribute values. + +Attribute constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L28-L42) file. + +```dae +const int ATR_HITPOINTS = 0; // Hitpoints +const int ATR_HITPOINTS_MAX = 1; // Maximum Hitpoints +const int ATR_MANA = 2; // Mana +const int ATR_MANA_MAX = 3; // Maximum Mana + +const int ATR_STRENGTH = 4; // Strength +const int ATR_DEXTERITY = 5; // Dexterity +const int ATR_REGENERATEHP = 6; // Health regeneration (deprecated) +const int ATR_REGENERATEMANA = 7; // Mana regeneration (deprecated) + +const int ATR_INDEX_MAX = 8; +``` + +!!! Note + Some attributes are associated with [`C_MENU_ITEM`](c_menuitem.md#predefined-instances) predefined instances. + + | Attribute | Menu item instance | + |-------------------------|-----------------------------| + | ATR_STRENGTH | `MENU_ITEM_ATTRIBUTE_1` | + | ATR_DEXTERITY | `MENU_ITEM_ATTRIBUTE_2` | + | ATR_MANA | `MENU_ITEM_ATTRIBUTE_3` | + | ATR_HITPOINTS | `MENU_ITEM_ATTRIBUTE_4` | + +### `int` hitChance {: .typed .int} +Array of NPC skill for fighting with different types of weapons. + +NPC talents constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L945-L949) file. + +```dae +const int NPC_TALENT_1H = 1; // One-handed weapons +const int NPC_TALENT_2H = 2; // Two-handed weapons +const int NPC_TALENT_BOW = 3; // Bows +const int NPC_TALENT_CROSSBOW = 4; // Crossbows +``` + + +!!! Warning + This property is only available in Gothic 2 Addon. + +### `int` protection {: .typed .int} +Array of NPC protection values against different types of damage. + +Protection constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L200-L211) file. + +```dae +CONST INT PROT_BARRIER = DAM_INDEX_BARRIER; // Protection form magic barrier +CONST INT PROT_BLUNT = DAM_INDEX_BLUNT; // Protection from blunt weapons (hammers, maces) +CONST INT PROT_EDGE = DAM_INDEX_EDGE; // Protection from edged weapons (swords, axes, rapiers) +CONST INT PROT_FIRE = DAM_INDEX_FIRE; // Protection from fire +CONST INT PROT_FLY = DAM_INDEX_FLY; // Protection from knockback +CONST INT PROT_MAGIC = DAM_INDEX_MAGIC; // Protection from magic +CONST INT PROT_POINT = DAM_INDEX_POINT; // Protection from point damage (bows, crossbows) +CONST INT PROT_FALL = DAM_INDEX_FALL; // Protection from fall damage + +CONST INT PROT_INDEX_MAX = DAM_INDEX_MAX; // Number of protection types +``` + +### `int` damage {: .typed .int} +Array of maximum damage values inflicted by the NPC for different types of damage. Used with [`damagetype`](#int-damagetype) property. + +Damage type constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L163-L174) file. + +### `int` damagetype {: .typed .int} +Type of damage inflicted by the NPC. Used with [`damage`](#int-damage) property. + +!!! Tip + You can combine multiple damage types using the bitwise OR operator `|`. + +Damage type constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L163-L174) file. + +### `int` guild {: .typed .int} +NPC guild. Guilds differ between Gothic 1 and Gothic 2 Addon, but could be devided into two main groups - `human` and `animal`. + +=== "G1" + Guild constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L305-L356) file. + + Relations between human guilds are specified in `GIL_ATTITUDES` array inside the [`Scripts/Content/Story/Guilds.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/Story/Guilds.d) file. + +=== "G2A" + Guild constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L297-L379) file. + + Relations between human guilds are specified in `GIL_ATTITUDES` array inside the [`Scripts/Content/AI/Human/Guilds.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/Human/Guilds.d) file. + +!!! Info + General parameters for each guild are specified inside the instance of the `C_GilValues` class. + +### `int` level {: .typed .int} +Current level of the NPC. + +=== "G1" + Logic for hero leveling is implemented in the [`B_GiveXP`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/Story/B/B_GiveXP.d) function. + +=== "G2A" + Logic for hero leveling is implemented in the [`B_GivePlayerXP`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/Story/B_Story/B_GivePlayerXP.d) function. + +!!! Note + This property is available in menu as `MENU_ITEM_LEVEL` predefined instance of the [`C_MENU_ITEM`](c_menuitem.md#predefined-instances) class. + +### `func` mission {: .typed .func} +!!! Danger "Deprecated setting" + Array of missions assigned to the NPC. + +### `int` fight_tactic {: .typed .int} +NPC fight tactic. Tactics are described by the `C_FightAI` class instances and each tactic has its own index. + +=== "G1" + Fight tactic constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L88-L120) file. + +=== "G2A" + Fight tactic constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L464-L505) file. + +### `int` weapon {: .typed .int} +Current combat mode of the NPC. Property is never used in the game scripts but should work with following constants. + +```dae +const int WEAPON_NONE = 0; // Unarmed +const int WEAPON_FIST = 1; // Fist +const int WEAPON_DAG = 2; // Dagger +const int WEAPON_1H = 3; // One-handed weapon +const int WEAPON_2H = 4; // Two-handed weapon +const int WEAPON_BOW = 5; // Bow +const int WEAPON_CBOW = 6; // Crossbow +const int WEAPON_MAGIC = 7; // Magic +``` + +### `int` voice {: .typed .int} +Voice assigned to the NPC. This is used for [`C_SVM`](c_svm.md) instances. + +For example, if the NPC has `voice` property set to `1`, it will use the `SVM_1` instance of the `C_SVM` class. + +```dae +instance SVM_1(C_SVM) +{ + // ... +}; +``` + +### `int` voicePitch {: .typed .int} +Pitch of the voice. Accepts values from `-5` to `5`. + +!!! Note + When the pitch is lowered, the playback speed is decreased and overlaing may occur. + +### `int` bodymass {: .typed .int} +!!! Danger "Deprecated setting" + Body mass of the NPC. + +### `func` daily_routine {: .typed .func} +Function defining the starting daily routine of the NPC. + +All routine functions start with the `Rtn_` prefix and end with NPC id as suffix. For example, the `Start` routine of the npc with id `1` will be defined like this: + +```dae +func void Rtn_Start_1() +{ + // ... +}; +``` + +Instide the function body should be `TA_` function calls defining the routine actions. It is important to remember that the routine have to contain at least two functions. + +```dae +func void Rtn_Start_1() +{ + TA_SmallTalk (07,00,21,00, "OC1"); + TA_SmallTalk (21,00,07,00, "OC1"); +}; +``` + +To Change the daily routine use the [`Npc_ExchangeRoutine`](../externals/npc.md#npc_exchangeroutine) function. + +### `func` start_aistate {: .typed .func} +Function defining the starting AI state of the NPC. Used mainly for monsters and animals that do not have a daily routine. + +### `string` spawnPoint {: .typed .string} +!!! Danger "Deprecated setting" + Spawn point of the NPC. + +### `int` spawnDelay {: .typed .int} +!!! Danger "Deprecated setting" + Spawn delay of the NPC. + +### `int` senses {: .typed .int} +Active NPC senses. Used with [`senses_range`](#int-senses_range) property. + +Senses constants are defined in [`Scripts/Content/_intern/Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/_intern/Constants.d#L222-L227) file. + +```dae +CONST INT SENSE_SEE = 1 << 0; // Vision +CONST INT SENSE_HEAR = 1 << 1; // Hearing +CONST INT SENSE_SMELL = 1 << 2; // Smell +``` + +### `int` senses_range {: .typed .int} +Range of active NPC [senses](#int-senses) in cm. + +### `int` aivar {: .typed .int} +Array of NPC AI variables. Used inside the NPC AI scripts. + +=== "G1" + Array has 50 elements. + + Aivar constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-1-classic-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L1-L69) file. + +=== "G2A" + Array has 100 elements. + + Aivar constants are defined in [`Scripts/Content/AI/AI_Intern/AI_Constants.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/Content/AI/AI_Intern/AI_Constants.d#L1-L339) file. + +### `string` wp {: .typed .string} +Currently tracked waypoint. Used with the pathfinding system. + +### `int` exp {: .typed .int} +Current experience points of the NPC. + +See [`level`](#int-level) property for more information about leveling. + +!!! Note + This property is available in menu as `MENU_ITEM_EXP` predefined instance of the [`C_MENU_ITEM`](c_menuitem.md#predefined-instances) class. + + +### `int` exp_next {: .typed .int} +Experience points needed for the next level. + +See [`level`](#int-level) property for more information about leveling. + +!!! Note + This property is available in menu as `MENU_ITEM_LEVEL_NEXT` predefined instance of the [`C_MENU_ITEM`](c_menuitem.md#predefined-instances) class. + +### `int` lp {: .typed .int} +Current learning points of the NPC. Optained when the NPC levels up. + +See [`level`](#int-level) property for more information about leveling. + +!!! Note + This property is available in menu as `MENU_ITEM_LEARN` predefined instance of the [`C_MENU_ITEM`](c_menuitem.md#predefined-instances) class. + +### `int` bodyStateinterruptableOverride {: .typed .int} +Possibility to interrupt the current body state. + +!!! Warning + This property is only available in Gothic 2 Addon. + +### `int` noFocus {: .typed .int} +Disable focus on the NPC. The NPC will not be highlighted when the player looks at it. + +!!! Warning + This property is only available in Gothic 2 Addon. + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_npc/1-1-0-42) \ No newline at end of file diff --git a/docs/zengin/scripts/classes/c_sfx.md b/docs/zengin/scripts/classes/c_sfx.md index 25a45354c2..437a12bc16 100644 --- a/docs/zengin/scripts/classes/c_sfx.md +++ b/docs/zengin/scripts/classes/c_sfx.md @@ -6,66 +6,51 @@ title: C_SFX Class `C_SFX` defines sound effects of the game. -## Class definition +## Definition Class definition as it is defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L30-L41) script file. -??? "C_Sfx Daedalus class" - ```dae - CLASS C_SFX - { - VAR string file; // Sound file in `.wav` format - VAR int pitchOff; // Pitch offset in semitones - VAR int pitchVar; // Semitone variance - VAR int vol; // Sound volume - VAR int loop; // Enable looping - VAR int loopStartOffset; // Loop start offset - VAR int loopEndOffset; // Loop end offset - VAR float reverbLevel; // Reverb level - VAR string pfxName; // Particle effect name - }; - ``` - -## Class members - -| Variable | Type | Description | -|---------------------|--------|---------------------------------------| -| [file](#file) | string | Sound file in `.wav` format | -| [pitchOff](#pitchoff) | int | Pitch offset in semitones | -| [pitchVar](#pitchvar) | int | Semitone variance | -| [vol](#vol) | int | Sound volume | -| [loop](#loop) | int | Enable looping | -| [loopStartOffset](#loopstartoffset) | int | Loop start offset | -| [loopEndOffset](#loopendoffset) | int | Loop end offset | -| [reverbLevel](#reverblevel) | float | Reverb level | -| [pfxName](#pfxname) | string | Particle effect name | - -## Class member overview - -### file +```dae +class C_Sfx +{ + var string file; // Sound file in `.wav` format + var int pitchOff; // Pitch offset in semitones + var int pitchVar; // Semitone variance + var int vol; // Sound volume + var int loop; // Enable looping + var int loopStartOffset; // Loop start offset + var int loopEndOffset; // Loop end offset + var float reverbLevel; // Reverb level + var string pfxName; // Particle effect name +}; +``` + +## Members + +### `string` file {: .typed .string} This variable holds the name of the sound file in `.wav` format. It is used to specify which sound effect should be played. The file must be located in the `_work/Data/Sound/SFX/` directory, so the game can access it. -### pitchOff +### `int` pitchOff {: .typed .int} The `pitchOff` variable sets the pitch offset in semitones. This allows you to adjust the pitch of the sound effect up or down, providing flexibility in how the sound is perceived in the game. -### pitchVar +### `int` pitchVar {: .typed .int} `pitchVar` defines the semitone variance for the sound effect. -### vol +### `int` vol {: .typed .int} This variable controls the sound volume. -### loop +### `int` loop {: .typed .int} The `loop` variable enables or disables looping of the sound effect. When set to true, the sound will continuously repeat, which is useful for background sounds or ambient effects like fire or wind. -### loopStartOffset +### `int` loopStartOffset {: .typed .int} `loopStartOffset` specifies the point in the sound file where looping should start. This allows for more precise control over which part of the sound effect is repeated. -### loopEndOffset +### `int` loopEndOffset {: .typed .int} Similar to `loopStartOffset`, `loopEndOffset` defines where the looping should end. Together, these two variables allow you to create seamless loops by specifying the exact segment of the sound file to be repeated. -### reverbLevel +### `float` reverbLevel {: .typed .float} The `reverbLevel` variable sets the level of reverb applied to the sound effect. -### pfxName +### `string` pfxName {: .typed .string} This variable holds the name of the particle effect associated with the sound. diff --git a/docs/zengin/scripts/classes/c_sndsys_cfg.md b/docs/zengin/scripts/classes/c_sndsys_cfg.md index 7a28e09062..4d3cf3312f 100644 --- a/docs/zengin/scripts/classes/c_sndsys_cfg.md +++ b/docs/zengin/scripts/classes/c_sndsys_cfg.md @@ -3,56 +3,44 @@ title: C_SNDSYS_CFG --- # C_SNDSYS_CFG Daedalus class -Class `C_SndSys_CFG` defines the global settings for the game's sounds. +Class `C_SNDSYS_CFG` defines the global settings for the game's sounds. + +!!! Danger + An instance of this class is declared only once and should be named `sndSysConfig`. -An instance of this class is declared only once. ## Class definition Class definition as it is defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L19-L27) script file. -??? "C_SndSys_CFG Daedalus class" - ```dae - class C_SNDSYS_CFG - { - VAR FLOAT volume; // Sound volume - VAR INT bitResolution; // Sound quality - VAR INT sampleRate; // Frequency - VAR INT useStereo; // Stereo sound - VAR INT numSFXChannels; // Number of sound channels - VAR STRING used3DProviderName; // Name of the 3D sound provider - }; - ``` -## Class members - -| Variable | Type | Description | -|---------------------------------------------|--------|--------------------------------------------------------------| -| [volume](#volume) | float | Overall sound volume | -| [bitResolution](#bitresolution) | int | Sound quality | -| [sampleRate](#samplerate) | int | Frequency | -| [useStereo](#usestereo) | int | Stereo sound | -| [numSFXChannels](#numsfxchannels) | int | Number of sound channels | -| [used3DProviderName](#used3dprovidername) | string | Name of the 3D sound provider | - -## Class member overview -Description of the class member variables. -### volume +```dae +class C_SndSys_Cfg +{ + var float volume; // Sound volume + var int bitResolution; // Sound quality + var int sampleRate; // Frequency + var int useStereo; // Stereo sound + var int numSFXChannels; // Number of sound channels + var string used3DProviderName; // Name of the 3D sound provider +}; +``` + +## Members + +### `float` volume {: .typed .float} The overall volume of the background music (soundtrack). This value ranges from 0.0 to 1.0, where 0.0 is completely muted and 1.0 is the maximum volume. -### bitResolution +### `int` bitResolution {: .typed .int} Defines the sound quality in terms of bit depth. It can be either 8-bit or 16-bit, with 16-bit providing higher audio fidelity. -### sampleRate +### `int` sampleRate {: .typed .int} Specifies the frequency at which the sound is sampled. This value ranges from 11050 Hz to 44100 Hz, with higher values offering better sound quality. -### useStereo +### `int` useStereo {: .typed .int} A flag indicating whether stereo sound is enabled. A value of 1 means stereo sound is used, while 0 means mono sound. -### numSFXChannels +### `int` numSFXChannels {: .typed .int} Determines the number of sound effect channels available. This value ranges from 1 to 32, allowing for multiple sound effects to be played simultaneously. -### reverbBufferSize -Specifies the size of the reverb buffer, which affects the quality and duration of the reverb effect in the game's audio. - -### used3DProviderName +### `string` used3DProviderName {: .typed .string} Name of the 3D sound provider. One of the constants defined in [`Scripts/System/_intern/SFX.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/SFX.d#L4-L15). ```dae diff --git a/docs/zengin/scripts/classes/c_svm.md b/docs/zengin/scripts/classes/c_svm.md index 392620a7dd..7d5ac3a1e0 100644 --- a/docs/zengin/scripts/classes/c_svm.md +++ b/docs/zengin/scripts/classes/c_svm.md @@ -3,13 +3,9 @@ title: C_SVM --- # C_SVM Daedalus class -!!! example "Acknowledgment" - Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) +The `C_SVM` class is used to define sound dialogues (smalltalk, reactions) that are defined for every [C_NPC.voice](c_npc.md#int-voice)[^1]. - -The `C_SVM` class is used to define sound dialogues (smalltalk, reactions) that are defined for every [C_NPC.voice](). - -## Class definition +## Definition `C_SVM` class is the only class with variable number of members. The `C_SVM` definition in the scripts dictates the content of the class. Every Gothic game has a different number of SVM entries. As an interesting information (more than anything else) we include a table with the numbers of voice lines and voices below. | Game | voice lines | voices | @@ -66,3 +62,5 @@ class C_SVM //... }; ``` + +[^1]: Heavily inspired by the amazing documentation site [Gothic library](http://gothic-library.ucoz.org/publ/class_c_svm/1-1-0-48) \ No newline at end of file diff --git a/docs/zengin/scripts/extenders/ikarus/.pages b/docs/zengin/scripts/extenders/ikarus/.pages index dd084e74b3..58cbdeb111 100644 --- a/docs/zengin/scripts/extenders/ikarus/.pages +++ b/docs/zengin/scripts/extenders/ikarus/.pages @@ -1,3 +1,4 @@ nav: + - setup.md - ... - ... | examples*.md \ No newline at end of file diff --git a/docs/zengin/scripts/extenders/ikarus/functions/parser.md b/docs/zengin/scripts/extenders/ikarus/functions/parser.md index ef35ecfaad..113e995448 100644 --- a/docs/zengin/scripts/extenders/ikarus/functions/parser.md +++ b/docs/zengin/scripts/extenders/ikarus/functions/parser.md @@ -178,7 +178,7 @@ If the function to be called has parameters, these must first be placed on the d Instance to pass as a function parameter #### `MEM_PushStringParam` - !!! function "`MEM_PushStringParam`" +!!! function "`MEM_PushStringParam`" Passes a string as a parameter to the called function. ```dae func void MEM_PushStringParam (var string str) @@ -344,11 +344,14 @@ If a function has a return value, it should be fetched from the data stack after ### `MEM_GetFrameBoundary` !!! function "`MEM_GetFrameBoundary`" - Returns the address/pointer to the boundary of a stack frame (ESP). + Retrieves the boundary of the current stack frame (ESP). ```dae func int MEM_GetFrameBoundary() ``` + **Return value** + The function returns an integer representing the address/pointer to the boundary of a stack frame (ESP). + ### `MEM_GetCallerStackPos` !!! function "`MEM_GetCallerStackPos`" Retrieves the stack position (pop position) of the caller's caller (look at the example for better understanding). @@ -430,7 +433,7 @@ If a function has a return value, it should be fetched from the data stack after In addition there is a function **`_@f`** with the same signature and functionality as `MEM_GetFloatAddress`. ```dae - func int _@s(var string s) + func int _@f(var float f) ``` ### `MEM_GetStringAddress` @@ -454,7 +457,7 @@ If a function has a return value, it should be fetched from the data stack after ### `STR_GetAddressInit` !!! function "`STR_GetAddressInit`" - Alias to [`MEM_GetAddress_Init`](#mem_getaddress_init), kept for downward compatibility. + Alias to [`MEM_GetAddress_Init`](#mem_getaddress_init), kept for backwards compatibility. ```dae func void STR_GetAddressInit() ``` diff --git a/docs/zengin/scripts/extenders/ikarus/index.md b/docs/zengin/scripts/extenders/ikarus/index.md index d9bcdd48d0..e250187edd 100644 --- a/docs/zengin/scripts/extenders/ikarus/index.md +++ b/docs/zengin/scripts/extenders/ikarus/index.md @@ -17,6 +17,3 @@ Ikarus is a Daedalus library for Gothic. It exploits the interpreter to allow ar In short: Extra care is needed! A bug that leads to a crash is not something you want in the release version. But if you work cleanly and test extensively, it's not such a big deal. A good friend in debugging crashes is undoubtedly `PrintDebug`. It allows sending messages to [zSpy](../../../tools/zSpy.md) (for example, to narrow down where the crash is occurring). It's worth enabling debug messages by [`MEM_SetShowDebug`](functions/debug.md#mem_setshowdebug) and the text filter (Options -> Textfilter) in [zSpy](../../../tools/zSpy.md#configuration). - -!!! Note - Ikarus is hosted on [GitHub](https://github.com/Lehona/Ikarus) and the documentation is [built in](https://github.com/Lehona/Ikarus/blob/master/Ikarus_Doc.d). The translation is planned. diff --git a/docs/zengin/scripts/extenders/ikarus/setup.md b/docs/zengin/scripts/extenders/ikarus/setup.md index 75b4af15cb..8c9ce47de2 100644 --- a/docs/zengin/scripts/extenders/ikarus/setup.md +++ b/docs/zengin/scripts/extenders/ikarus/setup.md @@ -16,7 +16,7 @@ Before unpacking the downloaded archive it's needed to create a dedicated folder ## Parsing Ikarus consists of three main parts, [constants](./constants.md), classes and the Ikarus core. It's essential to parse these in a specific order. Additionally, there is a [floats package](floats.md) which isn't essential, but it is highly recommended to parse it, especially if you are working with [LeGo](../lego/index.md) that depends on it. -The Ikarus Core is identical for both Gothic 1 and 2 and is contained in a single file, [`Ikarus.d`](https://github.com/Lehona/Ikarus/blob/master/Ikarus.d). However, there are separate files for the constants and classes for each engine, and they must be parsed correctly. Ikarus uses a C_NPC and therefore has to be parsed after the C_NPC class (after the `classes.d` file). There are no other dependencies. +The Ikarus Core is identical for both Gothic 1 and 2 and is contained in a single file, [`Ikarus.d`](https://github.com/Lehona/Ikarus/blob/master/Ikarus.d). However, there are separate files for the constants and classes for each engine, and they must be parsed correctly. Ikarus uses a [C_NPC](../../classes/c_npc.md) and therefore has to be parsed after the [C_NPC](../../classes/c_npc.md) class (after the `classes.d` file). There are no other dependencies. Since Ikarus 1.2.1 there is additional `.src` file for each game engine, to simplify adding files to `Gothic.src` @@ -42,43 +42,15 @@ Since Ikarus 1.2.1 there is additional `.src` file for each game engine, to simp ## Initialization Before you can use Ikarus in your scripts, it must be properly initialized. The initialization process differs between Gothic 1 and Gothic 2. -### `MEM_InitAll` -This is main ikarus initialization function, however it consists of some smaller initialization functions. -=== "Declaration" - ```dae - func void MEM_InitAll() - ``` - -=== "Definition" +### `MEM_InitAll` +This is main ikarus initialization function that initializes all Ikarus functions. It consists of multiple other initialization functions, but it is recommended to use this one. +=== "MEM_InitAll" ```dae - func void MEM_InitAll() { - if (!MEMINT_ReportVersionCheck()) { - return; - }; - - MEM_ReinitParser(); /* depends on nothing */ - MEM_InitLabels(); /* depends in MEM_ReinitParser */ - MEM_InitGlobalInst(); /* depends on MEM_ReinitParser */ - - /* now I can use MEM_ReplaceFunc, MEM_GetFuncID */ - MEM_GetAddress_Init(); /* depends on MEM_ReinitParser and MEM_InitLabels */ - /* now the nicer operators are available */ - - MEM_InitStatArrs(); /* depends on MEM_ReinitParser and MEM_InitLabels */ - ASMINT_Init(); - - MEMINT_ReplaceLoggingFunctions(); - MEMINT_ReplaceSlowFunctions(); - MEM_InitRepeat(); - - /* takes a wail the first time it is called. - call it to avoid delay later */ - var int dump; dump = MEM_GetFuncIDByOffset(0); - }; + func void MEM_InitAll() ``` -=== "List of functions" +=== "Other functions" - [MEM_ReinitParser](functions/parser.md#mem_reinitparser) - [MEM_InitLabels](functions/jumps_loops.md#initialization) - [MEM_InitGlobalInst](functions/objects.md#mem_initglobalinst) diff --git a/docs/zengin/scripts/extenders/lego/.pages b/docs/zengin/scripts/extenders/lego/.pages index b968335b15..42e8ed0586 100644 --- a/docs/zengin/scripts/extenders/lego/.pages +++ b/docs/zengin/scripts/extenders/lego/.pages @@ -1,4 +1,5 @@ nav: + - setup.md - tools - applications - userconstants.md diff --git a/docs/zengin/scripts/extenders/lego/index.md b/docs/zengin/scripts/extenders/lego/index.md index 53df8d185b..11d095efd3 100644 --- a/docs/zengin/scripts/extenders/lego/index.md +++ b/docs/zengin/scripts/extenders/lego/index.md @@ -8,5 +8,5 @@ LeGo (**Le**hona**Go**ttfried) is a script packet built on top of [Ikarus](../ik | Forum | [:material-forum: LeGo](https://forum.worldofplayers.de/forum/threads/1505251-Skriptpaket-LeGo-4) | -!!! Note - The code for LeGo is hosted on [GitHub](https://github.com/Lehona/LeGo) and LeGo has its very own [documentation page](https://lego.worldofplayers.de/). +## Documentation +LeGo has its own [documentation page](https://lego.worldofplayers.de/), however it is in german and a bit outdated so we recomend reffering to the information provided here on gmc. diff --git a/docs/zengin/scripts/extenders/standalone/index.md b/docs/zengin/scripts/extenders/standalone/index.md index 427b587521..938154658d 100644 --- a/docs/zengin/scripts/extenders/standalone/index.md +++ b/docs/zengin/scripts/extenders/standalone/index.md @@ -1,18 +1,15 @@ -# Standalone Scripts +# Standalone script extensions Over the years Gothic modders have created many useful features to use with Zengin scripts. This section contains documentation for some scripts that are "standalone", meaning they are not part of larger packages, but are often small features to make modders lives easier. ## Script Bins -A few people came up with the idea of collecting scripts scattered on the forums, which resulted in the so-called Script Bins. +A few people came up with the idea of collecting usefull scripts in one place, which resulted in the so-called Script Bins. -!!! Warning - Script bins aren't updated frequently, so for the latest updates and new scripts also check the [ScriptBin WoG thread](https://forum.worldofplayers.de/forum/threads/1495001-Scriptsammlung-ScriptBin). +### WoG Script Bin +Thread on WoG forum where people share their scripts. -### WoG Script Bin -Script bin made by Kirides containing scripts from German WoG forum. - -[https://apps.kirides.de/wog-script-bin/](https://apps.kirides.de/wog-script-bin/) +[:material-forum: WoG Forum Thread](https://forum.worldofplayers.de/forum/threads/1495001-Scriptsammlung-ScriptBin) ### ScriptBin GitHub repository Lehona has created a GitHub repository that contains scripts from some of the modders. -[https://github.com/Lehona/ScriptBin](https://github.com/Lehona/ScriptBin) \ No newline at end of file +[:material-github: Lehona/ScriptBin](https://github.com/Lehona/ScriptBin) \ No newline at end of file diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/ai.md b/docs/zengin/scripts/extenders/zparserextender/externals/ai.md index af3cb5f55f..442ee411d8 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/ai.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/ai.md @@ -1,7 +1,7 @@ --- title: AI functions --- -# AI - functions for working with AI +# AI functions (zPE) Functions to work with the new [`C_Trigger`](../classes/c_trigger.md) class and NPC's AI queue. ## `AI_CallScript` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/hlp.md b/docs/zengin/scripts/extenders/zparserextender/externals/hlp.md index 979aa4dd18..741114320d 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/hlp.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/hlp.md @@ -1,7 +1,7 @@ --- title: HLP functions --- -# HLP - help functions +# HLP functions (zPE) Helper functions generally used for safety checks, to get specific information from the engine or to interface with the configuration `.ini` files. ## `Hlp_HasFocusVob` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/log.md b/docs/zengin/scripts/extenders/zparserextender/externals/log.md index e17f812bad..0c50d4eb88 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/log.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/log.md @@ -1,4 +1,7 @@ -# Log functions +--- +title: Log functions +--- +# Log functions (zPE) As discussed on [Inside Gothic](https://ataulien.github.io/Inside-Gothic/QuestLog/), vanilla Gothic has no way of getting the status of a quest. These functions implement that functionality. ## `Log_GetTopicStatus` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/mdl.md b/docs/zengin/scripts/extenders/zparserextender/externals/mdl.md index 0b4b727179..62fbd75ce4 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/mdl.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/mdl.md @@ -1,7 +1,7 @@ --- -title: MDL functions +title: MDL functions --- -# MDL - model functions +# MDL functions (zPE) Functions to tweak animation and other model related settings. ## `Mdl_GetAnimationIndex` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/menu.md b/docs/zengin/scripts/extenders/zparserextender/externals/menu.md index 97ba966e42..8fd8c17a22 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/menu.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/menu.md @@ -1,4 +1,8 @@ -# Menu function +--- +title: Menu functions +--- +# Menu functions (zPE) +External functions for working with menu. ## `Menu_SearchItems` !!! function "`Menu_SearchItems`" @@ -10,6 +14,16 @@ - `mask` - regex like mask for searching +## `Open_Link` +!!! function "`Open_Link`" + Opens a link in the browser + + ```dae + func void Open_Link( var string link ) {}; + ``` + + - `link` - link to open in the browser + ### Example This function is used in the Union Menu [API script](../daedalus_injection/index.md#api-script). In this script the `Menu_SearchItems` external is used to collect all Union menu scripts that are placed into the Union & Plugins menu that will appear in the game if you use any of the plugins that use this feature. diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/mob.md b/docs/zengin/scripts/extenders/zparserextender/externals/mob.md index ee70843854..249ff70446 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/mob.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/mob.md @@ -1,7 +1,7 @@ --- -title: MOB functions +title: MOB functions --- -# MOB - interactive object functions +# MOB functions (zPE) Functions to manipulate interactive objects like destroying MOBs, setting lockpick combination and such. ## `Mob_Destroy` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/npc.md b/docs/zengin/scripts/extenders/zparserextender/externals/npc.md index 4419d495d0..29ab440989 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/npc.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/npc.md @@ -1,7 +1,7 @@ --- title: NPC functions --- -# NPC - character functions +# NPC functions (zPE) NPC related functions. ## `Npc_SetAsHero` diff --git a/docs/zengin/scripts/extenders/zparserextender/externals/wld.md b/docs/zengin/scripts/extenders/zparserextender/externals/wld.md index 07582ee3fe..a2470cc62c 100644 --- a/docs/zengin/scripts/extenders/zparserextender/externals/wld.md +++ b/docs/zengin/scripts/extenders/zparserextender/externals/wld.md @@ -1,8 +1,8 @@ --- title: WLD functions --- -# WLD - world manipulation functions -Functions related to the world. +# WLD functions (zPE) +External functions related to the world. ## `Wld_ChangeLevel` !!! function "`Wld_ChangeLevel`" diff --git a/docs/zengin/scripts/externals/ai.md b/docs/zengin/scripts/externals/ai.md new file mode 100644 index 0000000000..7fe0d5b592 --- /dev/null +++ b/docs/zengin/scripts/externals/ai.md @@ -0,0 +1,920 @@ +--- +title: AI functions +--- +# AI functions (Vanilla) +Functions for working with NPCs AI queue. Every function is added to the AI queue of the specified NPC and executed in the order they were added. + +## Functions + +### `AI_AimAt` +!!! function "`AI_AimAt`" + Aims at the target with a ranged weapon (have to be drawn first) + ```dae + func void AI_AimAt(var C_NPC attacker, var C_NPC target) + ``` + + **Parameters** + + - `#!dae var C_NPC attacker` - instance of the attacker + - `#!dae var C_NPC target` - C_NPC instance of the target + +### `AI_AlignToFP` +!!! function "`AI_AlignToFP`" + Aligns the NPC to the Freepoint + ```dae + func void AI_AlignToFP(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_AlignToWP` +!!! function "`AI_AlignToWP`" + Aligns the NPC to the Waypoint + ```dae + func void AI_AlignToWP(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_Attack` +!!! function "`AI_Attack`" + Starts the combat AI (should be called in the ZS_Attack loop). + Uses the internal target that can be set by `Npc_SetTarget()` and `Npc_GetNextTarget()` + ```dae + func void AI_Attack(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_CanSeeNpc` +!!! function "`AI_CanSeeNpc`" + If `slf` can see `oth` starts given AI state function + ```dae + func void AI_CanSeeNpc(var C_NPC slf, var C_NPC oth, var func function) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the first NPC + - `#!dae var C_NPC oth` - instance of the second NPC + - `#!dae var func function` - AI state function to start (ZS_*) + +### `AI_ContinueRoutine` +!!! function "`AI_ContinueRoutine`" + Continues the daily routine. + Includes standing up + ```dae + func void AI_ContinueRoutine(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_Defend` +!!! function "`AI_Defend`" + Adds overlay message (`EV_DEFEND`) that ends when the NPC performs a parry triggered by another NPC's attack. + ```dae + func void AI_Defend(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_Dodge` +!!! function "`AI_Dodge`" + Makes the NPC dodge a bit backward + ```dae + func void AI_Dodge(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_DrawWeapon` +!!! function "`AI_DrawWeapon`" + Draws the equipped melee weapon + ```dae + func void AI_DrawWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_DropItem` +!!! function "`AI_DropItem`" + Drops the item with the specified item ID on the ground (works only in dialogs) + ```dae + func void AI_DropItem(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - item instance name + +### `AI_EquipArmor` +!!! function "`AI_EquipArmor`" + Equips armor from the inventory + ```dae + func void AI_EquipArmor(var C_NPC npc, var C_ITEM armor) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_ITEM armor` - armor instance to equip + +### `AI_EquipBestArmor` +!!! function "`AI_EquipBestArmor`" + Equips the best armor available in the NPCs inventory + ```dae + func void AI_EquipBestArmor(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_EquipBestMeleeWeapon` +!!! function "`AI_EquipBestMeleeWeapon`" + Equips the best melee weapon available in the NPCs inventory + ```dae + func void AI_EquipBestMeleeWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_EquipBestRangedWeapon` +!!! function "`AI_EquipBestRangedWeapon`" + Equips the best ranged weapon available in the NPCs inventory + ```dae + func void AI_EquipBestRangedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_FinishingMove` +!!! function "`AI_FinishingMove`" + Makes `attacker` kill `target` with a finishing move if possible + ```dae + func void AI_FinishingMove(var C_NPC attacker, var C_NPC target) + ``` + + **Parameters** + + - `#!dae var C_NPC attacker` - instance of the attacking NPC + - `#!dae var C_NPC target` - instance of the target NPC + +### `AI_Flee` +!!! function "`AI_Flee`" + Makes the NPC flee from the target + ```dae + func void AI_Flee(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_GotoFP` +!!! function "`AI_GotoFP`" + Finds the nearest available freepoint near the NPC, moves there, and aligns accordingly + ```dae + func void AI_GotoFP(var C_NPC npc, var string fpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string fpname` - name of the freepoint (could be only the middle part of the name: `FP_` + `fpname` + `_01`) + +### `AI_GotoNextFP` +!!! function "`AI_GotoNextFP`" + Finds an available freepoint within near the NPC (not the nearest one), moves there, and aligns accordingly. + Useful for NPCs that are already at the freepoint + ```dae + func void AI_GotoNextFP(var C_NPC npc, var string fpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string fpname` - name of the freepoint (could be only the middle part of the name: `FP_` + `fpname` + `_01`) + +### `AI_GotoItem` +!!! function "`AI_GotoItem`" + Makes the NPC go to the specified item + ```dae + func void AI_GotoItem(var C_NPC npc, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_ITEM itm` - instance of the item + +### `AI_GotoNpc` +!!! function "`AI_GotoNpc`" + Makes `slf` go to `oth` + ```dae + func void AI_GotoNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_GotoSound` +!!! function "`AI_GotoSound`" + Makes NPC go to the source of the sound + ```dae + func void AI_GotoSound(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_GotoWP` +!!! function "`AI_GotoWP`" + NPC goes to the specified waypoint + ```dae + func void AI_GotoWP(var C_NPC npc, var string wpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string wpname` - name of the waypoint + +### `AI_LookAt` +!!! function "`AI_LookAt`" + Makes NPC look at the target object (only head moves) + ```dae + func void AI_LookAt(var C_NPC npc, var string target) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string target` - name of the object to look at + +### `AI_LookAtNpc` +!!! function "`AI_LookAtNpc`" + Makes `slf` looks at `oth` (only head moves) + ```dae + func void AI_LookAtNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_Output` +!!! function "`AI_Output`" + Makes `slf` say a line of text to `oth`. + The actual text is defined by the comment after the function call + ```dae + func void AI_Output(var C_NPC slf, var C_NPC oth, var string outputname) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - C_NPC instance of the target NPC + - `#!dae var string outputname` - name of the output and the associated .wav file + + !!! Example + ```dae + AI_Output (self ,other, "DIA_Addon_Xardas_Hello_14_00"); //There you are again! (smiling) I never thought the two of us would meet again. + ``` + +### `AI_OutputSVM` +!!! function "`AI_OutputSVM`" + Makes `slf` say an SVM text to `oth` + ```dae + func void AI_OutputSVM(var C_NPC slf, var C_NPC oth, var string svmname) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - C_NPC instance of the target NPC + - `#!dae var string svmname` - name of the SVM + +### `AI_OutputSVM_Overlay` +!!! function "`AI_OutputSVM_Overlay`" + Makes `slf` say an SVM text to `oth`, but does not wait for the SVM to finish before executing the next AI command. + Useful for comments right before and during combat + ```dae + func void AI_OutputSVM_Overlay(var C_NPC slf, var C_NPC oth, var string svmname) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - C_NPC instance of the target NPC + - `#!dae var string svmname` - name of the SVM + +### `AI_PlayAni` +!!! function "`AI_PlayAni`" + Plays an animation on the NPC + ```dae + func void AI_PlayAni(var C_NPC npc, var string aniname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string aniname` - name of the animation UPPERCASE + +### `AI_PlayAniBS` +!!! function "`AI_PlayAniBS`" + Plays an animation on the NPC and sets its body state + ```dae + func void AI_PlayAniBS(var C_NPC npc, var string aniname, var int bodystate) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string aniname` - name of the animation UPPERCASE + - `#!dae var int bodystate` - body state + +### `AI_PlayFX` +!!! function "`AI_PlayFX`" + Plays a visual effect (VFX) + ```dae + func void AI_PlayFX(var C_NPC origin, var instance target, var string effect) + ``` + + **Parameters** + + - `#!dae var C_NPC origin` - NPC who is the effect origin and also to whose AI queue the function is added + - `#!dae var instance target` - instance of the effect target object + - `#!dae var string effect` - name of the visual effect + + !!! Warning + This function is only available in Gothic 2 + +### `AI_StopFX` +!!! function "`AI_StopFX`" + Stops a visual effect (VFX) + ```dae + func void AI_StopFX(var C_NPC npc, var string effect) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string effect` - name of the visual effect + + !!! Warning + This function is only available in Gothic 2 + +### `AI_PointAt` +!!! function "`AI_PointAt`" + Makes NPC point at the target object + ```dae + func void AI_PointAt(var C_NPC npc, var string target) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae name` - name of the waypoint or object + +### `AI_PointAtNpc` +!!! function "`AI_PointAtNpc`" + Makes `slf` point with hand at `oth` + ```dae + func void AI_PointAtNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_PrintScreen` +!!! function "`AI_PrintScreen`" + Prints a message on the screen. The function is queued on `hero` AI queue. + ```dae + func int AI_PrintScreen(var string text, var int posx, var int posy, var string font, var int timesec) + ``` + + **Parameters** + + - `#!dae var string text` - message to print + - `#!dae var int posx` - x position as percent (-1 to center) + - `#!dae var int posy` - y position as percent (-1 to center) + - `#!dae var string font` - font to use + - `#!dae var int timesec` - display duration in seconds + + !!! Warning + This function is only available in Gothic 2 + +### `AI_ProcessInfos` +!!! function "`AI_ProcessInfos`" + Opens a dialog window with NPS's C_INFO instances if its state is `ZS_TALK`. + When called on `hero`, the dialog window for the currently contrloled NPC instance will be opened. + ```dae + func void AI_ProcessInfos(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_ReadyMeleeWeapon` +!!! function "`AI_ReadyMeleeWeapon`" + Draws the equipped melee weapon + ```dae + func void AI_ReadyMeleeWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_ReadyRangedWeapon` +!!! function "`AI_ReadyRangedWeapon`" + Draws the equipped ranged weapon + ```dae + func void AI_ReadyRangedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_ReadySpell` +!!! function "`AI_ReadySpell`" + Readies a spell + ```dae + func void AI_ReadySpell(var C_NPC npc, var int spellid, var int investmana) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int spellid` - ID of the spell + - `#!dae var int investmana` - amount of mana to invest + +### `AI_UnreadySpell` +!!! function "`AI_UnreadySpell`" + Unreadies a spell + ```dae + func void AI_UnreadySpell(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_RemoveWeapon` +!!! function "`AI_RemoveWeapon`" + Puts away the drawn weapon + ```dae + func void AI_RemoveWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_SetNpcsToState` +!!! function "`AI_SetNpcsToState`" + Sets all NPCs within a radius of x cm to the specified ZS state + ```dae + func void AI_SetNpcsToState(var C_NPC npc, var func state, var int radius) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var func state` - ZS state function + - `#!dae var int radius` - radius in cm + +### `AI_SetWalkmode` +!!! function "`AI_SetWalkmode`" + Specifies the walk mode (run, walk, sneak) of the NPC + ```dae + func void AI_SetWalkmode(var C_NPC npc, var int mode) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int mode` - walk mode + +### `AI_ShootAt` +!!! function "`AI_ShootAt`" + Shoots at the target with a ranged weapon + ```dae + func void AI_ShootAt(var C_NPC attacker, var C_NPC target) + ``` + + **Parameters** + + - `#!dae var C_NPC attacker` - instance of the attacker NPC + - `#!dae var C_NPC target` - instance of the target NPC + +### `AI_Snd_Play` +!!! function "`AI_Snd_Play`" + Plays a sound (queued) + ```dae + func void AI_Snd_Play(var C_NPC npc, var string sndName) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to whose AI queue the function is added + - `#!dae var string sndName` - C_SFX instance name + + !!! Warning + This function is only available in Gothic 2 + +### `AI_Snd_Play3D` +!!! function "`AI_Snd_Play3D`" + Plays a sound at the position of the npc (queued) + ```dae + func void AI_Snd_Play3D(var C_NPC npc, var C_NPC origin, var string sndName) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to whose AI queue the function is added + - `#!dae var C_NPC origin` - instance of the NPC whose position the sound is played at + - `#!dae var string sndName` - C_SFX instance name + + !!! Warning + This function is only available in Gothic 2 + +### `AI_StandUp` +!!! function "`AI_StandUp`" + Makes NPC stand up from a sitting or lying position + ```dae + func void AI_StandUp(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_StandUpQuick` +!!! function "`AI_StandUpQuick`" + Makes NPC stand up from a sitting or lying position without playing transition animations + ```dae + func void AI_StandUpQuick(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_StartState` +!!! function "`AI_StartState`" + Puts the NPC into the specified AI state (ZS_*) + ```dae + func void AI_StartState(var C_NPC npc, var func state, var int statebehaviour, var string wpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var func state` - function representing the AI state (ZS_*) + - `#!dae var int statebehaviour` - `0` to end the current state immediately, `1` to finish it properly + - `#!dae var string wpname` - name of the waypoint to do the action at + +### `AI_StopAim` +!!! function "`AI_StopAim`" + Makes the NPC stop aiming at the target + ```dae + func void AI_StopAim(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_StopLookAt` +!!! function "`AI_StopLookAt`" + Makes npc stop looking at a target and returns to the default forward gaze + ```dae + func void AI_StopLookAt(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_StopPointAt` +!!! function "`AI_StopPointAt`" + Makes the NPC stop pointing at the target + ```dae + func void AI_StopPointAt(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_StopProcessInfos` +!!! function "`AI_StopProcessInfos`" + Exits the dialog window of the NPC + ```dae + func void AI_StopProcessInfos(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_TakeItem` +!!! function "`AI_TakeItem`" + The NPC goes to the specified item and takes it + ```dae + func void AI_TakeItem(var C_NPC npc, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_ITEM itm` - instance of the item + +### `AI_Teleport` +!!! function "`AI_Teleport`" + Teleports the NPC to the specified location + ```dae + func void AI_Teleport(var C_NPC npc, var string waypoint) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string waypoint` - name of the waypoint or object to teleport to + +### `AI_TurnAway` +!!! function "`AI_TurnAway`" + Makes `slf` turn away from `oth` + ```dae + func void AI_TurnAway(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_TurnToNpc` +!!! function "`AI_TurnToNpc`" + Makes `slf` turn torwards `oth` + ```dae + func void AI_TurnToNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_TurnToSound` +!!! function "`AI_TurnToSound`" + Makes NPC turn to the source of the sound + ```dae + func void AI_TurnToSound(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_UnequipArmor` +!!! function "`AI_UnequipArmor`" + Unequips the current armor + ```dae + func void AI_UnequipArmor(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_UnequipWeapons` +!!! function "`AI_UnequipWeapons`" + Unequips all weapons + ```dae + func void AI_UnequipWeapons(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_UseItem` +!!! function "`AI_UseItem`" + Makes the NPC use an item to the end of its use state + ```dae + func void AI_UseItem(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - name of the item instance + +### `AI_UseItemToState` +!!! function "`AI_UseItemToState`" + Makes the NPC use an item until it reaches the target state + ```dae + func void AI_UseItemToState(var C_NPC npc, var int iteminstance, var int state) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - name of the item instance + - `#!dae var int state` - target state (1 for S1 etc. -1 to end the action) + +### `AI_UseMob` +!!! function "`AI_UseMob`" + Uses an intetactive object with the specified schema name until it reaches the target state. + If the target state is already present, the NPC will move to the MOB but do nothing + ```dae + func int AI_UseMob(var C_NPC npc, var string schemename, var int targetstate) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string schemename` - name of the schema (e.g. `BENCH`) + - `#!dae var int targetstate` - target state (1 for S1 etc. -1 to end the action) + + **Return value** + The function returns TRUE if the mob was used, FALSE otherwise + +### `AI_Wait` +!!! function "`AI_Wait`" + Makes NPC wait for a specified number of seconds + ```dae + func void AI_Wait(var C_NPC npc, var float timesec) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var float timesec` - float number of seconds to wait + +### `AI_WaitMS` +!!! function "`AI_WaitMS`" + Makes NPC wait for a specified number of milliseconds + ```dae + func void AI_WaitMS(var C_NPC npc, var int timems) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int timems` - number of milliseconds to wait + +### `AI_WaitTillEnd` +!!! function "`AI_WaitTillEnd`" + Makes `slf` wait until `oth` finishes its current AI command (does not work with AI overlays) + ```dae + func void AI_WaitTillEnd(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the waiting NPC + - `#!dae var C_NPC oth` - instance of the NPC to wait for + +## Deprecated + +### `AI_Ask` +!!! function "`AI_Ask`" + Probably relic of the old dialog system + ```dae + func void AI_Ask(var C_NPC npc, var func anseryes, var func answerno) + ``` + +### `AI_AskText` +!!! function "`AI_AskText`" + Probably relic of the old dialog system + ```dae + func void AI_AskText(var C_NPC npc, var func funcyes, var func funcno, var string stryes, var string strno) + ``` + +### `AI_WaitForQuestion` +!!! function "`AI_WaitForQuestion`" + Probably relic of the old dialog system + ```dae + func void AI_WaitForQuestion(var C_NPC npc, var func scriptfunc) + ``` + +### `AI_CombatReactToDamage` +!!! function "`AI_CombatReactToDamage`" + Does nothing + ```dae + func void AI_CombatReactToDamage(var instance n0) + ``` + +### `AI_PlayCutscene` +!!! function "`AI_PlayCutscene`" + Relic of the cutscene system + Starts a cutscene with the specified name + ```dae + func void AI_PlayCutscene(var C_NPC npc, var string csname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string csname` - string name of the cutscene + +### `AI_Quicklook` +!!! function "`AI_Quicklook`" + `T_QLOOK` animation is missing + Makes `slf` looks at `oth` for 2 seconds (only head moves) + ```dae + func void AI_Quicklook(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_TakeMob` +!!! function "`AI_TakeMob`" + Relic of the mob carrying system + ```dae + func void AI_TakeMob(var C_NPC npc, var string mobname) + ``` + +### `AI_DropMob` +!!! function "`AI_DropMob`" + Relic of the mob carrying system + ```dae + func void AI_DropMob(var C_NPC npc) + +### `AI_WhirlAround` +!!! function "`AI_WhirlAround`" + `S_SURPRISE` animation is missing + Makes `slf` quickly turn to `oth` and play a surprise animation + ```dae + func void AI_WhirlAround(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + +### `AI_WhirlAroundToSource` +!!! function "`AI_WhirlAroundToSource`" + `S_SURPRISE` animation is missing + Makes NPC quickly turn to sound source and play a surprise animation + ```dae + func void AI_WhirlAroundToSource(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `AI_LookForItem` +!!! function "`AI_LookForItem`" + Not used in the original scripts, does nothing + NPC searches for the item with the specified instance name + ```dae + func void AI_LookForItem(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - instance name of the item + + !!! Warning + The function is only present in Gothic 1. + +## zParserExtender +zParserExtender implements quite a few new [AI external functions](../extenders/zparserextender/externals/ai.md). \ No newline at end of file diff --git a/docs/zengin/scripts/externals/dialog.md b/docs/zengin/scripts/externals/dialog.md new file mode 100644 index 0000000000..4ff9d5359f --- /dev/null +++ b/docs/zengin/scripts/externals/dialog.md @@ -0,0 +1,38 @@ +# Dialog functions +Functions related to the dialog system. For more information about the dialog system, see [`C_INFO`](../classes/c_info.md). + +## Functions + +### `InfoManager_HasFinished` +!!! function "`InfoManager_HasFinished`" + Checks if the player finished the dialog + ```dae + func int InfoManager_HasFinished() + ``` + + **Return value** + The function returns TRUE if the player finished the dialog, FALSE otherwise + +### `Info_AddChoice` +!!! function "`Info_AddChoice`" + Adds a dialog choice to the specified C_INFO instance + ```dae + func void Info_AddChoice(var C_INFO dialog, var string text, var func fnc) + ``` + + **Parameters** + + - `#!dae var C_INFO dialog` - dialog instance + - `#!dae var string text` - description of the choice + - `#!dae var func fnc` - function to execute if the choice is selected + +### `Info_ClearChoices` +!!! function "`Info_ClearChoices`" + Clears the choices of the specified C_INFO instance + ```dae + func void Info_ClearChoices(var C_INFO dialog) + ``` + + **Parameters** + + - `#!dae var C_INFO dialog` - dialog instance diff --git a/docs/zengin/scripts/externals/doc.md b/docs/zengin/scripts/externals/doc.md index be8ae3c415..fcd25ab15d 100644 --- a/docs/zengin/scripts/externals/doc.md +++ b/docs/zengin/scripts/externals/doc.md @@ -1,11 +1,13 @@ --- title: Doc functions --- -# Doc external functions +# Doc functions Doc functions are used to control the document manager. They allow you to fine tune the display of maps, letters and books. -## `Doc_Create` +## Functions + +### `Doc_Create` !!! function "`Doc_Create`" Creates a new instance of the document manager and returns its ID. ```dae @@ -21,7 +23,7 @@ Doc functions are used to control the document manager. They allow you to fine t nDocID = Doc_Create(); ``` -## `Doc_CreateMap` +### `Doc_CreateMap` !!! function "`Doc_CreateMap`" Creates a new instance of the document manager with the arrow showing players position on the map and returns its ID. ```dae @@ -37,7 +39,7 @@ Doc functions are used to control the document manager. They allow you to fine t nDocID = Doc_CreateMap(); ``` -## `Doc_SetLevel` +### `Doc_SetLevel` !!! function "`Doc_SetLevel`" Set a world level to a map. This maps the texture of the document to the bounding box of the provided level. ```dae @@ -55,12 +57,8 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_SetLevel(nDocID, "WORLD.ZEN"); ``` -## `Doc_SetLevelCoords` +### `Doc_SetLevelCoords` !!! function "`Doc_SetLevelCoords`" - - !!! Warning - This function is only available in Gothic 2 - Sets the map coordinates. This is used to map smaller portions of the world map to the document map to correctly show players position on the map. ```dae func void Doc_SetLevelCoords(var int docID, var int left, var int top, var int right, var int bottom) {}; @@ -78,8 +76,11 @@ Doc functions are used to control the document manager. They allow you to fine t ```dae Doc_SetLevelCoords(nDocID, -28000, 50500, 95500, -42500); ``` + + !!! Warning + This function is only available in Gothic 2 -## `Doc_SetFont` +### `Doc_SetFont` !!! function "`Doc_SetFont`" Sets a `font` to be used on a `page` in a document with `docID`. Can be called multiple times to display different lines with different fonts. @@ -98,7 +99,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_SetFont(nDocID, -1, "FONT_10_BOOK.TGA"); ``` -## `Doc_SetPages` +### `Doc_SetPages` !!! function "`Doc_SetPages`" Sets the number of pages `numOfPages` of the document. ```dae @@ -116,7 +117,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_SetPages(nDocID, 2); ``` -## `Doc_SetPage` +### `Doc_SetPage` !!! function "`Doc_SetPage`" Set `page` to have `texture` as a background with `scale`. ```dae @@ -136,7 +137,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_SetPage(nDocID, 1, "Book_Mage_R.tga", FALSE); ``` -## `Doc_SetMargins` +### `Doc_SetMargins` !!! function "`Doc_SetMargins`" Sets text margins of the page ```dae @@ -166,7 +167,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_SetMargins(nDocID, 0, 275, 20, 30, 20, TRUE); ``` -## `Doc_PrintLine` +### `Doc_PrintLine` !!! function "`Doc_PrintLine`" Prints a line of `text` (font is set using [Doc_SetFont](#doc_setfont)) onto the document with `docID`, onto the `page`. Does not split the text into multiple lines if they do not fit onto the page. ```dae @@ -185,7 +186,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_PrintLine(nDocID, 0, "The Book"); ``` -## `Doc_PrintLines` +### `Doc_PrintLines` !!! function "`Doc_PrintLines`" Prints a line of `text` (font is set using [Doc_SetFont](#doc_setfont)) onto the document with `docID`, onto the `page`. Splits the text into multiple lines if they do not fit onto the page. ```dae @@ -204,7 +205,7 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_PrintLines(nDocID, 0, "But now his army was trapped. The situation was hopeless, even though his army greatly outnumbered the enemy. Lee, a war hero from Myrtana, had lured him into this trap. The heavy cavalry had been unable to fight on the thick, swamped ground of the narrow valley. Lee's soldiers had occupied the range of hills surrounding the swamp, and they had struck repeatedly, decimating the army. The desperate sallies his troops had launched had been cut short in pools of blood. He was beaten."); ``` -## `Doc_Show` +### `Doc_Show` !!! function "`Doc_Show`" Display the document using the document manager ID ```dae @@ -225,105 +226,30 @@ Doc functions are used to control the document manager. They allow you to fine t Doc_Show(nDocID); ``` -## Externals with docu comments - -```dae -/// Creates a new instance of the document manager and returns its ID. -/// -/// @return Returns the ID of the document manager instance. -func int Doc_Create() {}; - -/// Create a new instance of the document manager with the arrow showing players position on the map and returns its ID. -/// -/// @return Returns the ID of the document manager instance. -func int Doc_CreateMap() {}; - -/// Prints a line of `text` onto the document with `docID`, onto the `page`. -/// Does not line break -/// -/// @param docID document manager ID -/// @param page page index -/// @param text text to be printed -func void Doc_PrintLine(var int docID, var int page, var string text) {}; - -/// Prints a line of `text` onto the document with `docID`, onto the `page`. The `text` is automatically split into multiple lines -/// -/// @param docID document manager ID -/// @param page page index -/// @param text text to be printed -func void Doc_PrintLines(var int docID, var int page, var string text) {}; - -/// Sets a `font` to be used on a `page` in a document with `docID`. Can be called multiple times to display different lines with different fonts. -/// -/// @param docID document manager ID -/// @param page page index -/// @param font font to be used -func void Doc_SetFont(var int docID, var int page, var string font) {}; - -/// Sets the number of pages `numOfPages` of the document. -/// -/// @param docID document manager ID -/// @param numOfPages number of pages -func void Doc_SetPages(var int docID, var int numOfPages) {}; - -/// Set `page` to have `texture` as a background with `scale`. -/// -/// @param docID document manager ID -/// @param page page index, if set to `-1`, settings are applied to all pages -/// @param texture texture of the background -/// @param scale scale of the texture, if set to 1, there will be no resizing -func void Doc_SetPage(var int docID, var int page, var string texture, var int scale) {}; - -/// Set a world level to a map. -/// -/// @param docID document manager ID -/// @param level name of the ZEN file -func void Doc_SetLevel(var int docID, var string level) {}; - -/// Sets the map coordinates. -/// -/// @param docID document manager ID -/// @param left left -/// @param top top -/// @param right top -/// @param bottom bottom -func void Doc_SetLevelCoords(var int docID, var int left, var int top, var int right, var int bottom) {}; - -/// Sets text margins of the page -/// -/// @param docID document manager ID -/// @param page page index, if set to `-1`, settings are applied to all pages -/// @param left left margin -/// @param top top margin -/// @param right right margin -/// @param bottom bottom margin -/// @param pixels `TRUE` to use pixels, `FALSE` to use virtual coordinates -func void Doc_SetMargins(var int docID, - var int page, - var int left, - var int top, - var int right, - var int bottom, - var int pixels) {}; - -/// Display the document using the document manager ID -/// -/// @param docID document manager ID -func void Doc_Show(var int docID) {}; - - - -/// deprecated -func void Doc_Open (var string Texture) {}; - -/// deprecated -func void Doc_Font(var string Font) {}; - -/// deprecated -func void Doc_Print (var string Text) {}; - -/// deprecated -func void Doc_MapCoordinates(var string s0, +## Deprecated + +### `Doc_Open` +!!! function "`Doc_Open`" + ```dae + func void Doc_Open (var string Texture) + ``` + +### `Doc_Font` +!!! function "`Doc_Font`" + ```dae + func void Doc_Font(var string Font) + ``` + +### `Doc_Print` +!!! function "`Doc_Print`" + ```dae + func void Doc_Print (var string Text) + ``` + +### `Doc_MapCoordinates` +!!! function "`Doc_MapCoordinates`" + ```dae + func void Doc_MapCoordinates(var string s0, var float r1, var float r2, var float r3, @@ -331,7 +257,5 @@ func void Doc_MapCoordinates(var string s0, var float r5, var float r6, var float r7, - var float r8) {}; -``` - - + var float r8) + ``` diff --git a/docs/zengin/scripts/externals/externals.d b/docs/zengin/scripts/externals/externals.d deleted file mode 100644 index 6750beba60..0000000000 --- a/docs/zengin/scripts/externals/externals.d +++ /dev/null @@ -1,353 +0,0 @@ -func void AI_AimAt(var c_npc attacker, var c_npc target) {}; -func void AI_AlignToFP(var c_npc self) {}; -func void AI_AlignToWP(var c_npc self) {}; -func void AI_AskText(var c_npc self, var func funcyes, var func funcno, var string stryes, var string strno) {}; -func void AI_Ask(var c_npc self, var func anseryes, var func answerno) {}; -func void AI_Attack(var c_npc self) {}; -func void AI_CanSeeNpc(var instance n0, var instance n1, var func f2) {}; -func void AI_CombatReactToDamage(var instance n0) {}; -func void AI_ContinueRoutine(var c_npc self) {}; -func void AI_Defend(var c_npc self) {}; -func void AI_Dodge(var c_npc npc) {}; -func void AI_DrawWeapon(var c_npc n0) {}; -func void AI_DropItem(var c_npc self, var int itemid) {}; -func void AI_DropMob(var instance n0) {}; -func void AI_EquipArmor(var c_npc owner, var c_item armor_from_owners_inventory) {}; -func void AI_EquipBestArmor(var c_npc self) {}; -func void AI_EquipBestMeleeWeapon(var c_npc self) {}; -func void AI_EquipBestRangedWeapon(var c_npc self) {}; -func void AI_FinishingMove(var c_npc self, var c_npc other) {}; -func void AI_Flee(var c_npc self) {}; -func void AI_GotoFP(var c_npc self, var string fpname) {}; -func void AI_GotoItem(var c_npc self, var c_item item) {}; -func void AI_GotoNextFP(var c_npc self, var string fpname) {}; -func void AI_GotoNpc(var c_npc self, var c_npc other) {}; -func void AI_GotoSound(var c_npc n0) {}; -func void AI_GotoWP(var c_npc n0, var string s0) {}; -func void AI_LookAtNpc(var c_npc self, var c_npc other) {}; -func void AI_LookAt(var c_npc self, var string name) {}; -func void AI_LookForItem(var c_npc self, var int instance) {}; -func void AI_OutputSVM_Overlay(var c_npc self, var c_npc target, var string svmname) {}; -func void AI_OutputSVM(var c_npc self, var c_npc target, var string svmname) {}; -func void AI_Output(var c_npc self, var c_npc target, var string outputname) {}; -func void AI_PlayAniBS(var c_npc npc, var string aniname, var int bodystate) {}; -func void AI_PlayAni(var c_npc n0, var string s0) {}; -func void AI_PlayCutscene(var c_npc self, var string csname) {}; -func void AI_PlayFX(var instance n0, var instance n1, var string s2) {}; -func void AI_PointAtNpc(var c_npc self, var c_npc other) {}; -func void AI_PointAt(var c_npc self, var string name) {}; -func int AI_PrintScreen(var string s0, var int i1, var int i2, var string s3, var int i4) {}; -func void AI_ProcessInfos(var instance n0) {}; -func void AI_Quicklook(var c_npc self, var c_npc other) {}; -func void AI_QuickLook(var instance n0, var instance n1) {}; -func void AI_ReadyMeleeWeapon(var c_npc self) {}; -func void AI_ReadyRangedWeapon(var c_npc self) {}; -func void AI_ReadySpell(var c_npc self, var int spellid, var int investmana) {}; -func void AI_RemoveWeapon(var c_npc n0) {}; -func void AI_SetNpcsToState(var c_npc self, var func aistatefunc, var int radius) {}; -func void AI_SetWalkmode(var c_npc n, var int n0) {}; -func void AI_SetWalkMode(var instance n0, var int i1) {}; -func void AI_ShootAt(var c_npc attacker, var c_npc target) {}; -func void AI_Snd_Play(var instance n0, var string s1) {}; -func void AI_Snd_Play3D(var instance n0, var instance n1, var string s2) {}; -func void AI_StandUpQuick(var c_npc self) {}; -func void AI_StandUp(var c_npc self) {}; -func void AI_StartState(var c_npc self, var func what, var int statebehaviour, var string wpname) {}; -func void AI_StopAim(var c_npc attacker) {}; -func void AI_StopFX(var instance n0, var string s1) {}; -func void AI_StopLookAt(var c_npc self) {}; -func void AI_StopPointAt(var c_npc self) {}; -func void AI_StopProcessInfos(var c_npc npc) {}; -func void AI_TakeItem(var c_npc self, var c_item item) {}; -func void AI_TakeMob(var instance n0, var string s1) {}; -func void AI_Teleport(var c_npc self, var string waypoint) {}; -func void AI_TurnAway(var c_npc n0, var c_npc n1) {}; -func void AI_TurnToNpc(var c_npc n0, var c_npc n1) {}; -func void AI_TurnToSound(var c_npc self) {}; -func void AI_UnequipArmor(var c_npc self) {}; -func void AI_UnequipWeapons(var c_npc self) {}; -func void AI_UnreadySpell(var c_npc self) {}; -func void AI_UseItemToState(var c_npc self, var int iteminstance, var int state) {}; -func void AI_UseItem(var c_npc self, var int iteminstance) {}; -func int AI_UseMob(var c_npc self, var string schemename, var int targetstate) {}; -func void AI_WaitForQuestion(var c_npc self, var func scriptfunc) {}; -func void AI_WaitMS(var instance n0, var int i1) {}; -func void AI_WaitTillEnd(var c_npc self, var c_npc other) {}; -func void AI_Wait(var c_npc n0, var float n1) {}; -func void AI_WhirlAroundToSource(var instance n0) {}; -func void AI_WhirlAround(var c_npc self, var c_npc other) {}; -func void Apply_Options_Audio() {}; -func void Apply_Options_Controls() {}; -func void Apply_Options_Game() {}; -func void Apply_Options_Performance() {}; -func void Apply_Options_Video() {}; -func string ConcatStrings(var string str1, var string str2) {}; -func void CreateInvItems(var c_npc n0, var int n1, var int n2) {}; -func void CreateInvItem(var c_npc n0, var int n1) {}; - -func int Doc_Create() {}; -func int Doc_CreateMap() {}; -func void Doc_Font (var string Font) {}; -func void Doc_Font(var string s0) {}; -func void Doc_MapCoordinates (var string Level, var float GameX1, var float GameY1, var float PixelX1, var float PixelY1, var float GameX2, var float GameY2, var float PixelX2, var float PixelY2) {}; -func void Doc_MapCoordinates(var string s0, var float r1, var float r2, var float r3, var float r4, var float r5, var float r6, var float r7, var float r8) {}; -func void Doc_Open(var string s0) {}; -func void Doc_Open (var string Texture) {}; -func void Doc_PrintLines(var int document, var int page, var string text) {}; -func void Doc_PrintLine(var int document, var int page, var string text) {}; -func void Doc_Print(var string s0) {}; -func void Doc_Print (var string Text) {}; -func void Doc_SetFont(var int document, var int page, var string font) {}; -func void Doc_SetLevelCoords(var int document, var int left, var int top, var int right, var int bottom) {}; -func void Doc_SetLevel(var int document, var string level) {}; -func void Doc_SetMargins(var int document, var int page, var int left, var int top, var int right, var int bottom, var int pixels) {}; -func void Doc_SetPages(var int document, var int count) {}; -func void Doc_SetPage(var int document, var int page, var string texture, var int scale) {}; -func void Doc_Show(var int document) {}; - -func void EquipItem(var c_npc n0, var int n1) {}; -func void ExitGame() {}; -func void ExitSession() {}; -func int FloatToInt(var float x) {}; -func string FloatToString(var float r0) {}; -func void Game_InitEnglish() {}; -func void Game_InitGerman() {}; -func int Hlp_CutscenePlayed(var string csname) {}; -func int Hlp_GetInstanceID(var c_item item) {}; -func c_npc Hlp_GetNpc(var int instancename) {}; -func int Hlp_IsItem(var c_item item, var int instancename) {}; -func int Hlp_IsValidItem(var c_item item) {}; -func int Hlp_IsValidNpc(var c_npc self) {}; -func int Hlp_Random(var int n0) {}; -func int Hlp_StrCmp(var string s1, var string s2) {}; -func void Info_AddChoice(var int i0, var string s1, var func f2) {}; -func void Info_ClearChoices(var int i0) {}; -func int InfoManager_HasFinished() {}; -func void IntroduceChapter(var string titel, var string untertitel, var string texture, var string sound, var int waittime) {}; -func float IntToFloat(var int x) {}; -func string IntToString(var int x) {}; - -/// Creates a new log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param logSection [LOG_MISSION, LOG_NOTE] indicates in which section to create the topic in -func void Log_CreateTopic(var string topicName, var int logSection) {}; -/// Adds an entry to a log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param entry content of the new entry -func void Log_AddEntry(var string topicName, var string entry) {}; -/// Changes the status of the topic with the name `topicName` -/// -/// @param topicName unique string used to identify and name the topic -/// @param status [LOG_RUNNING, LOG_SUCCESS, LOG_FAILED, LOG_OBSOLETE] the status to be set -func void Log_SetTopicStatus(var string TopicName, var int status) {}; - -func void Mdl_ApplyOverlayMDSTimed(var c_npc self, var string overlayname, var float timeticks) {}; -func void Mdl_ApplyOverlayMdsTimed(var instance n0, var string s1, var int i2) {}; -func void Mdl_ApplyOverlayMds(var c_npc n0, var string s1) {}; -func void Mdl_ApplyOverlayMDS(var instance n0, var string s1) {}; -func void Mdl_ApplyRandomAniFreq(var c_npc n0, var string s1, var float f2) {}; -func void Mdl_ApplyRandomAni(var c_npc n0, var string s1, var string s2) {}; -func void Mdl_ApplyRandomFaceAni(var c_npc self, var string name, var float timemin, var float timeminvar, var float timemax, var float timemaxvar, var float probmin) {}; -func void Mdl_RemoveOverlayMDS(var c_npc self, var string overlayname) {}; -func void Mdl_SetModelFatness(var c_npc self, var float fatness) {}; -func void Mdl_SetModelScale(var c_npc self, var float x, var float y, var float z) {}; -func void Mdl_SetVisualBody(var instance n0, var string s1, var int i2, var int i3, var string s4, var int i5, var int i6, var int i7) {}; -func void Mdl_SetVisual(var instance n0, var string s1) {}; -func void Mdl_StartFaceAni(var c_npc self, var string name, var float intensity, var float holdtime) {}; - -func void Mis_AddMissionEntry(var instance n0, var string s1) {}; -func int Mis_GetStatus(var int missionname) {}; -func int Mis_OnTime(var int missionname) {}; -func void Mis_RemoveMission(var instance n0) {}; -func void Mis_SetStatus(var int missionname, var int newstatus) {}; -func void Mob_CreateItems(var string mobname, var int iteminstance, var int amount) {}; -func int Mob_HasItems(var string mobname, var int iteminstance) {}; -func int Npc_AreWeStronger(var c_npc self, var c_npc other) {}; -func int Npc_CanSeeItem(var c_npc npc1, var c_item item) {}; -func int Npc_CanSeeNpcFreeLOS(var c_npc self, var c_npc other) {}; -func int Npc_CanSeeNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_CanSeeSource(var c_npc self) {}; -func void Npc_ClearAIQueue(var c_npc self) {}; -func void Npc_ClearInventory(var instance n0) {}; -func void Npc_CreateSpell(var c_npc self, var int spellnr) {}; -func int Npc_DeleteNews(var instance n0, var int i1) {}; -func void Npc_ExchangeRoutine(var c_npc self, var string routinename) {}; -func int Npc_GetActiveSpellCat(var c_npc self) {}; -func int Npc_GetActiveSpellIsScroll(var instance n0) {}; -func int Npc_GetActiveSpellLevel(var c_npc self) {}; -func int Npc_GetActiveSpell(var c_npc self) {}; -func int Npc_GetAttitude(var c_npc self, var c_npc other) {}; -func int Npc_GetBodyState(var c_npc self) {}; -func int Npc_GetComrades(var instance n0) {}; -func string Npc_GetDetectedMob(var c_npc self) {}; -func int Npc_GetDistToItem(var c_npc npc, var c_item item) {}; -func int Npc_GetDistToNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_GetDistToPlayer(var c_npc npc1) {}; -func int Npc_GetDistToWP(var c_npc self, var string wpname) {}; -func c_item Npc_GetEquippedArmor(var c_npc n0) {}; -func c_item Npc_GetEquippedMeleeWeapon(var c_npc n0) {}; -func c_item Npc_GetEquippedRangedWeapon(var c_npc n0) {}; -func int Npc_GetGuildAttitude(var c_npc npc, var c_npc npc) {}; -func int Npc_GetHeightToItem(var instance n0, var instance n1) {}; -func int Npc_GetHeightToNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_GetInvItemBySlot(var c_npc self, var int category, var int slotnr) {}; -func c_item Npc_GetInvItem(var c_npc self, var int iteminstance) {}; -func int Npc_GetLastHitSpellCat(var c_npc self) {}; -func int Npc_GetLastHitSpellID(var c_npc self) {}; -func instance Npc_GetLookAtTarget(var instance n0) {}; -func string Npc_GetNearestWP(var c_npc self) {}; -func c_npc Npc_GetNewsOffender(var c_npc self, var int newsnumber) {}; -func c_npc Npc_GetNewsVictim(var c_npc self, var int newsnumber) {}; -func c_npc Npc_GetNewsWitness(var c_npc self, var int newsnumber) {}; -func int Npc_GetNextTarget(var c_npc self) {}; -func string Npc_GetNextWP(var c_npc self) {}; -func int Npc_GetPermAttitude(var c_npc self, var c_npc other) {}; -func int Npc_GetPortalGuild(var instance n0) {}; -func instance Npc_GetPortalOwner(var instance n0) {}; -func c_item Npc_GetReadiedWeapon(var c_npc n0) {}; -func int Npc_GetStateTime(var c_npc self) {}; -func int Npc_GetTalentSkill(var instance n0, var int i1) {}; -func int Npc_GetTalentValue(var instance n0, var int i1) {}; -func int Npc_GetTarget(var c_npc self) {}; -func int Npc_GetTrueGuild(var c_npc npc) {}; -func int NPC_GiveInfo(var c_npc npc, var int important) {}; -func int Npc_GiveInfo(var instance n0, var int i1) {}; -func void Npc_GiveItem(var c_npc n0, var c_item n1, var c_npc n2) {}; -func int Npc_HasBodyFlag(var c_npc self, var int bodyflag) {}; -func int Npc_HasDetectedNpc(var c_npc self, var c_npc other) {}; -func int Npc_HasEquippedArmor(var c_npc self) {}; -func int Npc_HasEquippedMeleeWeapon(var c_npc self) {}; -func int Npc_HasEquippedRangedWeapon(var c_npc self) {}; -func int Npc_HasEquippedWeapon(var c_npc self) {}; -func int Npc_HasFightTalent(var c_npc self, var int tal) {}; -func int Npc_HasItems(var c_npc n0, var int iteminstance) {}; -func int Npc_HasNews(var c_npc self, var int newsid, var c_npc offender, var c_npc victim) {}; -func int Npc_HasOffered(var c_npc self, var c_npc other, var int iteminstance) {}; -func int Npc_HasRangedWeaponWithAmmo(var c_npc npc) {}; -func int Npc_HasReadiedMeleeWeapon(var c_npc self) {}; -func int Npc_HasReadiedRangedWeapon(var c_npc self) {}; -func int Npc_HasReadiedWeapon(var c_npc self) {}; -func int Npc_HasSpell(var c_npc self, var int spellid) {}; -func int Npc_HasTalent(var c_npc self, var int tal) {}; -func void Npc_ChangeAttribute(var c_npc self, var int atr, var int value) {}; -func int Npc_CheckAvailableMission(var c_npc npc, var int missionstate, var int important) {}; -func int Npc_CheckInfo(var c_npc npc, var int important) {}; -func int Npc_CheckOfferMission(var c_npc npc, var int important) {}; -func int Npc_CheckRunningMission(var c_npc npc, var int important) {}; -func int Npc_IsAiming(var c_npc self, var c_npc other) {}; -func int Npc_IsDead(var c_npc n0) {}; -func int Npc_IsDetectedMobOwnedByGuild(var c_npc user, var int ownerguild) {}; -func int Npc_IsDetectedMobOwnedByNpc(var c_npc user, var c_npc owner) {}; -func int Npc_IsDrawingSpell(var instance n0) {}; -func int Npc_IsDrawingWeapon(var instance n0) {}; -func int Npc_IsInCutscene(var c_npc self) {}; -func int Npc_IsInFightMode(var c_npc self, var int fmode) {}; -func int Npc_IsInPlayersRoom(var instance n0) {}; -func int Npc_IsInRoutine(var c_npc self, var func state) {}; -func int Npc_IsInState(var c_npc self, var func state) {}; -func int Npc_IsNear(var c_npc self, var c_npc other) {}; -func int Npc_IsNewsGossip(var c_npc self, var int newsnumber) {}; -func int Npc_IsNextTargetAvailable(var c_npc self) {}; -func int Npc_IsOnFP(var c_npc self, var string name) {}; -func int Npc_IsPlayerInMyRoom(var c_npc npc) {}; -func int Npc_IsPlayer(var c_npc player) {}; -func int Npc_IsVoiceActive(var instance n0) {}; -func int Npc_IsWayBlocked(var c_npc self) {}; -func int Npc_KnowsInfo(var c_npc self, var int infoinstance) {}; -func int Npc_KnowsPlayer(var c_npc self, var c_npc player) {}; -func void Npc_LearnSpell(var c_npc self, var int spellnr) {}; -func void Npc_MemoryEntryGuild(var c_npc self, var int source, var c_npc offender, var int newsid, var c_npc victimguild) {}; -func void Npc_MemoryEntry(var c_npc self, var int source, var c_npc offender, var int newsid, var c_npc victim) {}; -func int Npc_OwnedByGuild(var c_item item, var int guild) {}; -func int Npc_OwnedByNpc(var c_item item, var c_npc npc) {}; -func void Npc_PercDisable(var c_npc self, var int percid) {}; -func void Npc_PerceiveAll(var c_npc self) {}; -func void Npc_PercEnable(var c_npc self, var int percid, var func function) {}; -func void Npc_PlayAni(var instance n0, var string s1) {}; -func int Npc_RefuseTalk(var c_npc self) {}; -func void Npc_RemoveInvItems(var c_npc owner, var int iteminstance, var int amount) {}; -func void Npc_RemoveInvItem(var c_npc owner, var int iteminstance) {}; -func void Npc_SendPassivePerc(var c_npc npc1, var int perc_type, var c_npc npc2, var c_npc npc3) {}; -func void Npc_SendSinglePerc(var c_npc self, var c_npc target, var int percid) {}; -func int Npc_SetActiveSpellInfo(var c_npc npc, var int i1) {}; -func void Npc_SetAttitude(var c_npc self, var int att) {}; -func void Npc_SetKnowsPlayer(var c_npc self, var c_npc player) {}; -func void Npc_SetPercTime(var c_npc self, var float seconds) {}; -func void Npc_SetRefuseTalk(var c_npc self, var int timesec) {}; -func void Npc_SetStateTime(var c_npc self, var int seconds) {}; -func void Npc_SetTalentSkill(var instance n0, var int i1, var int i2) {}; -func void Npc_SetTalentValue(var instance n0, var int i1, var int i2) {}; -func void Npc_SetTarget(var c_npc self, var c_npc other) {}; -func void Npc_SetTeleportPos(var c_npc self) {}; -func void Npc_SetTempAttitude(var c_npc self, var int att) {}; -func void Npc_SetToFightMode(var c_npc self, var int weapon) {}; -func void Npc_SetToFistMode(var c_npc self) {}; -func int Npc_SetTrueGuild(var c_npc npc, var int guildid) {}; -func int Npc_StartItemReactModules(var c_npc self, var c_npc other, var c_item item) {}; -func void Npc_StopAni(var instance n0, var string s1) {}; -func int Npc_WasInState(var c_npc self, var func state) {}; -func int Npc_WasPlayerInMyRoom(var c_npc npc) {}; -func void Perc_SetRange(var int percid, var int range) {}; -func int PlayVideoEx(var string filename, var int screenblend, var int exitsession) {}; -func int PlayVideo(var string filename) {}; -func void PrintDebugCh(var int ch, var string text) {}; -func void PrintDebugInstCh(var int ch, var string text) {}; -func void PrintDebugInst(var string text) {}; -func void PrintDebug(var string s) {}; -func int PrintDialog(var int i0, var string s1, var int i2, var int i3, var string s4, var int i5) {}; -func void PrintMulti(var string s0, var string s1, var string s2, var string s3, var string s4) {}; -func void PrintScreen(var string msg, var int posx, var int posy, var string font, var int timesec) {}; -func void Print(var string s0) {}; -func void Rtn_Exchange(var string oldroutine, var string newroutine) {}; -func void SetPercentDone(var int percentdone) {}; -func int Snd_GetDistToSource(var c_npc self) {}; -func int Snd_IsSourceItem(var c_npc self) {}; -func int Snd_IsSourceNpc(var c_npc self) {}; -func void Snd_Play(var string s0) {}; -func void Snd_Play3D(var c_npc n0, var string s1) {}; -func void TA_BeginOverlay(var c_npc self) {}; -func void TA_CS(var c_npc self, var string csname, var string rolename) {}; -func void TA_EndOverlay(var c_npc self) {}; -func void Tal_Configure(var int i0, var int i1) {}; -func void TA_Min(var c_npc self, var int start_h, var int start_m, var int stop_h, var int stop_m, var func state, var string waypoint) {}; -func void TA_RemoveOverlay(var c_npc self) {}; -func void TA(var c_npc self, var int start_h, var int stop_h, var func state, var string waypoint) {}; -func void Update_ChoiceBox(var string s0) {}; -func void Wld_AssignRoomToGuild(var string s0, var int guild) {}; -func void Wld_AssignRoomToNpc(var string s0, var c_npc roomowner) {}; -func int Wld_DetectItem(var c_npc self, var int flags) {}; -func int Wld_DetectNpcExAtt(var instance n0, var int i1, var func f2, var int i3, var int i4, var int i5) {}; -func int Wld_DetectNpcEx(var instance n0, var int i1, var func f2, var int i3, var int i4) {}; -func int Wld_DetectNpc(var c_npc self, var int instance, var func aistate, var int guild) {}; -func int Wld_DetectPlayer(var c_npc self) {}; -func void Wld_ExchangeGuildAttitudes(var string name) {}; -func int Wld_GetDay() {}; -func int Wld_GetFormerPlayerPortalGuild() {}; -func c_npc Wld_GetFormerPlayerPortalOwner() {}; -func int Wld_GetGuildAttitude(var int guild1, var int guild2) {}; -func int Wld_GetMobState(var c_npc self, var string schemename) {}; -func int Wld_GetPlayerPortalGuild() {}; -func c_npc Wld_GetPlayerPortalOwner() {}; -func void Wld_InsertItem(var int iteminstance, var string spawnpoint) {}; -func void Wld_InsertNpcAndRespawn(var int instance, var string spawnpoint, var float spawndelay) {}; -func void Wld_InsertNpc(var int npcinstance, var string spawnpoint) {}; -func void Wld_InsertObject(var string s0, var string s1) {}; -func int Wld_IsFPAvailable(var c_npc self, var string fpname) {}; -func int Wld_IsFpAvailable(var instance n0, var string s1) {}; -func int Wld_IsMobAvailable(var c_npc self, var string schemename) {}; -func int Wld_IsNextFPAvailable(var c_npc self, var string fpname) {}; -func int Wld_IsNextFpAvailable(var instance n0, var string s1) {}; -func int Wld_IsRaining() {}; -func int Wld_IsTime(var int hour1, var int min1, var int hour2, var int min2) {}; -func void Wld_PlayEffect(var string effectinstance, var int originvob, var int targetvob, var int effectlevel, var int damage, var int damagetype, var int bisprojectile) {}; -func int Wld_RemoveItem(var c_item item) {}; -func void Wld_RemoveNpc(var int i0) {}; -func void Wld_SendTrigger(var string vobname) {}; -func void Wld_SendUntrigger(var string vobname) {}; -func void Wld_SetGuildAttitude(var int guild1, var int attitude, var int guild2) {}; -func void Wld_SetMobRoutine(var int hour1, var int min1, var string objname, var int state) {}; -func void Wld_SetObjectRoutine(var int hour1, var int min1, var string objname, var int state) {}; -func void Wld_SetTime(var int hour, var int min) {}; -func void Wld_SpawnNpcRange(var instance n0, var int i1, var int i2, var float r3) {}; diff --git a/docs/zengin/scripts/externals/externals_clean.d b/docs/zengin/scripts/externals/externals_clean.d deleted file mode 100644 index 0d67d9eea6..0000000000 --- a/docs/zengin/scripts/externals/externals_clean.d +++ /dev/null @@ -1,350 +0,0 @@ -func void AI_AimAt(var c_npc attacker, var c_npc target) {}; -func void AI_AlignToFP(var c_npc self) {}; -func void AI_AlignToWP(var c_npc self) {}; -func void AI_AskText(var c_npc self, var func funcyes, var func funcno, var string stryes, var string strno) {}; -func void AI_Ask(var c_npc self, var func anseryes, var func answerno) {}; -func void AI_Attack(var c_npc self) {}; -func void AI_CanSeeNpc(var instance n0, var instance n1, var func f2) {}; -func void AI_CombatReactToDamage(var instance n0) {}; -func void AI_ContinueRoutine(var c_npc self) {}; -func void AI_Defend(var c_npc self) {}; -func void AI_Dodge(var c_npc npc) {}; -func void AI_DrawWeapon(var c_npc n0) {}; -func void AI_DropItem(var c_npc self, var int itemid) {}; -func void AI_DropMob(var instance n0) {}; -func void AI_EquipArmor(var c_npc owner, var c_item armor_from_owners_inventory) {}; -func void AI_EquipBestArmor(var c_npc self) {}; -func void AI_EquipBestMeleeWeapon(var c_npc self) {}; -func void AI_EquipBestRangedWeapon(var c_npc self) {}; -func void AI_FinishingMove(var c_npc self, var c_npc other) {}; -func void AI_Flee(var c_npc self) {}; -func void AI_GotoFP(var c_npc self, var string fpname) {}; -func void AI_GotoItem(var c_npc self, var c_item item) {}; -func void AI_GotoNextFP(var c_npc self, var string fpname) {}; -func void AI_GotoNpc(var c_npc self, var c_npc other) {}; -func void AI_GotoSound(var c_npc n0) {}; -func void AI_GotoWP(var c_npc n0, var string s0) {}; -func void AI_LookAtNpc(var c_npc self, var c_npc other) {}; -func void AI_LookAt(var c_npc self, var string name) {}; -func void AI_LookForItem(var c_npc self, var int instance) {}; -func void AI_OutputSVM_Overlay(var c_npc self, var c_npc target, var string svmname) {}; -func void AI_OutputSVM(var c_npc self, var c_npc target, var string svmname) {}; -func void AI_Output(var c_npc self, var c_npc target, var string outputname) {}; -func void AI_PlayAniBS(var c_npc npc, var string aniname, var int bodystate) {}; -func void AI_PlayAni(var c_npc n0, var string s0) {}; -func void AI_PlayCutscene(var c_npc self, var string csname) {}; -func void AI_PlayFX(var instance n0, var instance n1, var string s2) {}; -func void AI_PointAtNpc(var c_npc self, var c_npc other) {}; -func void AI_PointAt(var c_npc self, var string name) {}; -func int AI_PrintScreen(var string s0, var int i1, var int i2, var string s3, var int i4) {}; -func void AI_ProcessInfos(var instance n0) {}; -func void AI_Quicklook(var c_npc self, var c_npc other) {}; -func void AI_QuickLook(var instance n0, var instance n1) {}; -func void AI_ReadyMeleeWeapon(var c_npc self) {}; -func void AI_ReadyRangedWeapon(var c_npc self) {}; -func void AI_ReadySpell(var c_npc self, var int spellid, var int investmana) {}; -func void AI_RemoveWeapon(var c_npc n0) {}; -func void AI_SetNpcsToState(var c_npc self, var func aistatefunc, var int radius) {}; -func void AI_SetWalkmode(var c_npc n, var int n0) {}; -func void AI_SetWalkMode(var instance n0, var int i1) {}; -func void AI_ShootAt(var c_npc attacker, var c_npc target) {}; -func void AI_Snd_Play(var instance n0, var string s1) {}; -func void AI_Snd_Play3D(var instance n0, var instance n1, var string s2) {}; -func void AI_StandUpQuick(var c_npc self) {}; -func void AI_StandUp(var c_npc self) {}; -func void AI_StartState(var c_npc self, var func what, var int statebehaviour, var string wpname) {}; -func void AI_StopAim(var c_npc attacker) {}; -func void AI_StopFX(var instance n0, var string s1) {}; -func void AI_StopLookAt(var c_npc self) {}; -func void AI_StopPointAt(var c_npc self) {}; -func void AI_StopProcessInfos(var c_npc npc) {}; -func void AI_TakeItem(var c_npc self, var c_item item) {}; -func void AI_TakeMob(var instance n0, var string s1) {}; -func void AI_Teleport(var c_npc self, var string waypoint) {}; -func void AI_TurnAway(var c_npc n0, var c_npc n1) {}; -func void AI_TurnToNpc(var c_npc n0, var c_npc n1) {}; -func void AI_TurnToSound(var c_npc self) {}; -func void AI_UnequipArmor(var c_npc self) {}; -func void AI_UnequipWeapons(var c_npc self) {}; -func void AI_UnreadySpell(var c_npc self) {}; -func void AI_UseItemToState(var c_npc self, var int iteminstance, var int state) {}; -func void AI_UseItem(var c_npc self, var int iteminstance) {}; -func int AI_UseMob(var c_npc self, var string schemename, var int targetstate) {}; -func void AI_WaitForQuestion(var c_npc self, var func scriptfunc) {}; -func void AI_WaitMS(var instance n0, var int i1) {}; -func void AI_WaitTillEnd(var c_npc self, var c_npc other) {}; -func void AI_Wait(var c_npc n0, var float n1) {}; -func void AI_WhirlAroundToSource(var instance n0) {}; -func void AI_WhirlAround(var c_npc self, var c_npc other) {}; -func void Apply_Options_Audio() {}; -func void Apply_Options_Controls() {}; -func void Apply_Options_Game() {}; -func void Apply_Options_Performance() {}; -func void Apply_Options_Video() {}; -func string ConcatStrings(var string str1, var string str2) {}; -func void CreateInvItems(var c_npc n0, var int n1, var int n2) {}; -func void CreateInvItem(var c_npc n0, var int n1) {}; -func int Doc_Create() {}; -func int Doc_CreateMap() {}; -func void Doc_Font (var string Font) {}; -func void Doc_Font(var string s0) {}; -func void Doc_MapCoordinates (var string Level, var float GameX1, var float GameY1, var float PixelX1, var float PixelY1, var float GameX2, var float GameY2, var float PixelX2, var float PixelY2) {}; -func void Doc_MapCoordinates(var string s0, var float r1, var float r2, var float r3, var float r4, var float r5, var float r6, var float r7, var float r8) {}; -func void Doc_Open(var string s0) {}; -func void Doc_Open (var string Texture) {}; -func void Doc_PrintLines(var int document, var int page, var string text) {}; -func void Doc_PrintLine(var int document, var int page, var string text) {}; -func void Doc_Print(var string s0) {}; -func void Doc_Print (var string Text) {}; -func void Doc_SetFont(var int document, var int page, var string font) {}; -func void Doc_SetLevelCoords(var int document, var int left, var int top, var int right, var int bottom) {}; -func void Doc_SetLevel(var int document, var string level) {}; -func void Doc_SetMargins(var int document, var int page, var int left, var int top, var int right, var int bottom, var int pixels) {}; -func void Doc_SetPages(var int document, var int count) {}; -func void Doc_SetPage(var int document, var int page, var string texture, var int scale) {}; -func void Doc_Show(var int document) {}; -func void EquipItem(var c_npc n0, var int n1) {}; -func void ExitGame() {}; -func void ExitSession() {}; -func int FloatToInt(var float x) {}; -func string FloatToString(var float r0) {}; -func void Game_InitEnglish() {}; -func void Game_InitGerman() {}; -func int Hlp_CutscenePlayed(var string csname) {}; -func int Hlp_GetInstanceID(var c_item item) {}; -func c_npc Hlp_GetNpc(var int instancename) {}; -func int Hlp_IsItem(var c_item item, var int instancename) {}; -func int Hlp_IsValidItem(var c_item item) {}; -func int Hlp_IsValidNpc(var c_npc self) {}; -func int Hlp_Random(var int n0) {}; -func int Hlp_StrCmp(var string s1, var string s2) {}; -func void Info_AddChoice(var int i0, var string s1, var func f2) {}; -func void Info_ClearChoices(var int i0) {}; -func int InfoManager_HasFinished() {}; -func void IntroduceChapter(var string titel, var string untertitel, var string texture, var string sound, var int waittime) {}; -func float IntToFloat(var int x) {}; -func string IntToString(var int x) {}; - -/// Creates a new log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param logSection [LOG_MISSION, LOG_NOTE] indicates in which section to create the topic in -func void Log_CreateTopic(var string topicName, var int logSection) {}; -/// Adds an entry to a log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param entry content of the new entry -func void Log_AddEntry(var string topicName, var string entry) {}; -/// Changes the status of the topic with the name `topicName` -/// -/// @param topicName unique string used to identify and name the topic -/// @param status [LOG_RUNNING, LOG_SUCCESS, LOG_FAILED, LOG_OBSOLETE] the status to be set -func void Log_SetTopicStatus(var string TopicName, var int status) {}; - -func void Mdl_ApplyOverlayMDSTimed(var c_npc self, var string overlayname, var float timeticks) {}; -func void Mdl_ApplyOverlayMdsTimed(var instance n0, var string s1, var int i2) {}; -func void Mdl_ApplyOverlayMds(var c_npc n0, var string s1) {}; -func void Mdl_ApplyOverlayMDS(var instance n0, var string s1) {}; -func void Mdl_ApplyRandomAniFreq(var c_npc n0, var string s1, var float f2) {}; -func void Mdl_ApplyRandomAni(var c_npc n0, var string s1, var string s2) {}; -func void Mdl_ApplyRandomFaceAni(var c_npc self, var string name, var float timemin, var float timeminvar, var float timemax, var float timemaxvar, var float probmin) {}; -func void Mdl_RemoveOverlayMDS(var c_npc self, var string overlayname) {}; -func void Mdl_SetModelFatness(var c_npc self, var float fatness) {}; -func void Mdl_SetModelScale(var c_npc self, var float x, var float y, var float z) {}; -func void Mdl_SetVisualBody(var instance n0, var string s1, var int i2, var int i3, var string s4, var int i5, var int i6, var int i7) {}; -func void Mdl_SetVisual(var instance n0, var string s1) {}; -func void Mdl_StartFaceAni(var c_npc self, var string name, var float intensity, var float holdtime) {}; -func void Mis_AddMissionEntry(var instance n0, var string s1) {}; -func int Mis_GetStatus(var int missionname) {}; -func int Mis_OnTime(var int missionname) {}; -func void Mis_RemoveMission(var instance n0) {}; -func void Mis_SetStatus(var int missionname, var int newstatus) {}; -func void Mob_CreateItems(var string mobname, var int iteminstance, var int amount) {}; -func int Mob_HasItems(var string mobname, var int iteminstance) {}; -func int Npc_AreWeStronger(var c_npc self, var c_npc other) {}; -func int Npc_CanSeeItem(var c_npc npc1, var c_item item) {}; -func int Npc_CanSeeNpcFreeLOS(var c_npc self, var c_npc other) {}; -func int Npc_CanSeeNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_CanSeeSource(var c_npc self) {}; -func void Npc_ClearAIQueue(var c_npc self) {}; -func void Npc_ClearInventory(var instance n0) {}; -func void Npc_CreateSpell(var c_npc self, var int spellnr) {}; -func int Npc_DeleteNews(var instance n0, var int i1) {}; -func void Npc_ExchangeRoutine(var c_npc self, var string routinename) {}; -func int Npc_GetActiveSpellCat(var c_npc self) {}; -func int Npc_GetActiveSpellIsScroll(var instance n0) {}; -func int Npc_GetActiveSpellLevel(var c_npc self) {}; -func int Npc_GetActiveSpell(var c_npc self) {}; -func int Npc_GetAttitude(var c_npc self, var c_npc other) {}; -func int Npc_GetBodyState(var c_npc self) {}; -func int Npc_GetComrades(var instance n0) {}; -func string Npc_GetDetectedMob(var c_npc self) {}; -func int Npc_GetDistToItem(var c_npc npc, var c_item item) {}; -func int Npc_GetDistToNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_GetDistToPlayer(var c_npc npc1) {}; -func int Npc_GetDistToWP(var c_npc self, var string wpname) {}; -func c_item Npc_GetEquippedArmor(var c_npc n0) {}; -func c_item Npc_GetEquippedMeleeWeapon(var c_npc n0) {}; -func c_item Npc_GetEquippedRangedWeapon(var c_npc n0) {}; -func int Npc_GetGuildAttitude(var c_npc npc, var c_npc npc) {}; -func int Npc_GetHeightToItem(var instance n0, var instance n1) {}; -func int Npc_GetHeightToNpc(var c_npc npc1, var c_npc npc2) {}; -func int Npc_GetInvItemBySlot(var c_npc self, var int category, var int slotnr) {}; -func c_item Npc_GetInvItem(var c_npc self, var int iteminstance) {}; -func int Npc_GetLastHitSpellCat(var c_npc self) {}; -func int Npc_GetLastHitSpellID(var c_npc self) {}; -func instance Npc_GetLookAtTarget(var instance n0) {}; -func string Npc_GetNearestWP(var c_npc self) {}; -func c_npc Npc_GetNewsOffender(var c_npc self, var int newsnumber) {}; -func c_npc Npc_GetNewsVictim(var c_npc self, var int newsnumber) {}; -func c_npc Npc_GetNewsWitness(var c_npc self, var int newsnumber) {}; -func int Npc_GetNextTarget(var c_npc self) {}; -func string Npc_GetNextWP(var c_npc self) {}; -func int Npc_GetPermAttitude(var c_npc self, var c_npc other) {}; -func int Npc_GetPortalGuild(var instance n0) {}; -func instance Npc_GetPortalOwner(var instance n0) {}; -func c_item Npc_GetReadiedWeapon(var c_npc n0) {}; -func int Npc_GetStateTime(var c_npc self) {}; -func int Npc_GetTalentSkill(var instance n0, var int i1) {}; -func int Npc_GetTalentValue(var instance n0, var int i1) {}; -func int Npc_GetTarget(var c_npc self) {}; -func int Npc_GetTrueGuild(var c_npc npc) {}; -func int NPC_GiveInfo(var c_npc npc, var int important) {}; -func int Npc_GiveInfo(var instance n0, var int i1) {}; -func void Npc_GiveItem(var c_npc n0, var c_item n1, var c_npc n2) {}; -func int Npc_HasBodyFlag(var c_npc self, var int bodyflag) {}; -func int Npc_HasDetectedNpc(var c_npc self, var c_npc other) {}; -func int Npc_HasEquippedArmor(var c_npc self) {}; -func int Npc_HasEquippedMeleeWeapon(var c_npc self) {}; -func int Npc_HasEquippedRangedWeapon(var c_npc self) {}; -func int Npc_HasEquippedWeapon(var c_npc self) {}; -func int Npc_HasFightTalent(var c_npc self, var int tal) {}; -func int Npc_HasItems(var c_npc n0, var int iteminstance) {}; -func int Npc_HasNews(var c_npc self, var int newsid, var c_npc offender, var c_npc victim) {}; -func int Npc_HasOffered(var c_npc self, var c_npc other, var int iteminstance) {}; -func int Npc_HasRangedWeaponWithAmmo(var c_npc npc) {}; -func int Npc_HasReadiedMeleeWeapon(var c_npc self) {}; -func int Npc_HasReadiedRangedWeapon(var c_npc self) {}; -func int Npc_HasReadiedWeapon(var c_npc self) {}; -func int Npc_HasSpell(var c_npc self, var int spellid) {}; -func int Npc_HasTalent(var c_npc self, var int tal) {}; -func void Npc_ChangeAttribute(var c_npc self, var int atr, var int value) {}; -func int Npc_CheckAvailableMission(var c_npc npc, var int missionstate, var int important) {}; -func int Npc_CheckInfo(var c_npc npc, var int important) {}; -func int Npc_CheckOfferMission(var c_npc npc, var int important) {}; -func int Npc_CheckRunningMission(var c_npc npc, var int important) {}; -func int Npc_IsAiming(var c_npc self, var c_npc other) {}; -func int Npc_IsDead(var c_npc n0) {}; -func int Npc_IsDetectedMobOwnedByGuild(var c_npc user, var int ownerguild) {}; -func int Npc_IsDetectedMobOwnedByNpc(var c_npc user, var c_npc owner) {}; -func int Npc_IsDrawingSpell(var instance n0) {}; -func int Npc_IsDrawingWeapon(var instance n0) {}; -func int Npc_IsInCutscene(var c_npc self) {}; -func int Npc_IsInFightMode(var c_npc self, var int fmode) {}; -func int Npc_IsInPlayersRoom(var instance n0) {}; -func int Npc_IsInRoutine(var c_npc self, var func state) {}; -func int Npc_IsInState(var c_npc self, var func state) {}; -func int Npc_IsNear(var c_npc self, var c_npc other) {}; -func int Npc_IsNewsGossip(var c_npc self, var int newsnumber) {}; -func int Npc_IsNextTargetAvailable(var c_npc self) {}; -func int Npc_IsOnFP(var c_npc self, var string name) {}; -func int Npc_IsPlayerInMyRoom(var c_npc npc) {}; -func int Npc_IsPlayer(var c_npc player) {}; -func int Npc_IsVoiceActive(var instance n0) {}; -func int Npc_IsWayBlocked(var c_npc self) {}; -func int Npc_KnowsInfo(var c_npc self, var int infoinstance) {}; -func int Npc_KnowsPlayer(var c_npc self, var c_npc player) {}; -func void Npc_LearnSpell(var c_npc self, var int spellnr) {}; -func void Npc_MemoryEntryGuild(var c_npc self, var int source, var c_npc offender, var int newsid, var c_npc victimguild) {}; -func void Npc_MemoryEntry(var c_npc self, var int source, var c_npc offender, var int newsid, var c_npc victim) {}; -func int Npc_OwnedByGuild(var c_item item, var int guild) {}; -func int Npc_OwnedByNpc(var c_item item, var c_npc npc) {}; -func void Npc_PercDisable(var c_npc self, var int percid) {}; -func void Npc_PerceiveAll(var c_npc self) {}; -func void Npc_PercEnable(var c_npc self, var int percid, var func function) {}; -func void Npc_PlayAni(var instance n0, var string s1) {}; -func int Npc_RefuseTalk(var c_npc self) {}; -func void Npc_RemoveInvItems(var c_npc owner, var int iteminstance, var int amount) {}; -func void Npc_RemoveInvItem(var c_npc owner, var int iteminstance) {}; -func void Npc_SendPassivePerc(var c_npc npc1, var int perc_type, var c_npc npc2, var c_npc npc3) {}; -func void Npc_SendSinglePerc(var c_npc self, var c_npc target, var int percid) {}; -func int Npc_SetActiveSpellInfo(var c_npc npc, var int i1) {}; -func void Npc_SetAttitude(var c_npc self, var int att) {}; -func void Npc_SetKnowsPlayer(var c_npc self, var c_npc player) {}; -func void Npc_SetPercTime(var c_npc self, var float seconds) {}; -func void Npc_SetRefuseTalk(var c_npc self, var int timesec) {}; -func void Npc_SetStateTime(var c_npc self, var int seconds) {}; -func void Npc_SetTalentSkill(var instance n0, var int i1, var int i2) {}; -func void Npc_SetTalentValue(var instance n0, var int i1, var int i2) {}; -func void Npc_SetTarget(var c_npc self, var c_npc other) {}; -func void Npc_SetTeleportPos(var c_npc self) {}; -func void Npc_SetTempAttitude(var c_npc self, var int att) {}; -func void Npc_SetToFightMode(var c_npc self, var int weapon) {}; -func void Npc_SetToFistMode(var c_npc self) {}; -func int Npc_SetTrueGuild(var c_npc npc, var int guildid) {}; -func int Npc_StartItemReactModules(var c_npc self, var c_npc other, var c_item item) {}; -func void Npc_StopAni(var instance n0, var string s1) {}; -func int Npc_WasInState(var c_npc self, var func state) {}; -func int Npc_WasPlayerInMyRoom(var c_npc npc) {}; -func void Perc_SetRange(var int percid, var int range) {}; -func int PlayVideoEx(var string filename, var int screenblend, var int exitsession) {}; -func int PlayVideo(var string filename) {}; -func void PrintDebugCh(var int ch, var string text) {}; -func void PrintDebugInstCh(var int ch, var string text) {}; -func void PrintDebugInst(var string text) {}; -func void PrintDebug(var string s) {}; -func int PrintDialog(var int i0, var string s1, var int i2, var int i3, var string s4, var int i5) {}; -func void PrintMulti(var string s0, var string s1, var string s2, var string s3, var string s4) {}; -func void PrintScreen(var string msg, var int posx, var int posy, var string font, var int timesec) {}; -func void Print(var string s0) {}; -func void Rtn_Exchange(var string oldroutine, var string newroutine) {}; -func void SetPercentDone(var int percentdone) {}; -func int Snd_GetDistToSource(var c_npc self) {}; -func int Snd_IsSourceItem(var c_npc self) {}; -func int Snd_IsSourceNpc(var c_npc self) {}; -func void Snd_Play(var string s0) {}; -func void Snd_Play3D(var c_npc n0, var string s1) {}; -func void TA_BeginOverlay(var c_npc self) {}; -func void TA_CS(var c_npc self, var string csname, var string rolename) {}; -func void TA_EndOverlay(var c_npc self) {}; -func void Tal_Configure(var int i0, var int i1) {}; -func void TA_Min(var c_npc self, var int start_h, var int start_m, var int stop_h, var int stop_m, var func state, var string waypoint) {}; -func void TA_RemoveOverlay(var c_npc self) {}; -func void TA(var c_npc self, var int start_h, var int stop_h, var func state, var string waypoint) {}; -func void Update_ChoiceBox(var string s0) {}; -func void Wld_AssignRoomToGuild(var string s0, var int guild) {}; -func void Wld_AssignRoomToNpc(var string s0, var c_npc roomowner) {}; -func int Wld_DetectItem(var c_npc self, var int flags) {}; -func int Wld_DetectNpcExAtt(var instance n0, var int i1, var func f2, var int i3, var int i4, var int i5) {}; -func int Wld_DetectNpcEx(var instance n0, var int i1, var func f2, var int i3, var int i4) {}; -func int Wld_DetectNpc(var c_npc self, var int instance, var func aistate, var int guild) {}; -func int Wld_DetectPlayer(var c_npc self) {}; -func void Wld_ExchangeGuildAttitudes(var string name) {}; -func int Wld_GetDay() {}; -func int Wld_GetFormerPlayerPortalGuild() {}; -func c_npc Wld_GetFormerPlayerPortalOwner() {}; -func int Wld_GetGuildAttitude(var int guild1, var int guild2) {}; -func int Wld_GetMobState(var c_npc self, var string schemename) {}; -func int Wld_GetPlayerPortalGuild() {}; -func c_npc Wld_GetPlayerPortalOwner() {}; -func void Wld_InsertItem(var int iteminstance, var string spawnpoint) {}; -func void Wld_InsertNpcAndRespawn(var int instance, var string spawnpoint, var float spawndelay) {}; -func void Wld_InsertNpc(var int npcinstance, var string spawnpoint) {}; -func void Wld_InsertObject(var string s0, var string s1) {}; -func int Wld_IsFPAvailable(var c_npc self, var string fpname) {}; -func int Wld_IsFpAvailable(var instance n0, var string s1) {}; -func int Wld_IsMobAvailable(var c_npc self, var string schemename) {}; -func int Wld_IsNextFPAvailable(var c_npc self, var string fpname) {}; -func int Wld_IsNextFpAvailable(var instance n0, var string s1) {}; -func int Wld_IsRaining() {}; -func int Wld_IsTime(var int hour1, var int min1, var int hour2, var int min2) {}; -func void Wld_PlayEffect(var string effectinstance, var int originvob, var int targetvob, var int effectlevel, var int damage, var int damagetype, var int bisprojectile) {}; -func int Wld_RemoveItem(var c_item item) {}; -func void Wld_RemoveNpc(var int i0) {}; -func void Wld_SendTrigger(var string vobname) {}; -func void Wld_SendUntrigger(var string vobname) {}; -func void Wld_SetGuildAttitude(var int guild1, var int attitude, var int guild2) {}; -func void Wld_SetMobRoutine(var int hour1, var int min1, var string objname, var int state) {}; -func void Wld_SetObjectRoutine(var int hour1, var int min1, var string objname, var int state) {}; -func void Wld_SetTime(var int hour, var int min) {}; -func void Wld_SpawnNpcRange(var instance n0, var int i1, var int i2, var float r3) {}; diff --git a/docs/zengin/scripts/externals/game.md b/docs/zengin/scripts/externals/game.md new file mode 100644 index 0000000000..9a594198fc --- /dev/null +++ b/docs/zengin/scripts/externals/game.md @@ -0,0 +1,124 @@ +# Game functions +Game functions are used to control general game related operations, playing videos, and displaying chapter windows. + +## Functions + +### `IntroduceChapter` +!!! function "`IntroduceChapter`" + Dipslays a new chapter window on the screen + ```dae + func void IntroduceChapter(var string chapter, var string text, var string texture, var string sound, var int waittime) + ``` + + **Parameters** + + - `#!dae var string chapter` - upper text (chapter number) + - `#!dae var string text` - lower text (chapter title) + - `#!dae var string texture` - back texture + - `#!dae var string sound` - sound to play + - `#!dae var int waittime` - apperance time in milliseconds + +### `ExitGame` +!!! function "`ExitGame`" + Exits the game + ```dae + func void ExitGame() + ``` + +### `ExitSession` +!!! function "`ExitSession`" + Exits the current session to the main menu + ```dae + func void ExitSession() + ``` + + !!! Warning + !!! Warning + This function is only available in Gothic 2 + +### `Perc_SetRange` +!!! function "`Perc_SetRange`" + Sets the range of passive perceptions for all NPCs + ```dae + func void Perc_SetRange(var int percid, var int range) + ``` + + **Parameters** + + - `#!dae var int percid` - perception ID + - `#!dae var int range` - range in cm + +### `PlayVideo` +!!! function "`PlayVideo`" + Plays a video + ```dae + func int PlayVideo(var string filename) + ``` + + **Parameters** + + - `#!dae var string filename` - name of the video file + + **Return value** + The function returns TRUE if the video was played successfully, FALSE otherwise + +### `PlayVideoEx` +!!! function "`PlayVideoEx`" + Plays a video and allows to exit the session + ```dae + func int PlayVideoEx(var string filename, var int screenblend, var int exitsession) + ``` + + **Parameters** + + - `#!dae var string filename` - name of the video file + - `#!dae var int screenblend` - if TRUE, the screen will be blended out before the video is played + - `#!dae var int exitsession` - if TRUE, the session will be exited after the video is played + + **Return value** + The function returns TRUE if the video was played successfully, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +## Deprecated + +### `Game_InitEnglish` +!!! function "`Game_InitEnglish`" + + ```dae + func void Game_InitEnglish() + ``` + + !!! Warning + This function is only available in Gothic 2 + +### `Game_InitEngIntl` +!!! function "`Game_InitEngIntl`" + ```dae + func void Game_InitEngIntl() + ``` + + !!! Warning + This function is only available in Gothic 2 + +### `Game_InitGerman` +!!! function "`Game_InitGerman`" + ```dae + func void Game_InitGerman() + ``` + + !!! Warning + This function is only available in Gothic 2 + +### `SetPercentDone` +!!! function "`SetPercentDone`" + ```dae + func void SetPercentDone(var int percentdone) + ``` + +### `Tal_Configure` +!!! function "`Tal_Configure`" + ```dae + func void Tal_Configure(var int talent, var int value) + ``` diff --git a/docs/zengin/scripts/externals/hlp.md b/docs/zengin/scripts/externals/hlp.md new file mode 100644 index 0000000000..f7d78c2a0c --- /dev/null +++ b/docs/zengin/scripts/externals/hlp.md @@ -0,0 +1,119 @@ +--- +title: HLP functions +--- +# HLP functions (Vanilla) +Helper functions, generally used for safety checks, and specific operations. + +## Functions + +### `Hlp_GetInstanceID` +!!! function "`Hlp_GetInstanceID`" + Returns the internal ID of an instance, usefull for comparison + ```dae + func int Hlp_GetInstanceID(var instance inst) {}; + ``` + + **Parameters** + + - `#!dae var instance inst` - any instance + + **Return value** + The function returns internal ID of the instance + +### `Hlp_GetNpc` +!!! function "`Hlp_GetNpc`" + Finds an NPC object by its instance name + ```dae + func C_NPC Hlp_GetNpc(var int instancename) {}; + ``` + + **Parameters** + + - `#!dae var int instancename` - instance name of the NPC + + **Return value** + The function returns link to NPC object + +### `Hlp_IsItem` +!!! function "`Hlp_IsItem`" + Checks if item object is a specified instance + ```dae + func int Hlp_IsItem(var C_ITEM itm, var int instancename) {}; + ``` + + **Parameters** + + - `#!dae var C_ITEM itm` - C_ITEM instance of the item + - `#!dae var int instancename` - instance name of the item + + **Return value** + The function returns TRUE if the item is the specified instance, FALSE otherwise + +### `Hlp_IsValidItem` +!!! function "`Hlp_IsValidItem`" + Checks if item is in the game world + ```dae + func int Hlp_IsValidItem(var C_ITEM itm) {}; + ``` + + **Parameters** + + - `#!dae var C_ITEM itm` - instance of the item + + **Return value** + The function returns TRUE if the item is in the game world, FALSE otherwise + +### `Hlp_IsValidNpc` +!!! function "`Hlp_IsValidNpc`" + Checks if the NPC exists in the game world + ```dae + func int Hlp_IsValidNpc(var C_NPC npc) {}; + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC exists, FALSE otherwise + +### `Hlp_Random` +!!! function "`Hlp_Random`" + Generates a random value + ```dae + func int Hlp_Random(var int bound) {}; + ``` + + **Parameters** + + - `#!dae var int bound` - maximum value + + **Return value** + The function returns random value form 0 to bound + +### `Hlp_StrCmp` +!!! function "`Hlp_StrCmp`" + Compares two strings (not case-sensitive) + ```dae + func int Hlp_StrCmp(var string s1, var string s2) {}; + ``` + + **Parameters** + + - `#!dae var string s1` - first string + - `#!dae var string s2` - second string + + **Return value** + The function returns TRUE if the strings are equal, FALSE otherwise + +## Deprecated + +### `Hlp_CutscenePlayed` +!!! function "`Hlp_CutscenePlayed`" + Relic of the cutscene system + ```dae + func int Hlp_CutscenePlayed(var string csname) + ``` + +## zParserExtender +zParserExtender implements quite a few new [HLP external functions](../extenders/zparserextender/externals/hlp.md). diff --git a/docs/zengin/scripts/externals/index.md b/docs/zengin/scripts/externals/index.md index 696bcdde8f..5d0b94f987 100644 --- a/docs/zengin/scripts/externals/index.md +++ b/docs/zengin/scripts/externals/index.md @@ -1,3 +1,7 @@ # Externals -External functions are Daedalus functions (defined in the engine itself), that are used to interface with the engine. Gothic 1 and Gothic 2 implements slightly different set of external functions. -There are some external functions, that were used in the course of Gothic's development, but are now obsolete/deprecated because the underlying systems implemented in the engine were either turned off, or broken all together. +External functions are Daedalus functions (defined in the engine itself), that are used to interface with the engine. Gothic 1 and Gothic 2 implements slightly different set of external functions. + +The list of external functions with docu comments is available at [:material-github: muczc1wek/daedalus-externals](https://github.com/muczc1wek/daedalus-externals) repository. + +!!! Warning + There are some external functions, that were used in the course of Gothic's development, but are now obsolete/deprecated because the underlying systems implemented in the engine were either turned off, or broken all together. diff --git a/docs/zengin/scripts/externals/log.md b/docs/zengin/scripts/externals/log.md index 7996d694df..178c31ddf0 100644 --- a/docs/zengin/scripts/externals/log.md +++ b/docs/zengin/scripts/externals/log.md @@ -1,10 +1,12 @@ --- -title: Log functions +title: Log functions --- -# Log external functions +# Log functions (Vanilla) Log externals are used to manipulate players log and to track quest progress. -## ``Log_CreateTopic`` +## Functions + +### ``Log_CreateTopic`` !!! function "``Log_CreateTopic``" Creates a new log topic with the name `topicName` under the section `logSection` @@ -19,7 +21,7 @@ Log externals are used to manipulate players log and to track quest progress. Indicates in which section to create the topic in. Takes constants `LOG_MISSION`, `LOG_NOTE` as values -## `Log_AddEntry` +### `Log_AddEntry` !!! function "`Log_AddEntry`" Adds an entry to a log topic with the name `topicName` under the section `logSection` @@ -47,7 +49,7 @@ Log externals are used to manipulate players log and to track quest progress. }; ``` -## `Log_SetTopicStatus` +### `Log_SetTopicStatus` !!! function "`Log_SetTopicStatus`" Changes the status of the topic with the name `topicName` @@ -66,26 +68,3 @@ Log externals are used to manipulate players log and to track quest progress. ## zParserExtender The log external function selection is missing functions to retrieve the status of a log entry. There are only functions to read the log status (as discussed on [Inside Gothic](https://ataulien.github.io/Inside-Gothic/QuestLog/)). As a result of this the original scriptwriters had to define additional variable to track the log status in the scripts, even though the value is being already tracked by the engine. zParserExtender fixes this by introducing new [log external functions](../extenders/zparserextender/externals/log.md). - - -## Externals with docu comments - -```dae -/// Creates a new log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param logSection [LOG_MISSION, LOG_NOTE] indicates in which section to create the topic in -func void Log_CreateTopic(var string topicName, var int logSection) {}; - -/// Creates a new log topic with the name `topicName` under the section `logSection` -/// -/// @param topicName unique string used to identify and name the topic -/// @param logSection [LOG_MISSION, LOG_NOTE] indicates in which section to create the topic in -func void Log_AddEntry(var string topicName, var string entry) {}; - -/// Changes the status of the topic with the name `topicName` -/// -/// @param topicName unique string used to identify and name the topic -/// @param status [LOG_RUNNING, LOG_SUCCESS, LOG_FAILED, LOG_OBSOLETE] the status to be set -func void Log_SetTopicStatus(var string topicName, var int status) {}; -``` diff --git a/docs/zengin/scripts/externals/mdl.md b/docs/zengin/scripts/externals/mdl.md index cb23742619..95393f3ac7 100644 --- a/docs/zengin/scripts/externals/mdl.md +++ b/docs/zengin/scripts/externals/mdl.md @@ -1,10 +1,12 @@ --- title: MDL functions --- -# MDL functions +# MDL functions (Vanilla) Functions to tweak animation and other model related settings. -## `Mdl_ApplyOverlayMDS` +## Functions + +### `Mdl_ApplyOverlayMDS` !!! function "`Mdl_ApplyOverlayMDS`" Apply an animation overlay with `overlay_name` for the specified `npc` ```dae @@ -18,7 +20,7 @@ Functions to tweak animation and other model related settings. - `#!dae var string overlay_name` Name of the animation overlay -## `Mdl_ApplyOverlayMDSTimed` +### `Mdl_ApplyOverlayMDSTimed` !!! function "`Mdl_ApplyOverlayMDSTimed`" Apply an animation overlay with `overlay_name` for the specified `npc` for `duration` milliseconds ```dae @@ -34,7 +36,7 @@ Functions to tweak animation and other model related settings. - `#!dae var float duration` Overlay duration in milliseconds -## `Mdl_RemoveOverlayMDS` +### `Mdl_RemoveOverlayMDS` !!! function "`Mdl_RemoveOverlayMDS`" Remove the animation overlay `overlay_name` from specified `npc` ```dae @@ -48,7 +50,7 @@ Functions to tweak animation and other model related settings. - `#!dae var string overlay_name` Name of the animation overlay -## `Mdl_ApplyRandomAni` +### `Mdl_ApplyRandomAni` !!! function "`Mdl_ApplyRandomAni`" Assign a random animation `ani2` to random animation list of animation `ani1` ```dae @@ -65,7 +67,7 @@ Functions to tweak animation and other model related settings. Animation to be assigned -## `Mdl_ApplyRandomAniFreq` +### `Mdl_ApplyRandomAniFreq` !!! function "`Mdl_ApplyRandomAniFreq`" Sets the random animation frequency for animation `ani1` ```dae @@ -89,7 +91,7 @@ Functions to tweak animation and other model related settings. Mdl_ApplyRandomAniFreq(self, "S_WOUNDED", 8); ``` -## `Mdl_SetModelFatness` +### `Mdl_SetModelFatness` !!! function "`Mdl_SetModelFatness`" Set the procedural model fatness ```dae @@ -103,7 +105,7 @@ Functions to tweak animation and other model related settings. - `#!dae var float fatness` Fatness value -## `Mdl_SetModelScale` +### `Mdl_SetModelScale` !!! function "`Mdl_SetModelScale`" Set model scale per axis ```dae @@ -121,7 +123,7 @@ Functions to tweak animation and other model related settings. - `#!dae var float z` Scale along the z-axis, 1.0 = 100%, 1.5 = 150%, 0.9 = 90% -## `Mdl_SetVisualBody` +### `Mdl_SetVisualBody` !!! function "`Mdl_SetVisualBody`" Sets up the visual of an NPC ```dae @@ -154,7 +156,7 @@ Functions to tweak animation and other model related settings. - `#!dae var int armor_inst` Armor ([`C_ITEM`](../classes/c_item.md) instance) to be equipped or `-1` for no armor -## `Mdl_SetVisual` +### `Mdl_SetVisual` !!! function "`Mdl_SetVisual`" Set the animation set (also dictates models you can set using the `Mdl_SetVisualBody`) ```dae @@ -168,7 +170,7 @@ Functions to tweak animation and other model related settings. - `#!dae var string animation_set` Name of the MDS file that contains the animation set -## `Mdl_StartFaceAni` +### `Mdl_StartFaceAni` !!! function "`Mdl_StartFaceAni`" Start a face animation ```dae @@ -189,7 +191,7 @@ Functions to tweak animation and other model related settings. - `#!dae var float holdtime` How long should the animation be held for `-2` will use the MMS defined value, '-1' will make the hold time infinite -## `Mdl_ApplyRandomFaceAni` +### `Mdl_ApplyRandomFaceAni` !!! function "`Mdl_ApplyRandomFaceAni`" Start a random face animation ```dae @@ -218,107 +220,3 @@ Functions to tweak animation and other model related settings. Maximum boundary variation (in seconds) - `#!dae var float probmin` Probability (0.0 to 1.0) to choose the lower boundary time - -## Externals with docu comments - -```dae -/// Apply an animation overlay with `overlay_name` for the specified `npc` -/// -/// @param npc NPC to apply the overlay to -/// @param overlay_name name of the animation overlay -func void Mdl_ApplyOverlayMDS(var c_npc npc, var string overlay_name) {}; - -/// Apply an animation overlay with `overlay_name` for the specified `npc` for `duration` milliseconds -/// -/// @param npc NPC to apply the overlay to -/// @param overlay_name name of the animation overlay -/// @param duration overlay duration in milliseconds -func void Mdl_ApplyOverlayMDSTimed(var c_npc npc, var string overlay_name, var float duration) {}; - -/// Remove the animation overlay `overlay_name` from specified `npc` -/// -/// @param npc NPC to remove the overlay from -/// @param overlay_name name of the animation overlay -func void Mdl_RemoveOverlayMDS(var c_npc npc, var string overlay_name) {}; - -/// Assign a random animation `ani2` to random animation list of animation `ani1` -/// -/// @param npc NPC owning the animation -/// @param ani1 the animation to assign random animation to -/// @param ani2 animation to be assigned -func void Mdl_ApplyRandomAni(var c_npc npc, var string ani1, var string ani2) {}; - -/// Sets the random animation frequency for animation `ani1` -/// -/// @param npc NPC owning the animation -/// @param ani1 the animation to set the random frequency -/// @param frequency number of seconds between random animations -func void Mdl_ApplyRandomAniFreq(var c_npc npc, var string ani1, var float frequency) {}; - -/// Set the procedural model fatness -/// -/// @param npc NPC to apply the fatness to -/// @param fatness fatness value -func void Mdl_SetModelFatness(var c_npc npc, var float fatness) {}; - -/// Set model scale per axis -/// -/// @param npc NPC to apply the scale to -/// @param x scale along the x axis, 1.0 = 100%, 1.5 = 150%, 0.9 = 90% -/// @param y scale along the y axis, 1.0 = 100%, 1.5 = 150%, 0.9 = 90% -/// @param z scale along the z axis, 1.0 = 100%, 1.5 = 150%, 0.9 = 90% -func void Mdl_SetModelScale(var c_npc npc, var float x, var float y, var float z) {}; - -/// Sets up the visual of an NPC -/// -/// @param npc NPC to be affected -/// @param body_mesh mesh to be used as the body e.g. `HUN_BODY_NAKED0` -/// @param body_tex body texture assigned to this body mesh -/// @param skin body texture variant -/// @param head_mesh head mesh -/// @param head_tex head texture -/// @param teeth_tex teeth texture -/// @param armor_inst armor (C_ITEM instance) to be equipped or `-1` for no armor -func void Mdl_SetVisualBody(var instance npc, - var string body_mesh, - var int body_tex, - var int skin, - var string head_mesh, - var int head_tex, - var int teeth_tex, - var int armor_inst ) {}; - -/// Set the animation set (also dictates models you can set using the `Mdl_SetVisualBody`) -/// -/// @param npc NPC to apply the animation set to -/// @param animation_set name of the MDS file that contains the animation set -func void Mdl_SetVisual(var instance npc, var string animation_set) {}; - -/// Start a face animation -/// -/// @param npc NPC to apply the animation to -/// @param name animation name -/// @param intensity intensity of the animation 0.0 to 1.0 -/// @param holdtime how long should the animation be held for `-2` will use the MMS defined value, '-1' will make the hold time infinite -func void Mdl_StartFaceAni(var c_npc npc, - var string name, - var float intensity, - var float holdtime) {}; - -/// Start a random face animation -/// -/// @param npc NPC to apply the animation to -/// @param name animation name -/// @param timemin minimum time after which the ani should be started (in seconds) -/// @param timeminvar minimum boundary variation (in seconds) -/// @param timemax maximum time after which the ani should be started (in seconds) -/// @param timemaxvar maximum boundary variation (in seconds) -/// @param probmin probability (0.0 to 1.0) to choose the lower boundary time -func void Mdl_ApplyRandomFaceAni(var c_npc npc, - var string name, - var float timemin, - var float timeminvar, - var float timemax, - var float timemaxvar, - var float probmin) {}; -``` diff --git a/docs/zengin/scripts/externals/menu.md b/docs/zengin/scripts/externals/menu.md new file mode 100644 index 0000000000..1aaf78c055 --- /dev/null +++ b/docs/zengin/scripts/externals/menu.md @@ -0,0 +1,77 @@ +--- +title: Menu functions +--- +# Menu functions (Vanilla) +Menu functions are used to perform operations while being in the menu. + +!!! Danger + The menu functions are only available in the menu parser. + +## Functions + +### `Update_ChoiceBox` +!!! function "`Update_ChoiceBox`" + Updates `C_MENU_ITEM` choice box with the current setting. + This specific boxes are hardcoded in the function itself: + `MENUITEM_AUDIO_PROVIDER_CHOICE`, + `MENUITEM_VID_DEVICE_CHOICE`, + `MENUITEM_VID_RESOLUTION_CHOICE` + ```dae + func void Update_ChoiceBox(var string choicebox) + ``` + + **Parameters** + + - `#!dae var string choicebox` - name of the one of the hardcoded choice boxes + +### `PlayVideo` +!!! function "`PlayVideo`" + Plays a video + ```dae + func int PlayVideo(var string filename) + ``` + + **Parameters** + + - `#!dae var string filename` - name of the video file + + **Return value** + The function returns TRUE if the video was played successfully, FALSE otherwise + +### `Apply_Options_Performance` +!!! function "`Apply_Options_Performance`" + Applies the options for the performance, analyzes the system and changes the settings if necessary + ```dae + func void Apply_Options_Performance() + ``` + +### `Apply_Options_Video` +!!! function "`Apply_Options_Video`" + Applies the options for the video, changes the resolution and graphics device if necessary + ```dae + func void Apply_Options_Video() + ``` + +## Deprecated + +### `Apply_Options_Audio` +!!! function "`Apply_Options_Audio`" + Meant to apply the options for the audio, does nothing apart playing an apply sound + ```dae + func void Apply_Options_Audio() + ``` + +### `Apply_Options_Game` +!!! function "`Apply_Options_Game`" + Meant to apply the options for the game, does nothing apart playing an apply sound + ```dae + func void Apply_Options_Game() + ``` + +### `Apply_Options_Controls` +!!! function "`Apply_Options_Controls`" + Meant to apply the options for the controls, does nothing apart playing an apply sound + ```dae + func void Apply_Options_Controls() + ``` + diff --git a/docs/zengin/scripts/externals/mis.md b/docs/zengin/scripts/externals/mis.md new file mode 100644 index 0000000000..07b8d3720e --- /dev/null +++ b/docs/zengin/scripts/externals/mis.md @@ -0,0 +1,36 @@ +# Mis functions + +!!! Warning + These mission external functions are part of a cut feature in ZenGin, they are deprecated and should not be used. To add quests use [Log functions](../externals/log.md) instead. + +## Deprecated + +### `Mis_AddMissionEntry` +!!! function "`Mis_AddMissionEntry`" + ```dae + func void Mis_AddMissionEntry(var instance n0, var string s1) + ``` + +### `Mis_GetStatus` +!!! function "`Mis_GetStatus`" + ```dae + func int Mis_GetStatus(var int missionname) + ``` + +### `Mis_OnTime` +!!! function "`Mis_OnTime`" + ```dae + func int Mis_OnTime(var int missionname) + ``` + +### `Mis_RemoveMission` +!!! function "`Mis_RemoveMission`" + ```dae + func void Mis_RemoveMission(var instance n0) + ``` + +### `Mis_SetStatus` +!!! function "`Mis_SetStatus`" + ```dae + func void Mis_SetStatus(var int missionname, var int newstatus) + ``` diff --git a/docs/zengin/scripts/externals/mob.md b/docs/zengin/scripts/externals/mob.md new file mode 100644 index 0000000000..380ea1f621 --- /dev/null +++ b/docs/zengin/scripts/externals/mob.md @@ -0,0 +1,35 @@ +--- +title: MOB functions +--- +# MOB functions (Vanilla) +Functions for creating and checking items in a oCMobContainers (chests etc.). + +## Functions + +### `Mob_CreateItems` +!!! function "`Mob_CreateItems`" + Creates a specified number of items in a oCMobContainer + ```dae + func void Mob_CreateItems(var string mobname, var int iteminstance, var int amount) + ``` + + **Parameters** + + - `#!dae mobname` - name of the oCMobContainer + - `#!dae iteminstance` - instance of the item + - `#!dae amount` - number of items to create + +### `Mob_HasItems` +!!! function "`Mob_HasItems`" + Checks if a oCMobContainer has a specified number of items + ```dae + func int Mob_HasItems(var string mobname, var int iteminstance) + ``` + + **Parameters** + + - `#!dae mobname` - name of the oCMobContainer + - `#!dae iteminstance` - instance of the item + + **Return value** + The function returns number of these items in the container diff --git a/docs/zengin/scripts/externals/npc.md b/docs/zengin/scripts/externals/npc.md new file mode 100644 index 0000000000..13997f039a --- /dev/null +++ b/docs/zengin/scripts/externals/npc.md @@ -0,0 +1,1810 @@ +--- +title: NPC functions +--- +# NPC functions (Vanilla) +NPC related functions. + +## Functions + +### `CreateInvItem` +!!! function "`CreateInvItem`" + Adds the item to the NPC's inventory + ```dae + func void CreateInvItem(var C_NPC npc, var int itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int itm` - instance name of the item + + **Globals** + + - `#!dae item` - set to the created item + +### `CreateInvItems` +!!! function "`CreateInvItems`" + Adds the specified number of items to the NPC's inventory + ```dae + func void CreateInvItems(var C_NPC npc, var int itm, var int ammount) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int itm` - instance name of the item + - `#!dae var int ammount` - number of items to create + +### `EquipItem` +!!! function "`EquipItem`" + Creates and equips the item to the NPC + ```dae + func void EquipItem(var C_NPC npc, var int itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int itm` - instance name of the item + +### `Npc_CanSeeItem` +!!! function "`Npc_CanSeeItem`" + Checks if NPC can see item, includes angle check + ```dae + func int Npc_CanSeeItem(var C_NPC npc, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_ITEM itm` - instance of the item + + **Return value** + The function returns TRUE if can see, FALSE otherwise + +### `Npc_CanSeeNpc` +!!! function "`Npc_CanSeeNpc`" + Checks if `slf` can see `oth`, includes angle check + ```dae + func int Npc_CanSeeNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if can see, FALSE otherwise + +### `Npc_CanSeeNpcFreeLOS` +!!! function "`Npc_CanSeeNpcFreeLOS`" + Checks if `slf` can see `oth` without considering angle (line of sight check) + ```dae + func int Npc_CanSeeNpcFreeLOS(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if can see, FALSE otherwise + +### `Npc_CanSeeSource` +!!! function "`Npc_CanSeeSource`" + Checks if NPC can see the source of a sound, includes angle check + ```dae + func int Npc_CanSeeSource(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if can see, FALSE otherwise + +### `Npc_ChangeAttribute` +!!! function "`Npc_ChangeAttribute`" + Changes the value of an attribute for the NPC + ```dae + func void Npc_ChangeAttribute(var C_NPC npc, var int attribute, var int value) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int attribute` - attribute to change (`ATR_` constants) + - `#!dae var int value` - value to change by + +### `Npc_KnowsPlayer` +!!! function "`Npc_KnowsPlayer`" + Checks if the NPC knows the player (must be set by `Npc_SetKnowsPlayer`) + ```dae + func int Npc_KnowsPlayer(var C_NPC npc, var C_NPC player) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_NPC player` - instance of the player + + **Return value** + The function returns TRUE if the NPC knows the player, FALSE otherwise + +### `Npc_SetKnowsPlayer` +!!! function "`Npc_SetKnowsPlayer`" + Sets the NPC to know the player + ```dae + func void Npc_SetKnowsPlayer(var C_NPC npc, var C_NPC player) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_NPC player` - instance of the player + +### `Npc_CheckInfo` +!!! function "`Npc_CheckInfo`" + Checks if the NPC has valid information (C_INFO) for the player + ```dae + func int Npc_CheckInfo(var C_NPC npc, var int important) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int important` - 1 to check for important information, 0 for unimportant + + **Return value** + The function returns TRUE if the NPC has information, FALSE otherwise + +### `NPC_GiveInfo` +!!! function "`NPC_GiveInfo`" + Checks if the NPC has valid information (C_INFO) for the player, and if so, plays them + ```dae + func int NPC_GiveInfo(var C_NPC npc, var int important) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int important` - 1 to check for important information, 0 for unimportant + + **Return value** + The function returns TRUE if the NPC has information, FALSE otherwise + +### `Npc_KnowsInfo` +!!! function "`Npc_KnowsInfo`" + Checks if the NPC knows the specified C_INFO + ```dae + func int Npc_KnowsInfo(var C_NPC npc, var int infoinstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int infoinstance` - C_INFO instance name + + **Return value** + The function returns TRUE if the NPC knows the info, FALSE otherwise + +### `Npc_ClearAIQueue` +!!! function "`Npc_ClearAIQueue`" + Clears the AI queue of the NPC + ```dae + func void Npc_ClearAIQueue(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `Npc_ClearInventory` +!!! function "`Npc_ClearInventory`" + Clears the NPC's inventory, leaves only equipped and mission items + ```dae + func void Npc_ClearInventory(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_HasSpell` +!!! function "`Npc_HasSpell`" + Checks if the NPC has a specified spell in inventory + ```dae + func int Npc_HasSpell(var C_NPC npc, var int spellid) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int spellid` - ID of the spell + + **Return value** + The function returns TRUE if the NPC has the spell, FALSE otherwise + +### `Npc_ExchangeRoutine` +!!! function "`Npc_ExchangeRoutine`" + Exchanges the NPC's daily routine + ```dae + func void Npc_ExchangeRoutine(var C_NPC npc, var string routine) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string routine` - name of the new routine + +### `Npc_GetActiveSpell` +!!! function "`Npc_GetActiveSpell`" + Returns the active spell for the NPC (self or other) + ```dae + func int Npc_GetActiveSpell(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns spell ID, -1 if no active spell + +### `Npc_GetActiveSpellCat` +!!! function "`Npc_GetActiveSpellCat`" + Gets the category/type of the spell that the NPC currently has active + ```dae + func int Npc_GetActiveSpellCat(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to check + + **Return value** + The function returns category ID of the currently active spell + +### `Npc_GetActiveSpellIsScroll` +!!! function "`Npc_GetActiveSpellIsScroll`" + Checks if the spell currently active on the NPC's hand is from a scroll + ```dae + func int Npc_GetActiveSpellIsScroll(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to check + + **Return value** + The function returns TRUE if active spell is from a scroll, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_SetActiveSpellInfo` +!!! function "`Npc_SetActiveSpellInfo`" + Sets the instance to which the NPC transforms into, durring the transformation spell + ```dae + func int Npc_SetActiveSpellInfo(var C_NPC npc, var int instancename) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int instancename` - name of the instance the NPC transforms into + + **Return value** + The function returns nothing, external is wrongly defined as int + +### `Npc_GetAttitude` +!!! function "`Npc_GetAttitude`" + Gets the attitude of the `slf` towards the `oth` + ```dae + func int Npc_GetAttitude(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns attitude value (`ATT_` constants) + +### `Npc_GetPermAttitude` +!!! function "`Npc_GetPermAttitude`" + Gets the permanent attitude of the `slf` towards the `oth` + ```dae + func int Npc_GetPermAttitude(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns permanent attitude value (`ATT_` constants) + +### `Npc_GetBodyState` +!!! function "`Npc_GetBodyState`" + Gets the body state of the NPC + ```dae + func int Npc_GetBodyState(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns current body state (`BS_` constants) + +### `Npc_GetComrades` +!!! function "`Npc_GetComrades`" + Gets the number of NPCs with the same guild as `npc` within `PERC_ASSESSENEMY` range + ```dae + func int Npc_GetComrades(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns number of NPCs with the same guild within range + +### `Npc_GetDetectedMob` +!!! function "`Npc_GetDetectedMob`" + Gets the schema name of the MOB used by the NPC + ```dae + func string Npc_GetDetectedMob(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns schema name of the MOB (e.g. `BEDHIGH`) + +### `Npc_IsDetectedMobOwnedByNpc` +!!! function "`Npc_IsDetectedMobOwnedByNpc`" + Checks if MOB used by `slf` is owned by `oth` + ```dae + func int Npc_IsDetectedMobOwnedByNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if the MOB is owned by the other NPC, FALSE otherwise + +### `Npc_IsDetectedMobOwnedByGuild` +!!! function "`Npc_IsDetectedMobOwnedByGuild`" + Checks if MOB used by `npc` is owned by the guild + ```dae + func int Npc_IsDetectedMobOwnedByGuild(var C_NPC npc, var int guild) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int guild` - guild ID + + **Return value** + The function returns TRUE if the MOB is owned by the guild, FALSE otherwise + +### `Npc_GetDistToItem` +!!! function "`Npc_GetDistToItem`" + Gets the distance between the NPC and an item (in cm) + ```dae + func int Npc_GetDistToItem(var C_NPC npc, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_ITEM itm` - instance of the item + + **Return value** + The function returns distance between NPC and item in cm + +### `Npc_GetDistToNpc` +!!! function "`Npc_GetDistToNpc`" + Gets the distance between two NPCs (in cm) + ```dae + func int Npc_GetDistToNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns distance between NPCs in cm + +### `Npc_GetDistToPlayer` +!!! function "`Npc_GetDistToPlayer`" + Gets the distance between the NPC and the player (in cm) + ```dae + func int Npc_GetDistToPlayer(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns distance between NPC and player in cm + +### `Npc_GetDistToWP` +!!! function "`Npc_GetDistToWP`" + Gets the distance between the NPC and a waypoint (in cm) + ```dae + func int Npc_GetDistToWP(var C_NPC npc, var string wpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string wpname` - name of the waypoint + + **Return value** + The function returns distance between NPC and waypoint in cm + +### `Npc_GetEquippedArmor` +!!! function "`Npc_GetEquippedArmor`" + Gets the equipped armor of the NPC + ```dae + func C_ITEM Npc_GetEquippedArmor(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns C_ITEM instance of the equipped armor, NULL if no armor + +### `Npc_GetEquippedMeleeWeapon` +!!! function "`Npc_GetEquippedMeleeWeapon`" + Gets the equipped melee weapon of the NPC + ```dae + func C_ITEM Npc_GetEquippedMeleeWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns C_ITEM instance of the equipped melee weapon, NULL if no weapon + +### `Npc_GetEquippedRangedWeapon` +!!! function "`Npc_GetEquippedRangedWeapon`" + Gets the equipped ranged weapon of the NPC + ```dae + func C_ITEM Npc_GetEquippedRangedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns C_ITEM instance of the equipped ranged weapon, NULL if no weapon + +### `Npc_GetGuildAttitude` +!!! function "`Npc_GetGuildAttitude`" + Gets the guild-based attitude between two NPCs based on their guild memberships. + This represents how members of different guilds feel about each other. + ```dae + func int Npc_GetGuildAttitude(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC whose guild attitude should be checked + - `#!dae var C_NPC oth` - second NPC to check attitude against + + **Return value** + The function returns attitude value between the guilds of the two NPCs + +### `Npc_GetHeightToItem` +!!! function "`Npc_GetHeightToItem`" + Gets the height difference between the NPC and an item (in cm) + ```dae + func int Npc_GetHeightToItem(var C_NCP npc, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NCP npc` - instance of the NPC + - `#!dae var C_ITEM itm` - instance of the item + + **Return value** + The function returns height difference between NPC and item in cm + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetHeightToNpc` +!!! function "`Npc_GetHeightToNpc`" + Gets the height difference between two NPCs (in cm) + ```dae + func int Npc_GetHeightToNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns height difference between NPCs in cm + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetInvItem` +!!! function "`Npc_GetInvItem`" + Checks if the NPC has an item in its inventory + ```dae + func int Npc_GetInvItem(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - instance name of the item + + **Globals** + + - `#!dae item` - set to the item if found + + **Return value** + The function returns TRUE if the NPC has the item, FALSE otherwise + +### `Npc_GetInvItemBySlot` +!!! function "`Npc_GetInvItemBySlot`" + Checks if the NPC has an item in slot + ```dae + func int Npc_GetInvItemBySlot(var C_NPC npc, var int category, var int slotnr) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int category` - category of the item + - `#!dae var int slotnr` - slot number + + **Globals** + + - `#!dae item` - set to the item if found + + **Return value** + The function returns TRUE if the NPC has the item, FALSE otherwise + +### `Npc_RemoveInvItem` +!!! function "`Npc_RemoveInvItem`" + Removes the item from the NPC's inventory + ```dae + func int Npc_RemoveInvItem(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - instance name of the item + + **Return value** + The function returns TRUE if the item was removed, FALSE otherwise + +### `Npc_RemoveInvItems` +!!! function "`Npc_RemoveInvItems`" + Removes the specified number of items from the NPC's inventory + ```dae + func int Npc_RemoveInvItems(var C_NPC npc, var int iteminstance, var int ammount) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - instance name of the item + - `#!dae var int ammount` - number of items to remove + + **Return value** + The function returns TRUE if the items were removed, FALSE otherwise + +### `Npc_GetLastHitSpellCat` +!!! function "`Npc_GetLastHitSpellCat`" + Gets the category of the last spell that hit/affected this NPC. + ```dae + func int Npc_GetLastHitSpellCat(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to check spell category for + + **Return value** + The function returns category ID of the last spell that hit the NPC + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetLastHitSpellID` +!!! function "`Npc_GetLastHitSpellID`" + Gets the ID of the last spell that hit/affected this NPC. + ```dae + func int Npc_GetLastHitSpellID(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to check spell hits for + + **Return value** + The function returns ID of the last spell that hit the NPC, returns spell number that can be matched against spell definitions + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetLookAtTarget` +!!! function "`Npc_GetLookAtTarget`" + Gets the NPC the `npc` is looking at + ```dae + func C_NPC Npc_GetLookAtTarget(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns NPC the `npc` is looking at + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetNearestWP` +!!! function "`Npc_GetNearestWP`" + Gets the nearest waypoint to the NPC + ```dae + func string Npc_GetNearestWP(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns name of the nearest waypoint + +### `Npc_GetNextWP` +!!! function "`Npc_GetNextWP`" + Gets the second nearest waypoint to the NPC + ```dae + func string Npc_GetNextWP(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns name of the second nearest waypoint + +### `Npc_GetPortalGuild` +!!! function "`Npc_GetPortalGuild`" + Gets the guild assigned to the room (portal) the NPC is in + ```dae + func int Npc_GetPortalGuild(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns guild assigned to the portal, -1 if no guild + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetPortalOwner` +!!! function "`Npc_GetPortalOwner`" + Gets the owner of the room (portal) the NPC is in + ```dae + func C_NPC Npc_GetPortalOwner(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns instance of the owner NPC, NULL if no owner + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_GetReadiedWeapon` +!!! function "`Npc_GetReadiedWeapon`" + Gets the readied weapon of the NPC + ```dae + func C_ITEM Npc_GetReadiedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns C_ITEM instance of the readied weapon, NULL if no weapon + +### `Npc_GetStateTime` +!!! function "`Npc_GetStateTime`" + Gets the state time of the NPC + ```dae + func int Npc_GetStateTime(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns state time in seconds + +### `Npc_SetStateTime` +!!! function "`Npc_SetStateTime`" + Sets the state time of the NPC + ```dae + func void Npc_SetStateTime(var C_NPC npc, var int timesec) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int timesec` - new state time in seconds + +### `Npc_GetTalentSkill` +!!! function "`Npc_GetTalentSkill`" + Gets the talent skill of the NPC (major talent value) + ```dae + func int Npc_GetTalentSkill(var C_NPC npc, var int talent) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int talent` - talent ID (`NPC_TALENT_` constants) + + **Return value** + The function returns skill value + +### `Npc_GetTalentValue` +!!! function "`Npc_GetTalentValue`" + Gets the talent value of the NPC (additional talent value) + ```dae + func int Npc_GetTalentValue(var C_NPC npc, var int talent) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int talent` - talent ID (`NPC_TALENT_` constants) + + **Return value** + The function returns talent value + +### `Npc_SetTalentSkill` +!!! function "`Npc_SetTalentSkill`" + Sets the talent skill of the NPC (major talent value) + ```dae + func void Npc_SetTalentSkill(var C_NPC npc, var int talent, var int value) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int talent` - talent ID (`NPC_TALENT_` constants) + - `#!dae var int value` - new skill value + +### `Npc_SetTalentValue` +!!! function "`Npc_SetTalentValue`" + Sets the talent value of the NPC (additional talent value) + ```dae + func void Npc_SetTalentValue(var C_NPC npc, var int talent, var int value) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int talent` - talent ID (`NPC_TALENT_` constants) + - `#!dae var int value` - new talent value + +### `Npc_HasRangedWeaponWithAmmo` +!!! function "`Npc_HasRangedWeaponWithAmmo`" + Checks if the NPC has equiped ranged weapon and ammo to use it + ```dae + func int Npc_HasRangedWeaponWithAmmo(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has ranged weapon with ammo, FALSE otherwise + +### `Npc_HasEquippedWeapon` +!!! function "`Npc_HasEquippedWeapon`" + Checks if the NPC has equiped any weapon + ```dae + func int Npc_HasEquippedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has equiped any weapon, FALSE otherwise + +### `Npc_HasEquippedMeleeWeapon` +!!! function "`Npc_HasEquippedMeleeWeapon`" + Checks if the NPC has equiped melee weapon + ```dae + func int Npc_HasEquippedMeleeWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has equiped melee weapon, FALSE otherwise + +### `Npc_HasEquippedRangedWeapon` +!!! function "`Npc_HasEquippedRangedWeapon`" + Checks if the NPC has equiped ranged weapon + ```dae + func int Npc_HasEquippedRangedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has equiped ranged weapon, FALSE otherwise + +### `Npc_HasEquippedArmor` +!!! function "`Npc_HasEquippedArmor`" + Checks if the NPC has equiped armor + ```dae + func int Npc_HasEquippedArmor(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has equiped armor, FALSE otherwise + +### `Npc_HasReadiedWeapon` +!!! function "`Npc_HasReadiedWeapon`" + Checks if the NPC has readied weapon + ```dae + func int Npc_HasReadiedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has readied weapon, FALSE otherwise + +### `Npc_HasReadiedMeleeWeapon` +!!! function "`Npc_HasReadiedMeleeWeapon`" + Checks if the NPC has readied melee weapon + ```dae + func int Npc_HasReadiedMeleeWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has readied melee weapon, FALSE otherwise + +### `Npc_HasReadiedRangedWeapon` +!!! function "`Npc_HasReadiedRangedWeapon`" + Checks if the NPC has readied ranged weapon + ```dae + func int Npc_HasReadiedRangedWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC has readied ranged weapon, FALSE otherwise + +### `Npc_IsWayBlocked` +!!! function "`Npc_IsWayBlocked`" + Checks if NPCs way is blocked (has enough space to move forward) + ```dae + func int Npc_IsWayBlocked(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the way is blocked, FALSE otherwise + +### `Npc_IsAiming` +!!! function "`Npc_IsAiming`" + Checks if `slf` is aiming at `oth` + ```dae + func int Npc_IsAiming(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if the NPC is aiming, FALSE otherwise + +### `Npc_IsInFightMode` +!!! function "`Npc_IsInFightMode`" + Cheks if NPC is in specified fight mode + ```dae + func int Npc_IsInFightMode(var C_NPC npc, var int mode) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int mode` - fight mode (`FMODE_` constants) + + **Return value** + The function returns TRUE if the NPC is in the fight mode, FALSE otherwise + +### `Npc_SetAttitude` +!!! function "`Npc_SetAttitude`" + Sets the attitude of the NPC + ```dae + func void Npc_SetAttitude(var C_NPC npc, var int attitude) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int attitude` - attitude value (`ATT_` constants) + +### `Npc_SetTempAttitude` +!!! function "`Npc_SetTempAttitude`" + Sets the temporary attitude of the NPC + ```dae + func void Npc_SetTempAttitude(var C_NPC npc, var int attitude) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int attitude` - attitude value (`ATT_` constants) + +### `Npc_SetToFightMode` +!!! function "`Npc_SetToFightMode`" + Sets the NPC to fight mode with the specified weapon (weapon is created) + ```dae + func void Npc_SetToFightMode(var C_NPC npc, var int weapon) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int weapon` - instance name of the weapon + +### `Npc_SetToFistMode` +!!! function "`Npc_SetToFistMode`" + Sets the NPC to fist fight mode (no weapon) e.g. for monsters + ```dae + func void Npc_SetToFistMode(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `Npc_AreWeStronger` +!!! function "`Npc_AreWeStronger`" + Checks if `slf` and friends (we) are stronger than `oth` and friends (enemy) + Calculeted based on the following formula: `enemiesLevel >= 2*weLevel` + ```dae + func int Npc_AreWeStronger(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if we are stronger, FALSE otherwise + +### `Npc_IsVoiceActive` +!!! function "`Npc_IsVoiceActive`" + Checks if the NPC is currently talking + ```dae + func int Npc_IsVoiceActive(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is talking, FALSE otherwise + +### `Npc_HasBodyFlag` +!!! function "`Npc_HasBodyFlag`" + Checks if the NPC has a specified body flag + ```dae + func int Npc_HasBodyFlag(var C_NPC npc, var int flag) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int flag` - body flag (`BS_FLAG_` constants) + + **Return value** + The function returns TRUE if the NPC has the flag, FALSE otherwise + +### `Npc_SetTarget` +!!! function "`Npc_SetTarget`" + Sets the current target for the NPC + ```dae + func void Npc_SetTarget(var C_NPC npc, var C_NPC target) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var C_NPC target` - instance of the new target + +### `Npc_GetTarget` +!!! function "`Npc_GetTarget`" + Gets the target of the NPC + ```dae + func int Npc_GetTarget(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Globals** + + - `#!dae other` - set to the target of the NPC + + **Return value** + The function returns TRUE if the target is set successfully, FALSE otherwise + +### `Npc_GetNextTarget` +!!! function "`Npc_GetNextTarget`" + Searches for a target for the NPC. + ```dae + func int Npc_GetNextTarget(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Globals** + + - `#!dae other` - set to the target of the NPC if found + + **Return value** + The function returns TRUE if the target is found, FALSE otherwise + +### `Npc_IsNextTargetAvailable` +!!! function "`Npc_IsNextTargetAvailable`" + Checks if target is available for the NPC, if so, it is adopted as the internal target. + ```dae + func int Npc_IsNextTargetAvailable(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the target is available, FALSE otherwise + +### `Npc_SetTrueGuild` +!!! function "`Npc_SetTrueGuild`" + Sets the true guild of the NPC + ```dae + func int Npc_SetTrueGuild(var C_NPC npc, var int guild) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int guild` - guild ID + + **Return value** + The function returns nothing, external is wrongly defined as int + +### `Npc_GetTrueGuild` +!!! function "`Npc_GetTrueGuild`" + Gets the true guild of the NPC + ```dae + func int Npc_GetTrueGuild(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns true guild ID + +### `Npc_IsOnFP` +!!! function "`Npc_IsOnFP`" + Checks if the NPC is on the specified freepoint + ```dae + func int Npc_IsOnFP(var C_NPC npc, var string fpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string fpname` - name of the freepoint (could be only the middle part of the name: `FP_` + `fpname` + `_01`) + +### `Npc_PlayAni` +!!! function "`Npc_PlayAni`" + Makes the NPC play the specified animation + ```dae + func void Npc_PlayAni(var C_NPC npc, var string aniname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string aniname` - name of the animation UPPERCASE + +### `Npc_StopAni` +!!! function "`Npc_StopAni`" + Makes the NPC stop the specified animation + ```dae + func void Npc_StopAni(var C_NPC npc, var string aniname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string aniname` - name of the animation UPPERCASE + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_IsNear` +!!! function "`Npc_IsNear`" + Checks if `oth` is within 5 meters from `slf` + ```dae + func int Npc_IsNear(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if the NPC is near, FALSE otherwise + +### `Npc_IsPlayer` +!!! function "`Npc_IsPlayer`" + Checks if the NPC is a player + ```dae + func int Npc_IsPlayer(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is a player, FALSE otherwise + +### `Npc_IsInState` +!!! function "`Npc_IsInState`" + Checks if the NPC is in the specified ZS state + ```dae + func int Npc_IsInState(var C_NPC npc, var func state) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var func state` - ZS state function + + **Return value** + The function returns TRUE if the NPC is in the state, FALSE otherwise + +### `Npc_WasInState` +!!! function "`Npc_WasInState`" + Checks if the NPC was in the specified ZS state + ```dae + func int Npc_WasInState(var C_NPC npc, var func state) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var func state` - ZS state function + + **Return value** + The function returns TRUE if the NPC was in the state, FALSE otherwise + +### `Npc_IsInRoutine` +!!! function "`Npc_IsInRoutine`" + Checks if the NPC is in the specified routine ZS state + ```dae + func int Npc_IsInRoutine(var C_NPC npc, var func state) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var func state` - routine ZS state function + + **Return value** + The function returns TRUE if the NPC is in the state, FALSE otherwise + +### `Npc_HasDetectedNpc` +!!! function "`Npc_HasDetectedNpc`" + Checks if `slf` has detected `oth` + ```dae + func int Npc_HasDetectedNpc(var C_NPC slf, var C_NPC oth) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + + **Return value** + The function returns TRUE if the NPC has detected the other NPC, FALSE otherwise + +### `Npc_WasPlayerInMyRoom` +!!! function "`Npc_WasPlayerInMyRoom`" + Checks if the player was in the room (portal) of the NPC before the last room change + ```dae + func int Npc_WasPlayerInMyRoom(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the player was in the room assigned to the NPC, FALSE otherwise + +### `Npc_IsInPlayersRoom` +!!! function "`Npc_IsInPlayersRoom`" + Checks if the NPC is in the room (portal) assigned to the player + ```dae + func int Npc_IsInPlayersRoom(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is in the room assigned to the player, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_IsPlayerInMyRoom` +!!! function "`Npc_IsPlayerInMyRoom`" + Checks if the Player is in the room (portal) assigned to the NPC + ```dae + func int Npc_IsPlayerInMyRoom(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the player is in the room assigned to the NPC, FALSE otherwise + +### `Npc_IsDrawingWeapon` +!!! function "`Npc_IsDrawingWeapon`" + Checks if the NPC is drawing a weapon or spell, but by the `oCMsgWeapon` and `oCMsgMagic` events. Not sure if it works + ```dae + func int Npc_IsDrawingWeapon(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is drawing a weapon, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_IsDrawingSpell` +!!! function "`Npc_IsDrawingSpell`" + Checks if the NPC is drawing a spell, but by the `oCMsgMagic` events. Not sure if it works + ```dae + func int Npc_IsDrawingSpell(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns spell ID if the NPC is drawing a spell, -1 otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Npc_RefuseTalk` +!!! function "`Npc_RefuseTalk`" + Checks if the NPC refuses to talk + ```dae + func int Npc_RefuseTalk(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC refuses to talk, FALSE otherwise + +### `Npc_SetRefuseTalk` +!!! function "`Npc_SetRefuseTalk`" + Sets the NPC to refuse to talk for a specified time + ```dae + func void Npc_SetRefuseTalk(var C_NPC npc, var int timesec) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int timesec` - time in seconds + +### `Npc_HasItems` +!!! function "`Npc_HasItems`" + Checks if the NPC has a specified item in inventory + ```dae + func int Npc_HasItems(var C_NPC npc, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int iteminstance` - instance of the item + + **Return value** + The function returns amount of the item in inventory, 0 if not found + +### `Npc_OwnedByNpc` +!!! function "`Npc_OwnedByNpc`" + Checks if `itm` is owned by the NPC + ```dae + func int Npc_OwnedByNpc(var C_ITEM itm, var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_ITEM itm` - instance of the item + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the item is owned by the NPC, FALSE otherwise + +### `Npc_OwnedByGuild` +!!! function "`Npc_OwnedByGuild`" + Checks if `itm` is owned by the guild + ```dae + func int Npc_OwnedByGuild(var C_ITEM itm, var int guild) + ``` + + **Parameters** + + - `#!dae var C_ITEM itm` - instance of the item + - `#!dae var int guild` - int guild ID + + **Return value** + The function returns TRUE if the item is owned by the guild, FALSE otherwise + +### `Npc_PerceiveAll` +!!! function "`Npc_PerceiveAll`" + Makes the NPC perceive all objects in the sense range + ```dae + func void Npc_PerceiveAll(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `Npc_SetPercTime` +!!! function "`Npc_SetPercTime`" + Sets the perception time of the NPC + ```dae + func void Npc_SetPercTime(var C_NPC npc, var float time) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var float time` - float time in seconds + +### `Npc_PercEnable` +!!! function "`Npc_PercEnable`" + Enables the perception of the NPC + ```dae + func void Npc_PercEnable(var C_NPC npc, var int percid, var func function) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int percid` - perception ID + - `#!dae var func function` - function associated with the perception + +### `Npc_PercDisable` +!!! function "`Npc_PercDisable`" + Disables the perception of the NPC + ```dae + func void Npc_PercDisable(var C_NPC npc, var int percid) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int percid` - perception ID + +### `Npc_SendPassivePerc` +!!! function "`Npc_SendPassivePerc`" + Sends a passive perception to the `slf` + ```dae + func void Npc_SendPassivePerc(var C_NPC slf, var int percid, var C_NPC oth, var C_NPC vic) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var int percid` - perception ID + - `#!dae var C_NPC oth` - instance of the other NPC + - `#!dae var C_NPC vic` - instance of the victim NPC + +### `Npc_SendSinglePerc` +!!! function "`Npc_SendSinglePerc`" + Sends a single perception to the `target` (executes the perception function) + ```dae + func void Npc_SendSinglePerc(var C_NPC sender, var C_NPC target, var int percid) + ``` + + **Parameters** + + - `#!dae var C_NPC sender` - instance of the other NPC + - `#!dae var C_NPC target` - instance of the NPC + - `#!dae var int percid` - perception ID + +### `Npc_IsDead` +!!! function "`Npc_IsDead`" + Checks if the NPC is dead + ```dae + func int Npc_IsDead(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is dead, FALSE otherwise + +### `Npc_GiveItem` +!!! function "`Npc_GiveItem`" + Takes the item from the `giver` inventory and gives it to the `taker` + ```dae + func void Npc_GiveItem(var C_NPC giver, var int iteminstance, var C_NPC taker) + ``` + + **Parameters** + + - `#!dae var C_NPC giver` - instance of the giver NPC + - `#!dae var int iteminstance` - instance name of the item + - `#!dae var C_NPC taker` - instance of the taker NPC + +### `Rtn_Exchange` +!!! function "`Rtn_Exchange`" + Changes the current daily routine of the `self` to the specified new routine + ```dae + func void Rtn_Exchange(var string oldroutine, var string newroutine) + ``` + + **Parameters** + + - `#!dae var string oldroutine` - name of the old routine (have to be active) + - `#!dae var string newroutine` - name of the new routine + +## Deprecated + +### `Npc_CheckAvailableMission` +!!! function "`Npc_CheckAvailableMission`" + Relic of the old mission system + ```dae + func int Npc_CheckAvailableMission(var C_NPC npc, var int missionstate, var int important) + ``` + +### `Npc_CheckOfferMission` +!!! function "`Npc_CheckOfferMission`" + Relic of the old mission system + ```dae + func int Npc_CheckOfferMission(var C_NPC npc, var int important) + ``` + +### `Npc_CheckRunningMission` +!!! function "`Npc_CheckRunningMission`" + Relic of the old mission system + ```dae + func int Npc_CheckRunningMission(var C_NPC npc, var int important) + ``` + +### `Npc_CreateSpell` +!!! function "`Npc_CreateSpell`" + Supposed to add spell the mag book + ```dae + func void Npc_CreateSpell(var C_NPC npc, var int spellnr) + ``` + + **Parameters** + + - `#!dae self` - instance of the NPC + - `#!dae var int spellnr` - spell number + +### `Npc_LearnSpell` +!!! function "`Npc_LearnSpell`" + Supposed to add spell to the mag book if NPC doesn't know it + ```dae + func void Npc_LearnSpell(var C_NPC npc, var int spellnr) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int spellnr` - spell number + +### `Npc_GetActiveSpellLevel` +!!! function "`Npc_GetActiveSpellLevel`" + Not used in the original scripts, gets the level of the spell currently active on the NPC's hand, although it is unknown what 'level' means + ```dae + func int Npc_GetActiveSpellLevel(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to check + + **Return value** + The function returns level of the active spell + +### `Npc_IsInCutscene` +!!! function "`Npc_IsInCutscene`" + Relic of the cutscene system + Checks if the NPC is in a cutscene + ```dae + func int Npc_IsInCutscene(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns TRUE if the NPC is in a cutscene, FALSE otherwise + +### `Npc_StartItemReactModules` +!!! function "`Npc_StartItemReactModules`" + Relic of the old trade system + Checks `slf` itemreact modules of the `itm` form `oth` + ```dae + func int Npc_StartItemReactModules(var C_NPC slf, var C_NPC oth, var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC + - `#!dae var C_ITEM itm` - instance of the item + + **Return value** + The function returns TRUE if the itemreact modules are found, FALSE otherwise + +### `Npc_HasOffered` +!!! function "`Npc_HasOffered`" + Relic of the old trade system + Checks `slf` offered `oth` the item + ```dae + func int Npc_HasOffered(var C_NPC slf, var C_NPC oth, var int iteminstance) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC + - `#!dae var C_NPC oth` - instance of the other NPC (player) + - `#!dae var int iteminstance` - instance name of the item + + **Return value** + The function returns TRUE if the itemreact modules are found, FALSE otherwise + +### `Npc_MemoryEntry` +!!! function "`Npc_MemoryEntry`" + Not used in the original scripts, the idea was that it created a news/memory entry that allows NPCs to track and react to witnessed events. + ```dae + func void Npc_MemoryEntry(var C_NPC witness, var int source, var C_NPC offender, var int newsid, var C_NPC vic) + ``` + + **Parameters** + + - `#!dae var C_NPC witness` - instance of the NPC who will receive this memory + - `#!dae var int source` - type of the news/event + - `#!dae var C_NPC offender` - instance of the NPC who performed the action + - `#!dae var int newsid` - ID of the event type + - `#!dae var C_NPC vic` - instance of the NPC affected by the action (victim) + +### `Npc_MemoryEntryGuild` +!!! function "`Npc_MemoryEntryGuild`" + Not used in the original scripts, creates a guild-related news/memory entry that allows NPCs to track and react to witnessed events. + Similar to Npc_MemoryEntry() but marks the news as guild-related, meaning it affects guild attitudes and reactions rather than just individual NPCs. + ```dae + func void Npc_MemoryEntryGuild(var C_NPC witness, var int source, var C_NPC offender, var int newsid, var C_NPC vic) + ``` + + **Parameters** + + - `#!dae var C_NPC witness` - instance of the NPC who will receive this memory + - `#!dae var int source` - type of the news/event + - `#!dae var C_NPC offender` - instance of the NPC who performed the action + - `#!dae var int newsid` - ID of the event type + - `#!dae var C_NPC vic` - instance of the NPC affected by the action (victim) + +### `Npc_HasNews` +!!! function "`Npc_HasNews`" + Not used in the original scripts, checks if NPC has a specific news entry in their memory + ```dae + func int Npc_HasNews(var C_NPC slf, var int newsID, var C_NPC offender, var C_NPC vic) + ``` + + **Parameters** + + - `#!dae var C_NPC slf` - instance of the NPC to check + - `#!dae var int newsID` - ID of the news to find + - `#!dae var C_NPC offender` - optional (can be NULL) offender to match + - `#!dae var C_NPC vic` - optional (can be NULL) victim to match + + **Return value** + The function returns news number >0 if found, 0 if not found + +### `Npc_IsNewsGossip` +!!! function "`Npc_IsNewsGossip`" + Not used in the original scripts, checks if a specific news entry is gossip (heard from others) vs witnessed + ```dae + func int Npc_IsNewsGossip(var C_NPC npc, var int newsNumber) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - NPC owning the news + - `#!dae var int newsNumber` - ID number of the news entry to check + + **Return value** + The function returns >0 if news is gossip, 0 if directly witnessed + +### `Npc_GetNewsWitness` +!!! function "`Npc_GetNewsWitness`" + Not used in the original scripts, gets the NPC who witnessed the specified news event + ```dae + func C_NPC Npc_GetNewsWitness(var C_NPC npc, var int newsNumber) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - NPC owning the news + - `#!dae var int newsNumber` - ID number of the news entry + + **Return value** + The function returns C_NPC instance of the witness + +### `Npc_GetNewsVictim` +!!! function "`Npc_GetNewsVictim`" + Not used in the original scripts, gets the victim of the specified news event + ```dae + func C_NPC Npc_GetNewsVictim(var C_NPC npc, var int newsNumber) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - NPC owning the news + - `#!dae var int newsNumber` - ID number of the news entry + + **Return value** + The function returns C_NPC instance of the victim + +/// [deprecated] Not used in the original scripts, gets the victim of the specified news event. +/// @param npc NPC owning the news +/// @param newsNumber ID number of the news entry +/// @return C_NPC instance of the victim +func C_NPC Npc_GetNewsVictim(var C_NPC npc, var int newsNumber) {}; + +### `Npc_GetNewsOffender` +!!! function "`Npc_GetNewsOffender`" + Not used in the original scripts, gets the offender of the specified news event + ```dae + func C_NPC Npc_GetNewsOffender(var C_NPC npc, var int newsNumber) + ``` + + **Parameters** + - `#!dae var C_NPC npc` - NPC owning the news + - `#!dae var int newsNumber` - ID number of the news entry + + **Return value** + The function returns C_NPC instance of the offender + +### `Npc_DeleteNews` +!!! function "`Npc_DeleteNews`" + Not used in the original scripts, deletes a specific news entry from an NPC's memory + ```dae + func int Npc_DeleteNews(var C_NPC npc, var int newsNumber) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - NPC whose news entry should be deleted + - `#!dae var int newsNumber` - ID number of the news entry to delete + + **Return value** + The function returns TRUE if the news was successfully deleted, FALSE otherwise + +## zParserExtender +zParserExtender implements quite a few new [NPC external functions](../extenders/zparserextender/externals/npc.md). \ No newline at end of file diff --git a/docs/zengin/scripts/externals/print.md b/docs/zengin/scripts/externals/print.md new file mode 100644 index 0000000000..734dafa9c3 --- /dev/null +++ b/docs/zengin/scripts/externals/print.md @@ -0,0 +1,114 @@ +# Print functions +Functions for printing text to the screen, zSpy, or dialog boxes. + +## Functions + +### `Print` +!!! function "`Print`" + Prints text at the top of the screen + ```dae + func void Print(var string text) + ``` + + **Parameters** + + - `#!dae var string text` - text to print + +### `PrintDebug` +!!! function "`PrintDebug`" + Prints debug text to zSpy if "toogle debug" is enabled + ```dae + func void PrintDebug(var string text) + ``` + + **Parameters** + + - `#!dae var string text` - debug text + +### `PrintDebugCh` +!!! function "`PrintDebugCh`" + Prints text to zSpy on a specific debug channel (if channel is enabled) + ```dae + func void PrintDebugCh(var int channel, var string text) + ``` + + **Parameters** + + - `#!dae var int channel` - channel number + - `#!dae var string text` - debug text + +### `PrintDebugInst` +!!! function "`PrintDebugInst`" + Prints text to zSpy if global `self` is on debug instances list + `debug focus` command can add instance to the list + `debugAllInstances` in the `Gothic.ini` can enable all instances + ```dae + func void PrintDebugInst(var string text) + ``` + + **Parameters** + + - `#!dae var string text` - string text to print + +### `PrintDebugInstCh` +!!! function "`PrintDebugInst`" + Prints text to zSpy if global `self` is on debug instances list on a specific debug channel (if channel is enabled) + `debug focus` command can add instance to the list + `debugAllInstances` in the `Gothic.ini` can enable all instances + ```dae + func void PrintDebugInstCh(var int channel, var string text) + ``` + + **Parameters** + + - `#!dae var string text` - string text to print + - `#!dae var int channel` - channel number + +### `PrintDialog` +!!! function "`PrintDialog`" + Displays a text in a dialog box + ```dae + func int PrintDialog(var int window, var string text, var int posx, var int posy, var string font, var int timesec) + ``` + + **Parameters** + + - `#!dae var int window` - id of a dialog window + - `#!dae var string text` - displayed text + - `#!dae var int posx` - x position as percent (-1 to center) + - `#!dae var int posy` - y position as percent (-1 to center) + - `#!dae var string font` - font to use + - `#!dae var int timesec` - display duration in seconds + + **Return value** + The function returns TRUE if the dialog was displayed successfully, FALSE otherwise + +### `PrintMulti` +!!! function "`PrintMulti`" + Randomly selects one of the texts and prints it + ```dae + func void PrintMulti(var string text1, var string text2, var string text3, var string text4, var string text5) + ``` + + **Parameters** + + - `#!dae var string text1` - first text + - `#!dae var string text2` - second text + - `#!dae var string text3` - third text + - `#!dae var string text4` - fourth text + - `#!dae var string text5` - fifth text + +### `PrintScreen` +!!! function "`PrintScreen`" + Prints a message to the screen with specified font and position + ```dae + func void PrintScreen(var string text, var int posx, var int posy, var string font, var int timesec) + ``` + + **Parameters** + + - `#!dae var string text` - message to print + - `#!dae var int posx` - x position as percent (-1 to center) + - `#!dae var int posy` - y position as percent (-1 to center) + - `#!dae var string font` - font to use + - `#!dae var int timesec` - display duration in seconds diff --git a/docs/zengin/scripts/externals/snd.md b/docs/zengin/scripts/externals/snd.md new file mode 100644 index 0000000000..8d8bb0ca6d --- /dev/null +++ b/docs/zengin/scripts/externals/snd.md @@ -0,0 +1,77 @@ +# Snd functions +Sound related functions. + +## Functions + +### `Snd_GetDistToSource` +!!! function "`Snd_GetDistToSource`" + Calculates the distance beetwen the npc and the source of the last played sound + ```dae + func int Snd_GetDistToSource(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Return value** + The function returns distance between the NPC and the source of the last sound in cm + +### `Snd_IsSourceItem` +!!! function "`Snd_IsSourceItem`" + Check whether the source of the last sound was item + ```dae + func int Snd_IsSourceItem(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Globals** + + - `#!dae item` - set to the source if it was an item + + **Return value** + The function returns TRUE if the source was an item, FALSE otherwise + +### `Snd_IsSourceNpc` +!!! function "`Snd_IsSourceNpc`" + Check whether the source of the last sound was npc + ```dae + func int Snd_IsSourceNpc(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Globals** + + - `#!dae other` - set to the source if it was an NPC + + **Return value** + The function returns TRUE if the source was an NPC, FALSE otherwise + +### `Snd_Play` +!!! function "`Snd_Play`" + Plays a sound + ```dae + func void Snd_Play(var string sndName) + ``` + + **Parameters** + + - `#!dae var string sndName` - C_SFX instance name + +### `Snd_Play3D` +!!! function "`Snd_Play3D`" + Plays a sound at the position of the npc + ```dae + func void Snd_Play3D(var C_NPC npc, var string sndName) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string sndName` - C_SFX instance name diff --git a/docs/zengin/scripts/externals/ta.md b/docs/zengin/scripts/externals/ta.md new file mode 100644 index 0000000000..0f139d220e --- /dev/null +++ b/docs/zengin/scripts/externals/ta.md @@ -0,0 +1,89 @@ +--- +title: TA functions +--- + +# TA routine functions +External functions for setting NPC daily routines. + +## Functions + +### `TA` +!!! function "`TA`" + Sets the NPC daily routine + ```dae + func void TA(var C_NPC npc, var int start_h, var int stop_h, var func state, var string waypoint) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int start_h` - start hour + - `#!dae var int stop_h` - stop hour + - `#!dae var func state` - state function (ZS_*) + - `#!dae var string waypoint` - name of the waypoint + +### `TA_Min` +!!! function "`TA_Min`" + Sets the NPC daily routine with minute precision + ```dae + func void TA_Min(var C_NPC npc, var int start_h, var int start_m, var int stop_h, var int stop_m, var func state, var string waypoint) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int start_h` - start hour + - `#!dae var int start_m` - start minute + - `#!dae var int stop_h` - stop hour + - `#!dae var int stop_m` - stop minute + - `#!dae var func state` - state function (ZS_*) + - `#!dae var string waypoint` - name of the waypoint + +## Deprecated + +### `TA_CS` +!!! function "`TA_CS`" + Relic of the cutscene system + Sets a cutscene routine for the NPC + ```dae + func void TA_CS(var C_NPC npc, var string csname, var string rolename) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string csname` - name of the cutscene + - `#!dae var string rolename` - role of the NPC in the cutscene + +### `TA_BeginOverlay` +!!! function "`TA_BeginOverlay`" + Not used in the original scripts, starts a daily routine overlay + ```dae + func void TA_BeginOverlay(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `TA_EndOverlay` +!!! function "`TA_EndOverlay`" + Not used in the original scripts, ends a daily routine overlay + ```dae + func void TA_EndOverlay(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + +### `TA_RemoveOverlay` +!!! function "`TA_RemoveOverlay`" + Not used in the original scripts, removes an active daily routine overlay + ```dae + func void TA_RemoveOverlay(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC diff --git a/docs/zengin/scripts/externals/utils.md b/docs/zengin/scripts/externals/utils.md new file mode 100644 index 0000000000..82d99bac59 --- /dev/null +++ b/docs/zengin/scripts/externals/utils.md @@ -0,0 +1,79 @@ +# Utility functions +Utility functions are used for data types operations, such as type conversion. + +## Fucntions + +### `IntToFloat` +!!! function "`IntToFloat`" + Converts an integer to a float + ```dae + func float IntToFloat(var int x) {}; + ``` + + **Parameters** + + - `#!dae var int x` - number to convert + + **Return value** + The function returns converted float + +### `IntToString` +!!! function "`IntToString`" + Converts an int to a string + ```dae + func string IntToString(var int x) {}; + ``` + + **Parameters** + + - `#!dae var int x` - number to convert + + **Return value** + The function returns converted string + +### `FloatToInt` +!!! function "`FloatToInt`" + Converts a float to an int (cuts off the decimal part) + ```dae + func int FloatToInt(var float x) {}; + ``` + + **Parameters** + + - `#!dae var float x` - float number to convert + + **Return value** + The function returns converted integer + +### `FloatToString` +!!! function "`FloatToString`" + Converts a float to a string with 6 decimal places + ```dae + func string FloatToString(var float x) {}; + ``` + + **Parameters** + + - `#!dae var float x` - float number to convert + + **Return value** + The function returns converted string + + +### `ConcatStrings` +!!! function "`ConcatStrings`" + Concatenates two strings and returns the new string + ```dae + func string ConcatStrings(var string str1, var string str2) {}; + ``` + + **Parameters** + + - `#!dae var string str1` - first string + - `#!dae var string str2` - second string + + **Return value** + The function returns concatenated string + +## zParserExtender +zParserExtender implements its own type conversion functions. Check the [Cast external functions](../extenders/zparserextender/externals/cast.md) for more information. \ No newline at end of file diff --git a/docs/zengin/scripts/externals/wld.md b/docs/zengin/scripts/externals/wld.md new file mode 100644 index 0000000000..e6c8699c74 --- /dev/null +++ b/docs/zengin/scripts/externals/wld.md @@ -0,0 +1,502 @@ +--- +title: WLD functions +--- +# WLD functions (Vanilla) +Functions related to the world. + +## Functions + +### `Wld_AssignRoomToGuild` +!!! function "`Wld_AssignRoomToGuild`" + Assigns a room to a guild + ```dae + func void Wld_AssignRoomToGuild(var string room, var int guild) + ``` + + **Parameters** + + - `#!dae var string room` - name of the room as defined in the portal + - `#!dae var int guild` - guild ID + +### `Wld_AssignRoomToNpc` +!!! function "`Wld_AssignRoomToNpc`" + Assigns a room to a specific NPC + ```dae + func void Wld_AssignRoomToNpc(var string room, var C_NPC owner) + ``` + + **Parameters** + + - `#!dae var string room` - name of the room as defined in the portal + - `#!dae var C_NPC owner` - instance of the room owner + +### `Wld_DetectItem` +!!! function "`Wld_DetectItem`" + Detects an item with the specified flags + ```dae + func int Wld_DetectItem(var C_NPC npc, var int flags) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var int flags` - item flags + + **Globals** + + - `#!dae item` - set to the item if detected + + **Return value** + The function returns TRUE if the item is found, FALSE otherwise + +### `Wld_DetectNpc` +!!! function "`Wld_DetectNpc`" + Detects an NPC based on instance name, guild and AI state + ```dae + func int Wld_DetectNpc(var C_NPC npc, var int instancename, var func state, var int guild) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the detector NPC + - `#!dae var int instancename` - instance name of the detected NPC (`-1` for any) + - `#!dae var func state` - ZS state function of the detected NPC + - `#!dae var int guild` - guild ID of the detected NPC (`-1` for any) + + **Globals** + + - `#!dae other` - set to the detected NPC + + **Return value** + The function returns TRUE if the NPC is detected, FALSE otherwise + +### `Wld_DetectNpcEx` +!!! function "`Wld_DetectNpcEx`" + Detects an NPC based on instance name, guild and AI state with oprion to ignore player + ```dae + func int Wld_DetectNpcEx(var C_NPC npc, var int instancename, var func state, var int guild, var int detectplayer) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the detector NPC + - `#!dae var int instancename` - instance name of the detected NPC (-1 for any) + - `#!dae var func state` - ZS state function of the detected NPC + - `#!dae var int guild` - guild ID of the detected NPC (-1 for any) + - `#!dae var int detectplayer` - `1` to detect player, `0` to ignore player + + **Globals** + + - `#!dae other` - set to the detected NPC + + **Return value** + The function returns TRUE if the NPC is detected, FALSE otherwise + +### `Wld_DetectNpcExAtt` +!!! function "`Wld_DetectNpcExAtt`" + Detects an NPC based on instance name, guild, AI state and attitude with oprion to ignore player + ```dae + func int Wld_DetectNpcExAtt(var C_NPC npc, var int instancename, var func state, var int guild, var int detectplayer, var int attitude) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the detector NPC + - `#!dae var int instancename` - instance name of the detected NPC (-1 for any) + - `#!dae var func state` - ZS state function of the detected NPC + - `#!dae var int guild` - guild ID of the detected NPC (-1 for any) + - `#!dae var int detectplayer` - `1` to detect player, `0` to ignore player + - `#!dae var int attitude` - attitude of the detected NPC (`ATT_` constants) + + **Globals** + + - `#!dae other` - set to the detected NPC + + **Return value** + The function returns TRUE if the NPC is detected, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Wld_DetectPlayer` +!!! function "`Wld_DetectPlayer`" + Checks if the player is detected by the NPC + ```dae + func int Wld_DetectPlayer(var C_NPC npc) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + + **Globals** + + - `#!dae other` - set to the detected player + + **Return value** + The function returns TRUE if the player is detected, FALSE otherwise + +### `Wld_ExchangeGuildAttitudes` +!!! function "`Wld_ExchangeGuildAttitudes`" + Exchanges the guild attitude table + ```dae + func void Wld_ExchangeGuildAttitudes(var string tablename) + ``` + + **Parameters** + + - `#!dae var string tablename` - name of the new attitude table + +### `Wld_GetDay` +!!! function "`Wld_GetDay`" + Gets the current day, start day is 0 + ```dae + func int Wld_GetDay() + ``` + + **Return value** + The function returns current day + +### `Wld_GetFormerPlayerPortalGuild` +!!! function "`Wld_GetFormerPlayerPortalGuild`" + Gets the guild of the room (portal) the player was in before the last room change + ```dae + func int Wld_GetFormerPlayerPortalGuild() + ``` + + **Return value** + The function returns owner guild ID of the previous room the player was in + +### `Wld_GetFormerPlayerPortalOwner` +!!! function "`Wld_GetFormerPlayerPortalOwner`" + Gets the owner of the room (portal) the player was in before the last room change + ```dae + func C_NPC Wld_GetFormerPlayerPortalOwner() + ``` + + **Return value** + The function returns instance of the room owner of the previous room the player was in, NULL if no owner + +### `Wld_GetPlayerPortalGuild` +!!! function "`Wld_GetPlayerPortalGuild`" + Gets the owner guild of the room (portal) the player is currently in + ```dae + func int Wld_GetPlayerPortalGuild() + ``` + + **Return value** + The function returns owner guild ID of the current room the player is in + +### `Wld_GetPlayerPortalOwner` +!!! function "`Wld_GetPlayerPortalOwner`" + Gets the owner of the active room (portal) the player is currently in + ```dae + func C_NPC Wld_GetPlayerPortalOwner() + ``` + + **Return value** + The function returns instance of the room owner of the current room the player is in, NULL if no owner + +### `Wld_InsertItem` +!!! function "`Wld_InsertItem`" + Inserts an item into the world at the specified spawn point + ```dae + func void Wld_InsertItem(var int iteminstance, var string spawnpoint) + ``` + + **Parameters** + + - `#!dae var int iteminstance` - instance ID of the item + - `#!dae var string spawnpoint` - name of the spawn point (waypoint or object) + +### `Wld_InsertNpc` +!!! function "`Wld_InsertNpc`" + Inserts an NPC into the world at the specified spawn point + ```dae + func void Wld_InsertNpc(var int npcinstance, var string spawnpoint) + ``` + + **Parameters** + + - `#!dae var int npcinstance` - instance ID of the NPC + - `#!dae var string spawnpoint` - name of the spawn point (waypoint or object) + + **Globals** + + - `#!dae self` - set to the inserted NPC + +### `Wld_InsertNpcAndRespawn` +!!! function "`Wld_InsertNpcAndRespawn`" + Inserts an NPC into the world and sets a respawn delay, if the NPC dies it will respawn after the specified delay + ```dae + func void Wld_InsertNpcAndRespawn(var int instancename, var string spawnpoint, var int spawndelay) + ``` + + **Parameters** + + - `#!dae var int instancename` - instance name of the NPC + - `#!dae var string spawnpoint` - name of the spawn point (waypoint or object) + - `#!dae var int spawndelay` - spawn delay in game hours + +### `Wld_InsertObject` +!!! function "`Wld_InsertObject`" + Inserts an `oCMob` with specified visual into the world at the specified spawn point + ```dae + func void Wld_InsertObject(var string visual, var string spawnpoint) + ``` + + **Parameters** + + - `#!dae var string visual` - name of the visual (with the extension) + - `#!dae var string spawnpoint` - name of the spawn point (waypoint or object) + +### `Wld_IsFPAvailable` +!!! function "`Wld_IsFPAvailable`" + Checks if a free point near the NPC is available + ```dae + func int Wld_IsFPAvailable(var C_NPC npc, var string fpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string fpname` - name of the freepoint (could be only the middle part of the name: `FP_` + `fpname` + `_01`) + + **Return value** + The function returns TRUE if the freepoint is available, FALSE otherwise + +### `Wld_IsMobAvailable` +!!! function "`Wld_IsMobAvailable`" + Checks if a MOB is available near the NPC and is unoccupied + ```dae + func int Wld_IsMobAvailable(var C_NPC npc, var string schemename) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string schemename` - name of the MOB schema (e.g. `BENCH`) + + **Return value** + The function returns TRUE if the MOB is available, FALSE otherwise + +### `Wld_IsNextFPAvailable` +!!! function "`Wld_IsNextFPAvailable`" + Checks if the next free point is available + ```dae + func int Wld_IsNextFPAvailable(var C_NPC npc, var string fpname) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string fpname` - name of the freepoint (could be only the middle part of the name: `FP_` + `fpname` + `_01`) + + **Return value** + The function returns TRUE if the next freepoint is available, FALSE otherwise + +### `Wld_IsRaining` +!!! function "`Wld_IsRaining`" + Checks if it is raining + ```dae + func int Wld_IsRaining() + ``` + + **Return value** + The function returns TRUE if it is raining, FALSE otherwise + + !!! Warning + This function is only available in Gothic 2 + +### `Wld_IsTime` +!!! function "`Wld_IsTime`" + Checks if the current world time is between the specified times + ```dae + func int Wld_IsTime(var int hour1, var int min1, var int hour2, var int min2) + ``` + + **Parameters** + + - `#!dae var int hour1` - start hour + - `#!dae var int min1` - start minute + - `#!dae var int hour2` - end hour + - `#!dae var int min2` - end minute + + **Return value** + The function returns TRUE if the current time is between the specified times, FALSE otherwise + +### `Wld_PlayEffect` +!!! function "`Wld_PlayEffect`" + Plays a visual effect (VFX) + ```dae + func void Wld_PlayEffect(var string effect, var instance origin, var instance target, var int effectlevel, var int damage, var int damagetype, var int isprojectile) + ``` + + **Parameters** + + - `#!dae var string effect` - name of the visual effect + - `#!dae var instance origin` - instance of the effect origin object + - `#!dae var instance target` - instance of the effect target object + - `#!dae var int effectlevel` - level of the effect + - `#!dae var int damage` - damage value + - `#!dae var int damagetype` - type of damage + - `#!dae var int isprojectile` - if TRUE, the effect passes through static objects + +### `Wld_StopEffect` +!!! function "`Wld_StopEffect`" + Stops a visual effect (VFX) + ```dae + func void Wld_StopEffect(var string effect) + ``` + + **Parameters** + + - `#!dae var string effect` - name of the visual effect + + !!! Warning + This function is only available in Gothic 2 + +### `Wld_RemoveItem` +!!! function "`Wld_RemoveItem`" + Removes a specific item object from the world + ```dae + func int Wld_RemoveItem(var C_ITEM itm) + ``` + + **Parameters** + + - `#!dae var C_ITEM itm` - C_ITEM instance of the item + + **Return value** + The function returns TRUE if the item was removed, FALSE otherwise + +### `Wld_RemoveNpc` +!!! function "`Wld_RemoveNpc`" + Removes an NPC from the game world + ```dae + func void Wld_RemoveNpc(var int instancename) + ``` + + **Parameters** + + - `#!dae var int instancename` - instance name of the NPC to remove + +### `Wld_SendTrigger` +!!! function "`Wld_SendTrigger`" + Sends a trigger message to the specified VOB + ```dae + func void Wld_SendTrigger(var string vobname) + ``` + + **Parameters** + + - `#!dae var string vobname` - name of the VOB + +### `Wld_SendUntrigger` +!!! function "`Wld_SendUntrigger`" + Sends an untrigger message to the specified VOB + ```dae + func void Wld_SendUntrigger(var string vobname) + ``` + + **Parameters** + + - `#!dae var string vobname` - name of the VOB + +### `Wld_SetGuildAttitude` +!!! function "`Wld_SetGuildAttitude`" + Sets the guild attitude value between two guilds. Used for monster guilds as human guilds use attitude table + ```dae + func void Wld_SetGuildAttitude(var int guild1, var int attitude, var int guild2) + ``` + + **Parameters** + + - `#!dae var int guild1` - ID of the first guild + - `#!dae var int attitude` - attitude value (`ATT_` constants) + - `#!dae var int guild2` - ID of the second guild + +### `Wld_GetGuildAttitude` +!!! function "`Wld_GetGuildAttitude`" + Gets the guild attitude value between two guilds. + ```dae + func int Wld_GetGuildAttitude(var int guild1, var int guild2) + ``` + + **Parameters** + + - `#!dae var int guild1` - ID of the first guild + - `#!dae var int guild2` - ID of the second guild + + **Return value** + The function returns attitude value as `ATT_` constant + +### `Wld_SetMobRoutine` +!!! function "`Wld_SetMobRoutine`" + Sets a daily routine for the object, the Trigger/Untrigger message is sent if it is later than the specified time + ```dae + func void Wld_SetMobRoutine(var int hour1, var int min1, var string objname, var int state) + ``` + + **Parameters** + + - `#!dae var int hour1` - start hour + - `#!dae var int min1` - start minute + - `#!dae var string objname` - name of the object + - `#!dae var int state` - 1 for Trigger, 0 for Untrigger + +### `Wld_SetObjectRoutine` +!!! function "`Wld_SetObjectRoutine`" + Sets a daily routine for the object, the Trigger/Untrigger message is sent if it is later than the specified time + ```dae + func void Wld_SetObjectRoutine(var int hour1, var int min1, var string objname, var int state) + ``` + + **Parameters** + + - `#!dae var int hour1` - start hour + - `#!dae var int min1` - start minute + - `#!dae var string objname` - name of the object + - `#!dae var int state` - 1 for Trigger, 0 for Untrigger + +### `Wld_SetTime` +!!! function "`Wld_SetTime`" + Sets the world time to the specified hour and minute + ```dae + func void Wld_SetTime(var int hour, var int min) + ``` + + **Parameters** + + - `#!dae var int hour` - int hour to set + - `#!dae var int min` - int minute to set + +### `Wld_SpawnNpcRange` +!!! function "`Wld_SpawnNpcRange`" + Spawns an NPC within a specified range around `npc` + ```dae + func void Wld_SpawnNpcRange(var C_NPC npc, var int instancename, var int num, var float range) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC to spawn around + - `#!dae var int instancename` - instance name of the spawned NPC + - `#!dae var int num` - number of NPCs to spawn + - `#!dae var float range` - spawn range in cm + +### `Wld_GetMobState` +!!! function "`Wld_GetMobState`" + Gets the state of the MOB used by the NPC + ```dae + func int Wld_GetMobState(var C_NPC npc, var string schemename) + ``` + + **Parameters** + + - `#!dae var C_NPC npc` - instance of the NPC + - `#!dae var string schemename` - name of the schema (e.g. `BENCH`) + + +## zParserExtender +zParserExtender implements quite a few new [WLD external functions](../extenders/zparserextender/externals/wld.md). \ No newline at end of file diff --git a/docs/zengin/scripts/general_info/compilation.md b/docs/zengin/scripts/general_info/compilation.md index 04bab7fde3..b10c41a4d7 100644 --- a/docs/zengin/scripts/general_info/compilation.md +++ b/docs/zengin/scripts/general_info/compilation.md @@ -4,6 +4,15 @@ title: Compilation # Daedalus Compilation Before loading the data by game the Daedalus scripts have to be parsed and compiled into a `.dat` file. This is done by the engine itself, but the files that are parsed have to be listed in the `.src` files. +## Engine compilation +The engine has to be started with the `-zreparse` command line argument to force the re-parsing of the scripts. If this argument is not present, the engine will use the existing `.dat` files. + +### zParserExtender +Additionally, the [zParserExtender](../extenders/zparserextender/daedalus_injection/other.md#launch-options) plugin adds more options for parsing and compiling the scripts. + +!!! Tip + Using the `-zReparse_Game -zReparse_OU` is the most common way to recompile the game scripts and dialogs. + ## Parsers The engine itself has multiple parser instances used for parsing different `.src` files. @@ -22,7 +31,7 @@ The engine itself has multiple parser instances used for parsing different `.src The `.src` files are simple text files that contain the paths to the `.d` files that have to be parsed. The paths are relative to the folder where the `.src` file is located. !!! Warning - Booth `\` and `/` can be used as path separators, but in the wildcards only `\` is supported. + Both `\` and `/` can be used as path separators, but in the wildcards only `\` is supported. **Example file structure:** diff --git a/docs/zengin/scripts/general_info/daedalus.md b/docs/zengin/scripts/general_info/daedalus.md index 805d2f53a6..b56daaa07d 100644 --- a/docs/zengin/scripts/general_info/daedalus.md +++ b/docs/zengin/scripts/general_info/daedalus.md @@ -6,7 +6,7 @@ Daedalus syntax is a mix of `C` and `C++`. The script language is not case-sensi ## Identifiers and Keywords -Identifier are names for variables, constants, instances, prototypes, classes and functions. An identifier is a sequence of letters and ciphers. The first sign must be a letter. Thereafter, are allowed: letters, ciphers `0` to `9` and underscores. The length of identifiers is not restricted. +Identifiers are names for variables, constants, instances, prototypes, classes and functions. An identifier is a sequence of letters and digits. The first character must be a letter. Thereafter, are allowed: letters, digits `0` to `9` and underscores. The length of identifiers is not restricted. Keywords are: diff --git a/docs/zengin/sound/index.md b/docs/zengin/sound/index.md index fada3f325e..eecb9a8e63 100644 --- a/docs/zengin/sound/index.md +++ b/docs/zengin/sound/index.md @@ -2,14 +2,14 @@ ZenGin uses `.wav` files for playing Sound Effects and Dubbing. !!! Info - In-game soundtrack isn't saved in `.wav` sound files. See [Music](../music.md). + In-game soundtrack isn't saved in `.wav` sound files. See [Music](../music.md) for more information. ## Properties Original gothic sound files has following properties: - One channel (Mono) - [44100 Hz](https://en.wikipedia.org/wiki/44,100_Hz) frequency -- 32-bit [depth](https://en.wikipedia.org/wiki/Audio_bit_depth) +- 16-bit PCM encoding ## SFX Sound effects (SFX) are sounds made by monsters, spells, weapons etc. Sound effects are defined in multiple places, in `.mds` files as part of the animation [EventBlocks](../anims/events.md), or in the SFX Daedalus scripts. Sounds are located in the `_work/Data/Sound/SFX` directory. diff --git a/docs/zengin/textures/index.md b/docs/zengin/textures/index.md index feb5193a25..1e02927653 100644 --- a/docs/zengin/textures/index.md +++ b/docs/zengin/textures/index.md @@ -38,7 +38,7 @@ The engine compilation may be affected by keywords in the texture name or direct **Color depth** -Textures are compiled by default with a color depth of 16 bits per pixel and needs 4 bits of memory per pixel. To force the engine to convert textures with a different color depth, you need to add an ending to the name of the texture or directory `_16BIT` or `_32BIT`. Using 16/32 bit images makes sense when there are visual problems or noise after compression, but they take up more memory. +Textures are compiled by default with a color depth of 16 bits per pixel and need 4 bits of memory per pixel. To force the engine to convert textures with a different color depth, you need to add an ending to the name of the texture or directory `_16BIT` or `_32BIT`. Using 16/32 bit images makes sense when there are visual problems or noise after compression, but they take up more memory. Example: `_WORK\DATA\TEXTURES\SKY\NOMIP_16BIT\CLOUDS.TGA`. diff --git a/docs/zengin/tools/gothic_sourcer.md b/docs/zengin/tools/gothic_sourcer.md index 9a73bf27fe..4f0b88740a 100644 --- a/docs/zengin/tools/gothic_sourcer.md +++ b/docs/zengin/tools/gothic_sourcer.md @@ -4,3 +4,18 @@ Gothic Sourcer is a multipurpose tool. It can be used to edit Daedalus scripts, ## Download You can download the latest version of Gothic Sourcer [here](https://github.com/muczc1wek/GothicSourcer/releases/tag/v3.16). +## Animation Decompiler +Gothic Sourcer can decompile compiled animations back to the raw ASCII format. + +!!! Note + If you are unfamiliar with the concepts of animation file formats, please refer to the [Animations](../anims/index.md) section first. + +### Skeletal Animation +To decompile skeletal animations, sourcer needs the `.MDS` or `.MSB` to parse the animation data, and also the corresponding `.MDM`, `.MDH` and `.MAN` files to get information about the model and animations. + +Choose **Tools > Decompiler models > Dynamic (MDS or MSB)** and select the file you want to decompile. The decompiled files will be saved in the `Gothic Projects\Anims\asc_` directory, next to the `Gothic Sourcer` directory. + +### Morph Mesh Animation +To decompile morph mesh animations, sourcer needs only the `.MMB` file. + +Choose **Tools > Decompiler models > MorphMesh (MMS)** and select the file you want to decompile. The decompiled files will be saved in the `Gothic Projects\Anims\asc_` directory, next to the `Gothic Sourcer` directory. \ No newline at end of file diff --git a/docs/zengin/union/index.md b/docs/zengin/union/index.md index c35ace6527..da71e2e939 100644 --- a/docs/zengin/union/index.md +++ b/docs/zengin/union/index.md @@ -1,12 +1,42 @@ # Union Union is a system to patch and extend Gothic's engine the ZenGin. It allows you to load `.dll` files - ZenGin extensions created using the Gothic/Union SDK and `.patch` files - files designed to patch the game's executable. The Union installer also contains the SystemPack a collection of bug fixes and engine edits that improve performance. -## [Plug-ins](plugins/index.md) -Union plugins are shipped in the form of a `.dll` library. This library contains the compiled C++ code with the Union SDK and an embedded `.patch` file. +
-## [Union SDK](sdk/index.md) & Gothic API -Union software development kit is a collection of tools and the Gothic API that allow you to create Union plugins and alter the engine's behavior. -Gothic API is a set of 4 interfaces (each for one different ZenGin version) that allow you to interface with the engine, access the engine objects, change their behavior and introduce new classes and functionality. +- :octicons-plug-16:{ .lg .middle } __Plugins__ -## [PATCH file format](patch.md) -The `.patch` file contains one or more small programs that are designed to change the engine code (game executable). This is usually done to fix bugs. Union plug-ins contain an embedded `.patch` file and this file usually contains changes to the binary necessary for the proper function of the plug-in. + --- + + Union plugins are shipped in the form of a `.dll` library. This library contains the compiled C++ code that interfaces with game engine. + + [:octicons-arrow-right-24: Read more](plugins/index.md) + + +- :material-code-block-tags:{ .lg .middle } __Union SDK__ + + --- + + Create plugins with Union SDK, a community-made software development kit for ZenGin. + + [:octicons-arrow-right-24: Read more](sdk/index.md) + +- :material-tools:{ .lg .middle } __PATCH file format__ + + --- + + The `.patch` file contains one or more small programs that are designed to change the engine code (game executable). This is usually done to fix bugs. + + [:octicons-arrow-right-24: Read more](patch.md) + + + +- :material-download:{ .lg .middle } __Install Union__ + + --- + + Install the latest Union and enjoy the bug-free gameplay. + + [:octicons-arrow-right-24: Download installer](https://drive.google.com/drive/u/0/folders/1SMY3PuSZnZuAlov8GKKXtv5lny-jZl-a) + + +
\ No newline at end of file diff --git a/docs/zengin/union/patch.md b/docs/zengin/union/patch.md index b7ed8826bd..e48472dc46 100644 --- a/docs/zengin/union/patch.md +++ b/docs/zengin/union/patch.md @@ -1,7 +1,15 @@ # Patch files -`.patch` files are scripts that are used to change memory values or committing some actions when starting the engine. Files patches are launched from any directories monitored by the file system (System, Saves, _Work and any others at the request of the engine). The launch is performed both from physical directories and from VDF & MOD. If physical and virtual directories contain identical patches with identical paths, physical copies will have read priority. +`.patch` files are scripts that are used to patch game executable. They are especially useful when fixing engine bugs. -!!! Info - An additional [patch name] .MAP file can be created. This happens when the patch file has at least one patch marked 'static' (see the description of the patch format for more details). This file allows you to immediately download all previously made changes to process memory, skipping re-parsing of static blocks. By default, the file cannot be seen through standard files explorer. To make the file hidden, but visible, set the value SystemPack.ini -> ShowHiddenFiles = true. - -[Description of the patch format](https://worldofplayers.ru/threads/42178/) \ No newline at end of file +## Loading +Patches could be launched from any directory monitored by the file system (`System`, `Saves`, `_work` etc.). The launch is performed both from physical directories and from VDF/MOD volumes. If physical and virtual directories contain identical patches with identical paths, physical copies will have read priority. + +## Documentation +The description of the patch format could be found [here](https://worldofplayers.ru/threads/42178/). + +## Community patches +Following repositories contain collections of various patches: + +- [:fontawesome-brands-github: Gothic-Modding-Community/zengin-patches](https://github.com/Gothic-Modding-Community/zengin-patches) +- [:fontawesome-brands-github: UnresolvedExternal/Gothic-Patches](https://github.com/UnresolvedExternal/Gothic-Patches) +- [:fontawesome-brands-github: VaanaCZ/gothic-engine-patches](https://github.com/VaanaCZ/gothic-engine-patches) \ No newline at end of file diff --git a/docs/zengin/union/plugins/index.md b/docs/zengin/union/plugins/index.md index 987a348498..a5c1b792f9 100644 --- a/docs/zengin/union/plugins/index.md +++ b/docs/zengin/union/plugins/index.md @@ -2,7 +2,7 @@ title: Plugins --- # Union Plugins -Plugins are libraries dynamically loaded via Union. They can be used to modify the behavior of the game, add new features, and fix bugs. Plugins are written in C++ and compiled into DLL files. The [Union SDK](../sdk/index.md) and Gothic API provide a set of functions and classes that can be used to create plugins. +Plugins are libraries dynamically loaded via Union. They can be used to modify the behavior of the game, add new features, and fix bugs. Plugins are written in C++ and compiled into DLL files. The [Union SDK](../sdk/index.md) or [Union Framework](../framework.md) could be used to create plugins. !!! Warning The plugin system is also a potential source of errors. If the plugin is written incorrectly, it can cause the game to crash or behave incorrectly. Therefore, when using plugins, you should be careful and follow the instructions of the plugin authors. @@ -11,7 +11,7 @@ Plugins are libraries dynamically loaded via Union. They can be used to modify t Loading can be done both Physically and from VDF or MOD volumes. There are three options for loading libraries: ### Systempack.ini -The classic way is to specify the list of library names in SystemPack.ini -> PluginList separated by commas. Also through this parameter you can control the priority of launching plugins: +The classic way is to specify the list of library names in `SystemPack.ini` PluginList separated by commas. Also through this parameter you can control the priority of launching plugins: 1. If you specify two asterisks (plugin.dll**) at the end of the library name, then it will be loaded earlier than the Virtual file system. But in this case it cannot be loaded from VDF or MOD volume. @@ -19,8 +19,13 @@ The classic way is to specify the list of library names in SystemPack.ini -> Plu 3. If the name of the library is specified without changes (plugin.dll), then it will be loaded simultaneously with the game. At this stage libraries have the ability to use global instances of Gothic classes. +```ini +[PLUGINS] +PluginList = First.dll**, Second.dll*, Third.dll +``` + ### Autorun -If the library is located in the Physical Directory `System/Autorun` or in the Virtual Directory `*/Autorun`, then the library will be loaded along with the engine, as in step 1.III. In current versions of Union, the order of loading plugins from this folder is determined by the dependencies of the libraries on each other. This means that if one plugin imports symbols from another, then the Exporting will be loaded first, and then the Importing. +If the library is located in the Physical Directory `System/Autorun` or in the Virtual Directory `*/Autorun`, then the library will be loaded along with the engine, as in step 3 of Systempack.ini. In current versions of Union, the order of loading plugins from this folder is determined by the dependencies of the libraries on each other. This means that if one plugin imports symbols from another, then the Exporting will be loaded first, and then the Importing. ### Patch File The patch files start automatically. This means that plugins can also run patches along with them. There are two script functions: `LoadLibrary("plugin.dll")` and `LoadPlugins("plugin1.dll", ..., "pluginN.dll")`. \ No newline at end of file diff --git a/docs/zengin/union/plugins/zmultilogue.md b/docs/zengin/union/plugins/zmultilogue.md index d32de636b2..f2a337659a 100644 --- a/docs/zengin/union/plugins/zmultilogue.md +++ b/docs/zengin/union/plugins/zmultilogue.md @@ -1,10 +1,10 @@ # zMultilogue -zMultilogue is a Multi-NPC dialogue system for Gothic 1 and Gothic 2 NotR, based on the solution form [AFSP Trialogue package](https://github.com/Bad-Scientists/AF-Script-Packet/blob/main/Standalone-Packages/G12-Trialogue/trialogue.d). -Its goal is to replace Trialoue packages based on [Ikarus](../../scripts/extenders/ikarus/index.md) and [LeGo](../../scripts/extenders/lego/index.md) with an union-based plugin. +zMultilogue is a plugin that implements Multi-NPC dialog system for Gothic 1 and Gothic 2 NotR. Its working principle is based on the solution from [AFSP Trialogue package](https://github.com/Bad-Scientists/AF-Script-Packet/blob/main/Standalone-Packages/G12-Trialogue/trialogue.d). The main project goal is to replace Trialog packages based on [Ikarus](../../scripts/extenders/ikarus/index.md) and [LeGo](../../scripts/extenders/lego/index.md) with an union-based plugin. + !!! Info - The plugin has its own [wiki](https://github.com/Silver-Ore-Team/zMultilogue/wiki), if you are interested in including zMultilogue into your project see the [Getting Started guide](https://github.com/Silver-Ore-Team/zMultilogue/wiki/Getting-Started). + The plugin has its own [documentation site](https://silver-ore-team.github.io/zMultilogue/), if you are interested in including zMultilogue into your project see the [Getting Started guide](https://silver-ore-team.github.io/zMultilogue/getting-started/). | Contacts || |:---------| :--- | @@ -14,6 +14,7 @@ Its goal is to replace Trialoue packages based on [Ikarus](../../scripts/extende ## Features -- System for creating dialogues with multiple NPCs that doesn't fuck up AI queue -- Script interface based on the LeGo [Trialoge package](../../scripts/extenders/lego/applications/trialoge.md) (easy to port dialogues) -- Automatic increasing of dialog-box display distance if NPC is too far \ No newline at end of file +- System for creating dialogs with multiple NPCs without breaking the AI queue +- Manual script interface based on the [LeGo Trialoge package](https://github.com/Lehona/LeGo/blob/dev/Trialoge.d) +- Auto script interface that makes writing multilogs as easy as normal dialogs +- Advanced camera manipulation system \ No newline at end of file diff --git a/docs/zengin/union/sdk/externals.md b/docs/zengin/union/sdk/externals.md index 09fe65f096..27fe89fb94 100644 --- a/docs/zengin/union/sdk/externals.md +++ b/docs/zengin/union/sdk/externals.md @@ -1,4 +1,7 @@ -# Externals +--- +title: Externals +--- +# Custom externals Externals are functions defined by the Gothic engine that can be called from scripts. Union SDK provides symbols for pointers to global `zCParser` instances that we can use to interact with the parser and to define a custom external function. ```cpp @@ -11,7 +14,7 @@ extern zCParser*& parserMenu; extern zCParser*& parserMusic; ``` -## Creating custom external +## Creating external To create an external we need to define a function handler and register it in the parser. Before we start, it's good to write down a Daedalus function signature so we can see the return and argument types that will be important later. ```dae func string AddNumbers(var int FirstArgument, var int SecondArgument, var string ThirdArgument) {} diff --git a/docs/zengin/worlds/Classes/zCVob/index.md b/docs/zengin/worlds/Classes/zCVob/index.md index 46c6eee630..920d844292 100644 --- a/docs/zengin/worlds/Classes/zCVob/index.md +++ b/docs/zengin/worlds/Classes/zCVob/index.md @@ -1,3 +1,8 @@ +--- +search: + boost: 2 +--- + # zCVob !!! abstract inline end "Quick Infos" diff --git a/docs/zengin/worlds/Classes/zCVob/oCVob/oCMOB/index.md b/docs/zengin/worlds/Classes/zCVob/oCVob/oCMOB/index.md index b91fa9b778..90439006d6 100644 --- a/docs/zengin/worlds/Classes/zCVob/oCVob/oCMOB/index.md +++ b/docs/zengin/worlds/Classes/zCVob/oCVob/oCMOB/index.md @@ -1,3 +1,7 @@ +--- +search: + boost: 2 +--- # oCMOB !!! abstract inline end "Quick Infos" @@ -150,7 +154,17 @@ A VObject which can optionally be moved and/or carried. ### `focusName` {: .sp-string} -The name of the object as seen in-game when focusing it. +The name displayed when the player focuses on the object. + +The name is defined in the scripts as: +```dae +const string MOBNAME_ = ""; +``` +!!! Example + If you set `focusName` to `CHEST`, you should also define: + ```dae + const string MOBNAME_CHEST = "Chest"; + ``` ### `hitpoints` {: .sp-int} diff --git a/mkdocs.yml b/mkdocs.yml index 06712e2f67..8d7032e6a3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -60,6 +60,7 @@ extra_css: extra_javascript: - assets/javascripts/extra.js + - assets/javascripts/toc-types.js extra: social: diff --git a/overrides/assets/javascripts/toc-types.js b/overrides/assets/javascripts/toc-types.js new file mode 100644 index 0000000000..c37d5de41e --- /dev/null +++ b/overrides/assets/javascripts/toc-types.js @@ -0,0 +1,57 @@ +/** + * Typed Headers TOC Enhancement + * Applies type styling to TOC links for headers flagged with .typed and type classes + */ + +document.addEventListener('DOMContentLoaded', function() { + const types = ['float', 'int', 'string', 'func', 'class', 'class-builtin', 'class-custom']; + + // Find all headers with typed flag + const typedHeaders = document.querySelectorAll('h3.typed, h4.typed, h5.typed, h6.typed'); + + typedHeaders.forEach(header => { + // Determine which type this header has + const headerType = types.find(t => header.classList.contains(t)); + if (!headerType) return; + + // Get header text to match with TOC + const headerText = header.textContent.trim(); + + // Find all TOC links and match by text content + const allTocLinks = document.querySelectorAll('.md-nav__link'); + + allTocLinks.forEach(link => { + const linkText = link.textContent.trim(); + + // Match if link text equals or starts with header text + if (linkText === headerText || linkText.startsWith(headerText)) { + // Check if already has a code tag + let codeTag = link.querySelector('code'); + + if (!codeTag) { + // Extract first word + const words = linkText.split(/\s+/); + if (words.length === 0) return; + + const firstWord = words[0]; + + // Create code tag + codeTag = document.createElement('code'); + codeTag.textContent = firstWord; + + // Replace link content + link.innerHTML = ''; + link.appendChild(codeTag); + + // Add remaining text + if (words.length > 1) { + link.appendChild(document.createTextNode(' ' + words.slice(1).join(' '))); + } + } + + // Apply type class as a data attribute instead of class to avoid ID changes + codeTag.setAttribute('data-type', headerType); + } + }); + }); +}); diff --git a/overrides/assets/stylesheets/constants.css b/overrides/assets/stylesheets/constants.css index b6996933a4..651d582aaf 100644 --- a/overrides/assets/stylesheets/constants.css +++ b/overrides/assets/stylesheets/constants.css @@ -8,13 +8,26 @@ --gmc-external-svg: url('data:image/svg+xml;charset=utf-8,'); /* SVG to CSS inline data converter: https://yoksel.github.io/url-encoder/ - output edited */ --md-admonition-icon--trivia: url('data:image/svg+xml;charset=utf-8,'); - - --md-admonition-icon--function: url('data:image/svg+xml;charset=utf-8,') - } /* Color */ :root { --gmc-blue-tint: #00aafc; --gmc-tabs-bg-hue: 210deg; +} + +/* Type colors */ +:root { + --type-int-bg: rgba(183, 180, 0, 0.15); + --type-int-color: #b7b400; + --type-float-bg: rgba(74, 144, 226, 0.15); + --type-float-color: #4a90e2; + --type-string-bg: rgba(206, 145, 114, 0.15); + --type-string-color: #ce9172; + --type-func-bg: rgba(80, 192, 0, 0.15); + --type-func-color: #50c000; + --type-class-builtin-bg: rgba(158, 127, 176, 0.15); + --type-class-builtin-color: #9e7fb0; + --type-class-custom-bg: rgba(220, 20, 60, 0.15); + --type-class-custom-color: #dc143c; } \ No newline at end of file diff --git a/overrides/assets/stylesheets/extra.css b/overrides/assets/stylesheets/extra.css index c341d455d0..8cfb8f7d1c 100644 --- a/overrides/assets/stylesheets/extra.css +++ b/overrides/assets/stylesheets/extra.css @@ -309,22 +309,24 @@ div.md-nav__link--index { animation: heart 1000ms infinite; } - +/* function admonition is now a simple block with left border - muczc1wek */ .md-typeset .admonition.function, .md-typeset details.function { - border-color: rgb(163, 159, 159); + padding-left: 25px; + border-radius: 0%; + border-top: none; + border-right: none; + border-bottom: none; + border-left: .1rem solid var(--md-typeset-table-color); + box-shadow: none; + display: block; } .md-typeset .function > .admonition-title, .md-typeset .function > summary { - background-color: rgba(148, 148, 148, 0.1); -} -.md-typeset .function > .admonition-title::before, -.md-typeset .function > summary::before { - background-color: rgb(163, 159, 159); - -webkit-mask-image: var(--md-admonition-icon--function); - mask-image: var(--md-admonition-icon--function); + display: none; } + /* Beautiful heart beat animation I found here: https://github.com/squidfunk/mkdocs-material/discussions/3850 */ @keyframes heart { @@ -488,3 +490,141 @@ ul .sp-none { } /* endregion */ + +/* region data type headers */ + + +/* Base styling for typed headers */ +.md-typeset :is(h3, h4, h5).typed code { + display: inline-block; + font-weight: 600; + padding: 0.15em 0.35em; + margin-right: 0.2em; + border-radius: 0.2em; + font-size: 0.85em; + font-family: var(--md-code-font-family); +} + +/* Header color schemes */ +.md-typeset :is(h3, h4, h5).typed.int code { + background-color: var(--type-int-bg); + color: var(--type-int-color); +} + +.md-typeset :is(h3, h4, h5).typed.float code { + background-color: var(--type-float-bg); + color: var(--type-float-color); +} + +.md-typeset :is(h3, h4, h5).typed.string code { + background-color: var(--type-string-bg); + color: var(--type-string-color); +} + +.md-typeset :is(h3, h4, h5).typed.func code { + background-color: var(--type-func-bg); + color: var(--type-func-color); +} + +.md-typeset :is(h3, h4, h5).typed.class-builtin code { + background-color: var(--type-class-builtin-bg); + color: var(--type-class-builtin-color); +} + +.md-typeset :is(h3, h4, h5).typed.class-custom code { + background-color: var(--type-class-custom-bg); + color: var(--type-class-custom-color); +} + +.md-typeset :is(h3, h4, h5).typed.misc code { + background-color: var(--type-misc-bg); + color: var(--type-misc-color); +} + +/* Base styling for code in TOC */ +.md-nav__link code { + display: inline-block; + padding: 0.12em 0.25em; + margin-right: 0.05em; + margin-top: 0.15em; + border-radius: 0.15em; + font-size: 0.75em; + font-weight: 600; + font-family: var(--md-code-font-family); + background-color: var(--type-default-bg); + color: var(--type-default-color); + white-space: nowrap; +} + +/* TOC type-specific overrides */ +.md-nav__link code.int { + background-color: var(--type-int-bg); + color: var(--type-int-color); +} + +.md-nav__link code[data-type="int"] { + background-color: var(--type-int-bg); + color: var(--type-int-color); +} + +.md-nav__link code.float { + background-color: var(--type-float-bg); + color: var(--type-float-color); +} + +.md-nav__link code[data-type="float"] { + background-color: var(--type-float-bg); + color: var(--type-float-color); +} + +.md-nav__link code.string { + background-color: var(--type-string-bg); + color: var(--type-string-color); +} + +.md-nav__link code[data-type="string"] { + background-color: var(--type-string-bg); + color: var(--type-string-color); +} + +.md-nav__link code.func { + background-color: var(--type-func-bg); + color: var(--type-func-color); +} + +.md-nav__link code[data-type="func"] { + background-color: var(--type-func-bg); + color: var(--type-func-color); +} + +.md-nav__link code.class-builtin { + background-color: var(--type-class-builtin-bg); + color: var(--type-class-builtin-color); +} + +.md-nav__link code[data-type="class-builtin"] { + background-color: var(--type-class-builtin-bg); + color: var(--type-class-builtin-color); +} + +.md-nav__link code.class-custom { + background-color: var(--type-class-custom-bg); + color: var(--type-class-custom-color); +} + +.md-nav__link code[data-type="class-custom"] { + background-color: var(--type-class-custom-bg); + color: var(--type-class-custom-color); +} + +.md-nav__link code.misc { + background-color: var(--type-misc-bg); + color: var(--type-misc-color); +} + +.md-nav__link code[data-type="misc"] { + background-color: var(--type-misc-bg); + color: var(--type-misc-color); +} +/* endregion */ + diff --git a/tests/test_indentation.py b/tests/test_indentation.py index 5e20092f60..10eb2476a7 100644 --- a/tests/test_indentation.py +++ b/tests/test_indentation.py @@ -32,6 +32,11 @@ def test_admonitions_and_lists(self) -> None: contents, meta = mkdocs.utils.meta.get_data(source) + # If the file only has the meta, then it's not stripped, instead it's the contents + maybe_meta_contents: str = contents.strip() + if maybe_meta_contents.startswith("---") and maybe_meta_contents.endswith("---"): + continue + last_line = "" inside_admonition = False admonition_valid = False @@ -62,8 +67,12 @@ def test_admonitions_and_lists(self) -> None: if line.strip() == "": inside_list = False + comment_ending = line.lstrip(" ").startswith("-->") + + assert_line = not inside_codeblock and not comment_ending and not line.strip() == "---" + # TODO rewrite it someday with regex - if line.startswith(self.list_prefixes) and not inside_codeblock: + if line.startswith(self.list_prefixes) and assert_line: self.assertTrue( len(line) >= 2, "List entries must have content\n" diff --git a/tests/test_localization.py b/tests/test_localization.py index 4aa60f2d72..fd75eef993 100644 --- a/tests/test_localization.py +++ b/tests/test_localization.py @@ -48,7 +48,7 @@ def setUpClass(cls) -> None: splitted = list(map(str.strip, envar.split(","))) if splitted[-1].lower() in {"true", "false"} or "'" in splitted[-1]: - fallback_value = eval(splitted.pop()) + fallback_value = eval(splitted.pop().title()) if fallback_value is None: for var in splitted: