Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues about Victoria 3 #102

Open
DragonKnightOfBreeze opened this issue Nov 25, 2024 · 19 comments
Open

Issues about Victoria 3 #102

DragonKnightOfBreeze opened this issue Nov 25, 2024 · 19 comments

Comments

@DragonKnightOfBreeze
Copy link
Owner

DragonKnightOfBreeze commented Nov 25, 2024

QQ20241125-161354

QQ20241125-161600

  1. Unlike Stellaris, in Victoria 3, more script files are encoded in UTF8-BOM
  2. Unlike Stellaris, in Victoria 3 (and some other games?), there are both alias[trigger:scope_field] and alias[trigger:value_field] (so do effect), make plugin treat them as conflict, as scope_field and value_field is not easy to be matched strictly
@DragonKnightOfBreeze DragonKnightOfBreeze added bug Something isn't working enhancement New feature or request cwt config related Need modify or extend cwt config labels Nov 25, 2024
@DragonKnightOfBreeze
Copy link
Owner Author

@kaiser-chris If you find more problems, plz post them here together.

@kaiser-chris
Copy link

Scope chaining leads to errors:

Example from base game file:
image

first and second country as well as prestige is defined in links.cwt:
image
image

I did a few tests and all of these should be valid but some are not:
image

@kaiser-chris
Copy link

This is a maybe.
I could not find how to configure parameters in CWT and Victoria 3 uses them sometimes when setting up scripted effects.

Example Setup:
image

Example Usage:
image

The usage is only marked as working because it is also defined in effects.cwt:
image
This is a workaround since theoretically this is not a base game effect function but a scripted effect.

@kaiser-chris
Copy link

Victoria 3 has one more type of color: hsv360

Example:
image

I tried defining it in CWT like this, but it seems unsupported:
image

@kaiser-chris
Copy link

There is a problem with the new ?= operator when it is directly on a value.

Example and a few tests:
image

All of the above should be valid.

@DragonKnightOfBreeze
Copy link
Owner Author

You should not use customized cwt configs to make scripted effect invocation with parameters parseable.
There is already extended (not exists in original) cwt data types to support this. See below:

image

With these configs all things should works.

For parameter usages are not supported here, this may be checked in the future.

@DragonKnightOfBreeze DragonKnightOfBreeze removed bug Something isn't working enhancement New feature or request cwt config related Need modify or extend cwt config labels Nov 25, 2024
@kaiser-chris
Copy link

You should not use customized cwt configs to make scripted effect invocation with parameters parseable. There is already extended (not exists in original) cwt data types to support this. See below:

image

With these configs all things should works.

For parameter usages are not supported here, this may be checked in the future.

Thank you.
That is why I wrote that it is a maybe.
I will add this to the Victoria 3 CWT files and will create a Pull Request into your config repo:
https://github.com/DragonKnightOfBreeze/cwtools-vic3-config

@DragonKnightOfBreeze
Copy link
Owner Author

OKAY

@kaiser-chris
Copy link

This is really strange but province references seem to be working semi-randomly.

They are behaving so strangely that I made a screen recording just to show it:
https://share.bahmut.de/2024-11-25_10.29.41-f3f1d1_%25pn.mp4

As you can see changing one can make the other valid and vice versa.

CWT Definition:
image

Screenshot from game files where provinces are defined:
image

They are not defined in a classical sense but state by state and collected with this complex enum.

@kaiser-chris
Copy link

This is a question but is there a way in CWT to combine these in one:

alias[arithmetic_operation:add] = value_field
alias[arithmetic_operation:add] = single_alias_right[formula]
alias[arithmetic_operation:add] = <script_value>
alias[arithmetic_operation:add] = <static_value>
alias[arithmetic_operation:add] = $define_reference

The issue is that all of these are basically usable everywhere where a value is needed.

Here are a few other examples:

### Adds loyalists to pops in state or country, all parameters except value are optional add_loyalists = { value = x pop_type = <key> strata = <key> culture = <scope/cu:key> religion = <scope/rel:key> }
alias[effect:add_loyalists] = {
    value = value_field
    value = <script_value>
    value = <static_value>
    ## cardinality = 0..1
    pop_type = <pop_type>
    ## cardinality = 0..1
    strata = enum[pop_strata]
    ## cardinality = 0..1
    culture = scope[culture]
    ## cardinality = 0..1
    religion = scope[religion]
    ## cardinality = 0..1
    interest_group = scope[interest_group]
}
### Adds a timed modifier effect to object in scope
alias[effect:add_modifier] = {
    name = <modifier_container>
    ## cardinality = 0..1
    enum[duration] = int
    ## cardinality = 0..1
    enum[duration] = <script_value>
    ## cardinality = 0..1
    enum[duration] = <static_value>
    ## cardinality = 0..1
    enum[duration] = enum[duration]
    ## cardinality = 0..1
    multiplier = value_field
    ## cardinality = 0..1
    multiplier = <script_value>
    ## cardinality = 0..1
    multiplier = <static_value>
    ## cardinality = 0..1
    multiplier = single_alias_right[formula]
    ## cardinality = 0..1
    is_decaying = bool
}

As you can see I always have to repeat myself.
Is there a way to make this easier?

I tried defining it like this:

alias[calc:calculated_value] = value_field
alias[calc:calculated_value] = single_alias_right[formula]
alias[calc:calculated_value] = <script_value>
alias[calc:calculated_value] = <static_value>
alias[calc:calculated_value] = $define_reference

