Skip to content

Commit

Permalink
Update the description of var_val
Browse files Browse the repository at this point in the history
  • Loading branch information
PipeYume committed Mar 16, 2024
1 parent 629d724 commit 0de7e83
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,20 @@ Variable object is a value, that changes due some conditions. Variable can be in
- `global_val` - variable, that is store in the world, and won't be lost until you delete said world
- `context_val` - variable, that was delivered from some another entity; For example, EVENT type EoCs can deliver specific variables contributor can use to perform specific checks:
`character_casts_spell` event, that is called every time, you guess it, character cast spell, it also store information about spell name, difficulty and damage, so contributor can create a specific negative effect for every spell casted, depending on this values; Generalized EoCs can also create and use context variables; math equivalent is variable name with `_`
- `var_val` - var_val is a unique variable object in the fact that it attempts to resolve the variable stored inside a context variable. So if you had
- `var_val` - var_val is a unique variable object in the fact that it attempts to resolve the variable stored inside a context variable. The table below illustrates how values are resolved based on their prefixes:

| Prefix of the value in var_val| Resolved as |
|------------------|------------------|
| `g_` or `global_`| global_val |
| No Prefix | global_val |
| `_`, `context_` | context_val |
| `u_` | u_val |
| `n_` or `npc_` | npc_val |
| `v_` | var_val |

In practice, `{ "var_val": "name" }` can be understood as `{ "global_val/context_val/u_val/npc_val": { "context_val": "name" } }`.

So if you had

| Name | Type | Value |
| --- | --- | --- |
Expand All @@ -127,8 +140,6 @@ Variable object is a value, that changes due some conditions. Variable can be in
For example, imagine you have context variable `{ "context_val": "my_best_spell" }`, and this `my_best_gun` variable contain text `any_random_gun`; also you have a `{ "global_val": "any_random_gun" }`, and this `any_random_gun` variable happened to contain text `ak47`
With both of this, you can use effect `"u_spawn_item": { "var_val": "my_best_gun" }`, and the game will spawn `ak47`, since it is what is stored inside `my_best_gun` global variable

The values for var_val use the same syntax for scope that math [variables](#variables) do.

Examples:

you add morale equal to `how_good` variable
Expand Down

0 comments on commit 0de7e83

Please sign in to comment.