Jump to content
Sign in to follow this  
failmuseum

[CK2] Having issues with event chain scopes and AI

Recommended Posts

I'm trying to make a very small event chain but I'm having trouble using the ROOT and FROM scopes. The basic idea is to give another option to raise a character's relationship with their spouse/lover by using a decision to invite them to a special dinner. Right now, I've got a functioning, but basic decision and event to accomplish this. This isn't sufficient because what I have is only good if this is only being used by the player, and I'd like the AI to be capable of using the decision as well. The reason is the options in the events (minus backing out of the scenario) run the risk of the characters (including the player if the AI is the initiator) getting the gluttonous trait and a guarantee increase in weight depending on the option chosen. Because gluttonous is such an awful trait and increasing the weight variable is something that not many players would want, I want to add an option for the target to decline, ending the chain. I have tried making this event. The problem I'm having is that whenever I accept the offer  I try to send the actual dinner event back to the character that used the decision, but instead the event plays for the character who had chosen to accept the invitation, They are also the only character present in the dinner event. In the following post I'm going to post the code that I currently have. To make it a bit clearer, the flow of how I want things to go vs. how things are with my functioning incomplete chain goes like this: 

(How it currently is:   FROM: Decision -> FROM (with ROOT): Event)         

 (How I want it to go: FROMDecision -> ROOT: Event -> FROM (with ROOT): Event)

(How it is when I try to implement my extra event for FROM: FROM: Decision -> ROOT: Event ->ROOT (Alone); Event)

Share this post


Link to post

Dinner_Date_Decision = {                         # This is a targetted decision
        filter = all
        from_potential = {
            prisoner = no
            NOT = { trait = in_hiding }
            ai = no
        }
        potential = {
            OR = { # Should be a lover, spouse, or concubine
                any_lover = {
                    character = FROM
                }
                any_spouse = {
                    character = FROM
                }
                any_consort = {
                    character = FROM
                }
            }
        }
        allow = {
            prisoner = no 
            NOT = { trait = in_hiding }
            is_within_diplo_range = FROM 
        }
        effect = {
            ROOT = { character_event = { id = FTCYINTERACTIONS.2 }
        }
        }
        ai_will_do = {
            factor = 0 
        }
    }

Share this post


Link to post

This is the event that ROOT gets:

 

character_event = {
    id = FTCYINTERACTIONS.2
    desc = FTCY_Dinner_Date_Proposal_Desc
    border = GFX_event_normal_frame_intrigue
    picture = GFX_evt_fancy_feast

    is_triggered_only = yes
    
    
    
    option = {
    name = FTCY_Dinner_Date_Option1
        ROOT = { character_event = { id = FTCYINTERACTIONS.1 days = 1 } }
    }

 

    option = {
    name = FTCY_Dinner_Date_Option2
    }


}

Share this post


Link to post

character_event = {                                                                          #This a shortened version of my Dinner Date event, there are normally 4 options
    id = FTCYINTERACTIONS.1                                                          #Also, I've noticed that ROOT and FROM got flipped around for reasons I don't understand
    desc = Dinner_Date_Description
    border = GFX_event_normal_frame_diplomacy
    picture = GFX_evt_feast
    
    is_triggered_only = yes
    
    option = {
    name = Dinner_Date_option_1
    ROOT = {
            change_variable = { which = physique_variable value = 1 }
            wealth = -20.0
        random = {
            chance = 5
            add_trait = gluttonous
        }
    }
    FROM = {
            change_variable = { which = physique_variable value = 1 }
        random = {
            chance = 5
            add_trait = gluttonous 
            hidden_tooltip = {
                    ROOT = {
                        character_event = { id = FTCYINTERACTIONS.3 }
                    }
                }
        }
    }
    }
    
    option = {
        name = Dinner_Date_option_4
    }
}

Share this post


Link to post