And then using it like this:

alias[arithmetic_operation:add] = alias_match_right[calculated_value]
alias[arithmetic_operation:subtract] = alias_match_right[calculated_value]
alias[arithmetic_operation:multiply] = alias_match_right[calculated_value]
alias[arithmetic_operation:divide] = alias_match_right[calculated_value]
alias[arithmetic_operation:modulo] = alias_match_right[calculated_value]
alias[arithmetic_operation:value] = alias_match_right[calculated_value]
alias[arithmetic_operation:max] = alias_match_right[calculated_value]
alias[arithmetic_operation:min] = alias_match_right[calculated_value]
alias[arithmetic_operation:base] = alias_match_right[calculated_value]

But it does not seem to work:
image
image

@DragonKnightOfBreeze
Copy link
Owner Author

DragonKnightOfBreeze commented Nov 26, 2024

If you want to refer a alias, just use alias_name[x] = alias_match_right[x], x is the same one.

e.g. alias_name[trigger] = alias_match_right[trigger], by this all some_trigger = ... should be valid at this position.

@DragonKnightOfBreeze
Copy link
Owner Author

Scope chaining leads to errors:

Example from base game file: image

first and second country as well as prestige is defined in links.cwt: image image

I did a few tests and all of these should be valid but some are not: image

This is because PLS resolve the matched config expression to scope_field, rather than value_field (which is correct), make IDE show a red syntax error
PLS should optimize the logic to distinguish and match scope_field and value_field, finally.

@DragonKnightOfBreeze
Copy link
Owner Author

This is really strange but province references seem to be working semi-randomly.

They are behaving so strangely that I made a screen recording just to show it: https://share.bahmut.de/2024-11-25_10.29.41-f3f1d1_%25pn.mp4

As you can see changing one can make the other valid and vice versa.

CWT Definition: image

Screenshot from game files where provinces are defined: image

They are not defined in a classical sense but state by state and collected with this complex enum.

For this please make a new issue with a better title

@DragonKnightOfBreeze
Copy link
Owner Author

@kaiser-chris Note here:

image

add_lobby_appeasement_from_diplomacy_unidirectional is a scripted_effect, not a predefined effect, you should not write cwt config like this, instead, use below configs (for PLS) should be ok:

alias[effect:<scripted_effect>] = bool

alias[effect:<scripted_effect>] = {
	## cardinality = 0..inf
	$parameter = $parameter_value
}

so do scripted_trigger, parameters.

@DragonKnightOfBreeze
Copy link
Owner Author

For parameter usages are not supported, not reproduced, ignored.

@kaiser-chris
Copy link

@DragonKnightOfBreeze fyi I will be away for a week and pick this up after

@kaiser-chris
Copy link

kaiser-chris commented Dec 6, 2024

Hi @DragonKnightOfBreeze,

I found another one.
Advanced @ variables seem to break parsing:
image
image
image

The first example is from a gui file and the second is from a coat of arms base game file.

How these advanced @ variables work:

  • Contain calculations (Found plus, minus, multiply and divide)
  • Other @ variables can be referenced without using @ before it (See first example above)
  • Can contain absolute values (See second example above)
  • Can be used in place of values (See third example above)

EDIT: Added third example

@kaiser-chris
Copy link

Hi @DragonKnightOfBreeze,

I am currently working on supporting localisation commands for Victoria 3 and ran into a problem.

Here is some relevant CWT definitions:

localisation_commands = {
    GetGlobalVariable = { any }
    GetValue = { any }
    GetPlayer = { any }
    MakeScope = { any }
    Var = { any }
    GetTechnology = { any }
    GetName = { any }
}

But it seems to have a problem with commands that have parameters (e. g. Var):

gg_cancel_magic_research_text: "Are you sure you want want to cancel the research of [GetPlayer.MakeScope.Var('magic_research').GetTechnology.GetName]?\n\nAny invested [concept_magic_innovation] will be #v lost#!!"

This does not work:
image

This is incorrect but works:
image

Am I doing anything wrong or do I need to define functions like Var differently?

I used these as reference:
https://github.com/DragonKnightOfBreeze/cwtools-stellaris-config/blob/master/config/localisation.cwt

@kaiser-chris
Copy link

kaiser-chris commented Dec 16, 2024

Hi @DragonKnightOfBreeze,

I noticed one more thing I ignored since I was starting my mod:
Victoria 3 does not use descriptor.mod.

Victoria 3 uses a file called metadata.json in the folder .metadata.

This is a Wiki article from the Victoria 3 Wiki:
https://vic3.paradoxwikis.com/index.php?title=Mod_structure&mobileaction=toggle_view_desktop

Here is an example from my mod:

{
  "name" : "Magic Gate",
  "id" : "com.github.kaiser-chris.gate",
  "version" : "1.0",
  "game_id" : "victoria3",
  "picture" : "thumbnail.png",
  "supported_game_version" : "1.8.*",
  "short_description" : "Magic Gates to another world opened in 1814.",
  "tags" : [],
  "relationships" : [
    {
      "rel_type" : "dependency",
      "id" : "3385002128",
      "display_name" : "Community Mod Framework",
      "resource_type" : "mod",
      "version" : "1.*"
    }
  ],
    "game_custom_data": {
        "multiplayer_synchronized": true
    }
}

Here is my folder structure:
image

The descriptor.mod is only there so your plugin correctly identifies the mod.

EDIT: Added wiki article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants