Jump to content
joemann

CK3-Quick Modding Qustions

Recommended Posts

CK2 had a very useful topic like this.

 

I have a question.

 

I have the following event:

Spoiler

test_cycle.008 = {
    hidden = yes
    trigger = {
            is_female = yes
            is_pregnant = no
            has_character_flag = has_cycle
                            NOR = { has_character_flag = menstruating
                                    has_character_flag = ovulating
                                    has_character_flag = menopausal
                            }
    }    
    immediate = {
            remove_character_flag = luteal_phase
            add_character_modifier = {
                                    modifier = menstruating
                                    days = 7
            }
            change_variable = {
                            name = current_sex_drive
                            subtract = 0.4
            }
            change_variable = {
                            name = pussy_lubrication
                            subtract = 0.2
            }
            trigger_event = {
                        id = test_cycle.009
                        days = 7
            }
            add_character_flag = menstruating
            
    }        
}

The event chain works as it should. However the error log keeps throwing out the following error:

Spoiler

[16:18:31][jomini_script_system.cpp:169]: Script system error!
  Error: change_variable effect [ Variable not of the 'value' scope type. Type: empty ]
  Script location: file: events/test_female_cycle.txt line: 132
[16:18:31][jomini_script_system.cpp:169]: Script system error!
  Error: change_variable effect [ Variable not of the 'value' scope type. Type: empty ]
  Script location: file: events/test_female_cycle.txt line: 132

I can't figure out what it means. In game the character has the numerical variable current_sex_drive set at 3.2 I just want the event to subtract 0.4 from this with the change_variable effect.

What am I doing wrong?

I thought it was a scope issue and tried adding in the saved scope receiver which the character also has in game.

Spoiler

change_variable = {
                            name = scope:receiver.var:current_sex_drive
                            subtract = 0.4
            }

but it changes nothing.

Link to post

I believe that a piece of code (a variable outside of this) is causing it to crash or fail, probably line 132 in events/test_female_cycle.txt, so look for it and fix it, don't know how, but start there.

Link to post

Then look back a little there might already be a variable that is already there cause, me just having a quick look it looks fine but I don't know about the rest. Also, is this code for a new mod?

Link to post

But the variable current_sex_drive already exists, that is why I am using change_variable. It should be there and if I look at the character in game it is.

I don't understand what "variable is not of the value scope type means"

 

This is code for a new mod which uses about 60% of code from other mods on this site and the rest is stuff I am adding (or trying to add myself)

I am trying to make it "realistic" so no futa, orc's etc. It is work in progress.

 

Link to post

Ok, well then check if this, name = scope:receiver.var:current_sex_drive is connected to the right variable, next the subtract thing might make it go into the negatives, try to keep it above 0 also if you already have the futa mods activated there might be a clash of mods so disable all the mods except this one.

Link to post

Hey, this isn't a bad idea for a topic. I have a question too. I've been dabbling in making a little mod for a militant version of Adamitism called Evism. I want conversion to the religion to change women's genes to make them taller and give them larger breasts, but I don't know how to do it. I don't want to write an event that checks all women who convert and then changes their genes because I don't know how to do that and it would negatively affect performance. I don't think it's possible via a special doctrine like naked priests either. Does anyone have suggestions?

Link to post

I tried using scope:receiver but the error_log explicitly calls it out as an error.

 

The event that fires the event and saves the scope receiver is the following:

Spoiler

## Period for adult females on startup
#  triggered by event test_character_initialization.0001 at game_start_after_lobby for evey living character (that meets the trigger criteria) and by  on_action test_character_initialization_pulse: fires one time every year for every character (no scope)
#            on_birth_child (root is child), on_birthday (root is character having birtday), on_join_court, on title_gain.
test_cycle.001 = {
    hidden = yes
    trigger = {
            is_female = yes
            is_pregnant = no
            age >= 16
            age <= 45
            NOT = { has_character_flag = menopausal }
            }
    immediate = {
             save_scope_as = receiver
            add_character_flag = has_cycle
            trigger_event = test_cycle.008
    }
}

I also tried setting  subtract = 0 (so it doesn't go negative. No luck.

Link to post
3 hours ago, joemann said:

But the variable current_sex_drive already exists, that is why I am using change_variable. It should be there and if I look at the character in game it is.

I don't understand what "variable is not of the value scope type means"

 

 

To me, that sounds like it thinks the value of the variable is not a number. Can you post the code block where you use set_variable?

Link to post
1 hour ago, Hermitic said:

Hey, this isn't a bad idea for a topic. I have a question too. I've been dabbling in making a little mod for a militant version of Adamitism called Evism. I want conversion to the religion to change women's genes to make them taller and give them larger breasts, but I don't know how to do it. I don't want to write an event that checks all women who convert and then changes their genes because I don't know how to do that and it would negatively affect performance. I don't think it's possible via a special doctrine like naked priests either. Does anyone have suggestions?

There is a on_character_faith_change you could look at. No idea on how to set genes, but I believe it can be done via traits.

 

Conceptually, if you want to effect all women who convert, you are going to have to 'write an event that checks all women who convert' (well an effect anyway).

Link to post

I've been dabbling with this for the past hour. I made a flag to change characters' heights, but I can only seem to apply it via traits, not religion. I guess I could make a special trait for the religion and then give all females of that religion the trait, but I decided this isn't worth the trouble. I just went to 01_genes_morph and modified the bust and height genes to always be maximal for females. That's not quite what I want because it applies to all women instead of just the followers of the religion, but it's good enough for me. The mod for scaling breast size with beauty uses an event to change the genes of all women, but I wasn't able to jigger that to apply only to one religion. I'm sure it could be done with enough finagling, though.

Link to post
12 hours ago, Dagulus said:

 

To me, that sounds like it thinks the value of the variable is not a number. Can you post the code block where you use set_variable?

You could be on to something there.

 

The code block is the following:

Spoiler

update_female_libido = {
                    if = {
                        limit = {
                            is_female = yes                    
                            age >= 12
                            age <= 30
                            has_female_libido_positives = yes                                                                                                                                            
                        }                                                                                                                                                  
                        set_variable = { name = current_sex_drive value = var:basic_sex_drive }            
                        change_variable = { name = current_sex_drive multiply = 1.5 }
                        clamp_variable = { name = current_sex_drive max = 8 min = 0 }            
                    }

                  etc...

So when I set the variable, I refer to another variable, basic_sex_drive. The intention is to get the numerical value of that variable (which is a constant which each character gets at birth although it varies per character) and to be able to modify it depending on circumstances. In game this works, all characters have a basic_sex_drive and a current_sex_drive and they both have a numerical value attached to them. The current_sex_drive changes all the time. The only place where I get an error is in the female_cycle event. Your hypothesis seems reasonable but what can I do to remedy it?

Link to post

I solved it by adding the following to the event that called the error:

Spoiler

test_cycle.008 = {
    hidden = yes
    trigger = {
            is_female = yes
            is_pregnant = no
            has_character_flag = has_cycle
                            NOR = { has_character_flag = menstruating
                                    has_character_flag = ovulating
                                    has_character_flag = menopausal
                            }
    }    
    immediate = {
            remove_character_flag = luteal_phase
            add_character_modifier = {
                                    modifier = menstruating
                                    days = 7
            }
            if = {
                limit = {
                        has_variable = current_sex_drive
                }

                change_variable = { name = current_sex_drive subtract = 0.4 }
            }
            if = {
                limit = {
                        has_variable = pussy_lubrication
                }  
     
                change_variable = {    name = pussy_lubrication subtract = 0.2 }
            }
            trigger_event = {
                        id = test_cycle.009
                        days = 7
            }
            add_character_flag = menstruating
            
    }        
}

I suppose the variable wasn't found because the machine wasn't looking for it. The if block seems to trigger it.

Link to post

Ok, this one is good.

 

So I have an event that does four things in the immediate block.
Thing 1: Find a victim from the pool
Thing 2: Find a criminal from the pool
Thing 3: If there is not criminal from the pool, make a criminal
Thing 4: Apply the crime

What I expected to happen was the following sequence: Thing 1, Thing 2, Thing 3, Thing 4,...
What actually happens is this sequence: Thing 1, Thing 2, Thing 4, Thing 3,...

 

Try as I might, I cannot get this to run in the correct order. Even if you put Thing 4 is the scope of the criminal, it will still (astonishingly) fire before Thing 3 has actually created said criminal.

 

I suspect the reason why may be because the crime is from Carnalitis, which is obviously higher in my load order than my own mod, but you would still think basic sequencing could be achieved? So does anyone know if there is a way to set the sequence things go in?

Link to post

Yet another one from me. This time I want to make a character modifier that applies only to women. I wrote this (knowing it would not work) in order to show what I'm trying to do. The problem is that I don't know how to rewrite this so it does work. Does anyone know?

 

Spoiler

        character_modifier = {
            if = {
                limit = {
                    is_female = yes
                diplomacy = 5
                learning = 5

                }
            }
        }

 

Link to post
24 minutes ago, Hermitic said:

Yet another one from me. This time I want to make a character modifier that applies only to women. I wrote this (knowing it would not work) in order to show what I'm trying to do. The problem is that I don't know how to rewrite this so it does work. Does anyone know?

 

  Hide contents

        character_modifier = {
            if = {
                limit = {
                    is_female = yes
                diplomacy = 5
                learning = 5

                }
            }
        }

 

I don't believe modifiers have any way of pulling information from the object they are on, so i think you would have to use a trait instead.

 

However, why do you need to apply it to men in the first place?

Link to post
21 hours ago, Dagulus said:

Ok, this one is good.

 

So I have an event that does four things in the immediate block.
Thing 1: Find a victim from the pool
Thing 2: Find a criminal from the pool
Thing 3: If there is not criminal from the pool, make a criminal
Thing 4: Apply the crime

What I expected to happen was the following sequence: Thing 1, Thing 2, Thing 3, Thing 4,...
What actually happens is this sequence: Thing 1, Thing 2, Thing 4, Thing 3,...

 

Try as I might, I cannot get this to run in the correct order. Even if you put Thing 4 is the scope of the criminal, it will still (astonishingly) fire before Thing 3 has actually created said criminal.

 

I suspect the reason why may be because the crime is from Carnalitis, which is obviously higher in my load order than my own mod, but you would still think basic sequencing could be achieved? So does anyone know if there is a way to set the sequence things go in?

I don't understand how Thing 4 can apply the crime to the criminal, if the criminal doesn't yet exist. To whom or what is the crime applied?

Link to post

Another question. If I want to add a code block to a vanilla adultery event, and I want this modified file to override the original event how do I do this?

 

I have tried copying the entire vanilla adultery_events folder into my mod, including the modified event. The original event folder also remains in the vanilla game.

 

I use the same name for the folder as in the vanilla game and I use the same namespace for the event.

 

The error log informs me :  Event adultery.0001 has been queued twice with the same data including delay

 

Do I need to change the name of the folder to MyMod_adultery_events and the namespace to MyMod_adultery?

 

Do I really need to copy all the events into my mod or only the modified one?

 

 

 

Link to post
1 hour ago, joemann said:

I don't understand how Thing 4 can apply the crime to the criminal, if the criminal doesn't yet exist. To whom or what is the crime applied?

It is applied to an empty scope: That is the issue.

Link to post
1 hour ago, joemann said:

Another question. If I want to add a code block to a vanilla adultery event, and I want this modified file to override the original event how do I do this?

 

I have tried copying the entire vanilla adultery_events folder into my mod, including the modified event. The original event folder also remains in the vanilla game.

 

I use the same name for the folder as in the vanilla game and I use the same namespace for the event.

 

The error log informs me :  Event adultery.0001 has been queued twice with the same data including delay

 

Do I need to change the name of the folder to MyMod_adultery_events and the namespace to MyMod_adultery?

 

Do I really need to copy all the events into my mod or only the modified one?

 

 

 

Do you get a Duplicated event ID 'adultery.1001' found. error, if so what does it say?

Link to post

Ah, rats. I was trying to avoid traits. My idea of making a religion which causes converts to become maximal has presented many problems. I want it to apply only to women so they seem taller by comparison. I could easily add the height modifier to a trait, but then I would have to somehow ensure that all female converts get the trait.

Link to post
4 hours ago, Dagulus said:

It is applied to an empty scope: That is the issue.

You could try :

 

Spoiler

if = {

     limit = {

               exists = scope: criminal

    }

   Thing 4

}

Thing 4 would be blocked.  Thing 3 would happen. Don't know if Thing 4 would "fire" again though.

Link to post
4 hours ago, Dagulus said:

Do you get a Duplicated event ID 'adultery.1001' found. error, if so what does it say?

No just that it is queued twice. Which given that it exists twice, once in vanilla and once in my mod sort of makes sense.

Link to post
47 minutes ago, joemann said:

No just that it is queued twice. Which given that it exists twice, once in vanilla and once in my mod sort of makes sense.

Ok, actually now I think about it, I have seen that before. It was when the event was being called twice from the same on_action. Rather than it existing twice.

 

Basically I was trying to test a feast event by adding it as forced action from the on_action block, but did not remove it from the random_events.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...