While the event now works for the player perspective, I can't get the AI to use any of the decisions I've made. The AI used to be able to use my second event I made, but now they are unable to do any of them (me attempting the solution isn't the cause, I have started noticing my AI not using my events before I made this post). I don't know what I did, or even  if I did anything at all. Below is the Dinner Date Event I currently have as well as the event that used to work (It worked back in May 2019, when I first made the decision). There are two other targetted decisions that are on this file, but I know they are not the problem because I created a new txt document, cut my decision out of the main decision file and pasted it to the new document in an attempt to isolate the decision and see if it was the one causing issues, it wasn't, both decisions that the AI should be able to do were still not being used.

Share this post


Link to post

Dinner_Date_Decision = {
        ai_target_filter = all
        filter = all
        ai_check_interval = 1
        from_potential = {
            prisoner = no
            NOT = { trait = in_hiding }
        }
        
        potential = { # This is where we check the target to ensure they're valid
            OR = { # Should be a lover, spouse, or concubine
                any_lover = {
                    character = FROM
                }
                any_spouse = {
                    character = FROM
                }
                any_consort = {
                    character = FROM
                }
            }
        }
        
        allow = {
            prisoner = no # The target shouldn't be in prison
            NOT = { trait = in_hiding }
            is_within_diplo_range = FROM 
        }
        
        effect = {
            ROOT = { character_event = { id = FTCYINTERACTION.2 }}
        }
        ai_will_do = {
            factor = 100
        }
    }

Share this post


Link to post

FTCY_Torture_Prisoner = {
        filter = court
        ai_target_filter = court
        ai_check_interval = 3
        from_potential = {
            prisoner = no
            is_adult = yes
        }
        potential = {
                is_adult = yes
                prisoner = yes
                NOT = { has_character_modifier = broken_modifier }
                host = {
                    character = FROM
                }
        }
        allow = {
            prisoner = yes
        }
        effect = {
            FROM = { character_event = { id = FTCYINTERACTION.4 }}
                    }
        ai_will_do = {
            factor = 1    
                modifier = {
                    factor = 30
                    FROM = {
                        OR = {
                            trait = envious
                            trait = cannibal
                            trait = lunatic
                            trait = possessed
                                }
                                }
                                }
                        }
    }

Share this post


Link to post
4 minutes ago, failmuseum said:

        ai_target_filter = all
        filter = all
        ai_check_interval = 1

You should never ever use all for your ai_target_filter, especially when combined with an ai_check_interval of one month.

 

5 minutes ago, failmuseum said:

       ai_will_do = {
            factor = 100
        }

Factors go from 0 (0%) to 1 (100%)

Share this post


Link to post

sorry, I'm new to this. I've also tried setting factor 1 before and I still didn't have any results, the 1 month interval is also just for testing purposes, I'm probably going to change it to about a year or so once if I can get the AI to work.

 

As for the filter, what one should I pick considering my requirements for ROOT (spouse, lover, concubine)? I'd prefer not to use court as the filter, since spouse could become landed, but if I have to I'll change it.

Share this post


Link to post
2 minutes ago, failmuseum said:

As for the filter, what one should I pick considering my requirements for ROOT (spouse, lover, concubine). I'd prefer not to use court as the filter, since spouse could become landed, but if I have to I'll change it.

realm is preferred, but all can be used if you use more restrictive potentials and from_potentials so the CPU wont get clogged up with so many AI checking everyone.

Share this post


Link to post

I'll switch it to realm then. As for the AI issue though, I'm going to try making a tiny mod with my two decisions and relevant events just to see if I screwed with something I wasn't supposed to somewhere else in the mod.

Share this post


Link to post

Okay, I just isolated the decisions and events I made for the original mod. I also turned off the original mod just make sure. I still can't get the AI to use my decisions, but I could use the decisions properly. It's the same situation. Just be as clear as I possibly can be, the decisions themselves are functional, its just that AI wont use them.

 

Edit: I made archives of previous versions of the mod, so I also decided to check the version of the mod that still had the decisions work. The AI still won't touch my decisions, event though this is the exact same version of the mod when they did.

 

 

Edit 2: I have also now tried copy and pasting my dinner date decision into my copy of another mod's targetted decisions section that I believe is working as intended (dark world tentacles to be specific). I'm still not getting anywhere.

Share this post


Link to post

I figured it out. Its a mod conflict. Apparently, its Dark World Fantasy module far east. As soon as I deactivated it, AI started working again. This is likely my fault, because my mod adds a bit of content for Nekos (Its only been unique events for them as well as a few event options with Neko triggers) but not as a dependency. But I don't think I ever dug around the module's files beyond looking for the trait's editor name. I'll try reinstalling module.

 

The mods I have integrated are: Bigger Event windows (dependent), DWF Far East (more content for Nekos), and DWF tentacles ("sort of" compatibility by giving every character a flag Tentacles made to skip one of the transformations and a tiny amount of content related to my mod)

 

 

Edit: I reinstalled it, but I'm still having the same issues with it. And now that I'm thinking about it, I only added the Neko content a few days ago, but I still had the same issues with both the isolated event and decisions mod (no Neko content) as well as my older version of the mod. Now I'm really lost as to whats going on. I have the most up to date version of the module and dark world fantasy.

Share this post


Link to post

Here is the isolated decisions and events, they don't have any references to Nekos nor any dependencies on other mods. This little test mod is having all of the same issues as my main mod, and the events are simplified versions of the original (mostly just the events). If after a month or so you get a popup with "getting_tight_2" as the description, then it is working correctly. 

 

I'm a bit worried that I may have to reinstall my game, or gut my Neko content.

 

Dinner Date.rar

Share this post


Link to post

Why don't you post the whole thing, with neko references and dependencies? It would be better to have the whole thing to debug than a tiny snippet.

 

Also make sure you are using The Validator.

Share this post


Link to post

Sorry, yeah I should have posted my full mod. The reason I didn't post it first is because I'm currently using custom artwork, but I currently don't have permission to put it into my mo., so right now they are just there as  place holders right now while the mod is still in development, to be removed if I don't get the "okay" from their respective artists. So I posted that little snipet just to get something out quickly. I didn't think to just remove the gfx folder to that more quickly. I'll post full thing in minute.

 

And as for the Validator, it isn't finding my mod for some reason. Its picking up the snipet mod though. Not sure what's up with that.

 

 This should work, tell me if the game crashes. I might have messed up when I added its dependency.

Share this post


Link to post
24 minutes ago, failmuseum said:

And as for the Validator, it isn't finding my mod for some reason.

Your .mod file:

name = "Fatocracy"
archive = "mod/Fatocracy"

 

The proper format:

name = "House Irae"  # This is the name, duh
path = "mod/HouseIrae"  # This is where your mod is located
user_dir="House Irae"  # This is where your saved data (saved games, cache, flags, etc) is located
dependencies = { "Dark World Fantasy" }  # This tells the engine what mods to load first before yours

 

Share this post


Link to post
4 minutes ago, failmuseum said:

would my dependency be, DWFantasy, DWFM Races Far East, or DWFantasy Modules?

If you are making changes to nekos, then definitely use:

 

dependencies = { "DWF Module - Far East" }

 

Share this post


Link to post

Its not really a change, its just calling on the Neko trait for events and event options. But I probably should make it a dependency anyway, thanks.

Share this post


Link to post
1 minute ago, failmuseum said:

Its not really a change, its just calling on the Neko trait for events and event options. But I probably should make it a dependency anyway, thanks.

If you're only calling the trait for events and stuff, then you should use "Dark World Fantasy" unless your mod requires nekos. DWF has redundancy traits for all modules, so there will be no errors when a mod calls for a trait when the user does not have it installed.

 

If you're adding the trait in to a character, use "DWF Module - Far East" instead because normal DWF redundancy traits are hidden, don't have any modifiers, and are useless except to prevent errors.

Share this post


Link to post

Due to the circumstances where the AI stops making decisions, I'm really not sure how to proceed. Considering that whenever Far East Races is enabled, it seems to effect all targeted decisions based on the snipet mod. I've also tried removing my mod from the mod directory entirely and the AI still breaks whenever that specific module is active. I have everything backed up, should I reinstall my game and mod list and see if that fixes the problem?

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...