Jump to content

scope problem ?


joemann

Recommended Posts

I am attempting to make my own mod based for an important part on DWR.

 

I am running into a problem which I believe is a scope problem but I can't solve it.

 

I have a targeted decision (break-in slave) that starts a narrative event chain that at the end triggers a hidden character_event (from DWR Slavery events) which in turn automatically triggers the training option event. The problem is that the initial decision and event chain all address the slave but that somewhere during the hidden character event something goes wrong and the training options are then shown for the slaver (i.e. the player character) and not the slave.

 

The code is as follows:

 

.1 Target notified they're a prisoner (target - hidden)
character_event = {
    id = RSLS.1
    is_triggered_only = yes # Triggered by targeted decision or by event id.2 (Break-in Slave)
    hide_window = yes # Nothing to see here
    immediate = {
        save_event_target_as = rsl_slave_target
        if = { # Female routing
            limit = {
                is_female = yes
            }
            set_character_flag = asked_for_better_prison # Prevents them from asking for better conditions
            host = {narrative_event = { id = RSLS.3 }} # Host is the person who has the prisoner
            break = yes
        }
        if = { # Male routing
            limit = {
                is_female = no
            }
            set_character_flag = asked_for_better_prison  # Prevents them from asking for better conditions
            host = {narrative_event = { id = RSLS.5 }} # Host is the person who has the prisoner
            break = yes
        }
    }
}
# .3 Slaver determines the training for the female slave (host)
narrative_event = {
    id = RSLS.3
    desc = "RSLS3"
    picture = slavery_female_cell1
    title = rsl_slave_training_target
    is_triggered_only = yes # Triggered by .1
    option = { #Pleasure Slave Training
        trigger = {
            event_target:rsl_slave_target = { is_adult = yes } # Only adults can be pleasure slaves
            NOT = {
                event_target:rsl_slave_target = { has_character_modifier = rsl_slave_pleasure_complete } # We ensure they didn't already complete the pleasure training
            }
        }
        name = "RSLS3A"
        event_target:rsl_slave_target = {
            add_character_modifier = { name = rsl_slave_pleasure_1 duration = -1 } # Stage 1 flag, indefinite duration - as we'll be changing it manually
            set_character_flag = rsl_slave_training_in_progress
            character_event = { id = RSLS.400 }
        }
    }

I have tried deleting <host = {> in the .1 event but that doesn't change anything.

 

Can someone please point me in the right direction. Your help is much appreciated.

 

Link to comment

The issue is probably in the event .1 

 

Specifically this part:  save_event_target_as = rsl_slave_target

 

Since this is started with a targeted decision try using:

 

ROOT = { save_event_target_as = rsl_slave_target } 

 

That should make sure the correct target is getting saved so the events fire for them and not the slaver. Otherwise I'm not seeing anything that could be causing it. 

 

Link to comment

Can we see the decision that sends the first event? make sure. if it's a targeted decision that the first event is sent to ROOT and not FROM. if the decision has third_party, then maybe the intended meaning is to send it to FROMFROM insteasd (the third party).

Link to comment

Thank you for your help. I will try your solutions and report back. 

 

Below is the the event that triggers the chain of events

 

# Break-in Slave
narrative_event = {
    id = RSLS.2
    desc = RSLS2
    picture = GFX_evt_rsl.rapeoptions
    title = rsl_break_in_slave

    is_triggered_only = yes

    option = {
        trigger = {
            FROM = {
                NOT = { trait = broken_in }
                NOT = { trait = broken }
            }
        }
        name = rsl_option_further
        
        random_list = {
                90 = {     #success
                    host = { narrative_event = { id = RSLS.21 }}
                    FROM = {
                        spouse = { prestige = -15 }
                        add_trait = broken_in
                        opinion = {
                            who = ROOT
                            modifier = rsl_opinion_slave_master
                            years = 10
                        }
                    }
                }
                10 = {    #fail
                    host = { narrative_event = { id = RSLS.213 }}
                    FROM = {
                        add_trait = broken
                }         
            }            
                
        }

    }
}
    
# Obedience training 10
narrative_event = {
    id = RSLS.21
    desc = RSLS21
    picture = GFX_evt_rsl.trainobediance1
    title = rsl_breaking_in_slave

    is_triggered_only = yes

    option = {
        name = rsl_option_further
        narrative_event = { id = RSLS.211 }
    }
}

# Obedience training 11
narrative_event = {
    id = RSLS.211
    desc = RSLS211
    picture = GFX_evt_rsl.trainobediance2
    title = rsl_breaking_in_slave

    is_triggered_only = yes

    option = {
        name = rsl_option_further
        narrative_event = { id = RSLS.212 }
    }
}
# Obedience training 12
narrative_event = {
    id = RSLS.212
    desc = RSLS212
    picture = GFX_evt_rsl.trainobediance3
    title = rsl_breaking_in_slave

    is_triggered_only = yes

    option = {
        name = rsl_option1
        character_event = { id = RSLS.1 }
        
    }
}

 

 

Link to comment

I have tried the solution with ROOT, FROM and FROMFROM, in all three cases I get the slaver as the subject of the training.

 

I find this scope issue very difficult to understand. The modding wiki does not help make it much clearer for me.

Link to comment

I went back to the original targeted decision that triggered event .1 ( there was no trigger by event as I am trying to create)

 

The script is as follows:

 

#Enslave a prisoner
    dw_enslave_prisoner = {
        filter = court
        ai_target_filter = court
        ai_check_interval = 3
        from_potential = {
            prisoner = no
            has_valid_slavery_location = yes
        }
        potential = {
            ai = yes # We're not going to enslave the player, as we're not detailing any of the slave side events
            prisoner = yes
            NOT = { has_character_modifier = dw_slave_training } # A slave who is already being trained is already a slave.
            NOT = { trait = branded_slave }
            host = {
                character = FROM
            }
        }
        allow = {
            age = 6 # Kids can be trained, although only in non-sexual jobs
            always = yes
        }
        effect = {
            character_event = { id = DWSlavery.1 days = 1 } # Target notified
            add_character_modifier = { name = dw_slave_training duration = -1 } # Character slotted for slave training
        }
        ai_will_do = {
            factor = 0.10 # 10% base chance
            modifier = {
                factor = 0
                FROM = {
                    ai_honor = 20 #Honorable ai will opt not to enslave someone.
                }
            }
            modifier = {
                factor = 0
                FROM = {
                    ai_zeal = 50 # Highly spiritual ai will opt not to enslave someone.
                }
            }
            modifier = {
                factor = 3 # makes it 30%
                FROM = {
                    ai_greed = 20 # Greedy ai will be more likely to enslave someone.
                }
            }
        }
    }

 

I suppose that the key is :  host = {
                                                        character = FROM

 

But how is that different from my event which also seems to be in the From scope?

Link to comment

As far as I can see, the decision and the follow-up events are fine. The problem is going from RS.2, which fires for the slave if I'm not mistaken. The problem is that if you get the first branch of the random_list the host is the one that receives events 21 -> 211 -> 212, and from there, since you are scoping to the slaver, you'll send event 1 to the slaver instead of the slave. To fix that, in event 2 save the slave as an event target, and then in the last event send event 1 to said target. Like I said, all uses of host = {} in your current code are fine and probably you'll break the meaning of the chain (more) if you remove them.

 

I hope this helps.

Link to comment

would that look like this? I'll try it.

 

# Break-in Slave
narrative_event = {
    id = RSLS.2
    desc = RSLS2
    picture = GFX_evt_rsl.rapeoptions
    title = rsl_break_in_slave

    is_triggered_only = yes

    save_event_target_as = rsl_slave_target

    option = {
        trigger = {
            FROM = {
                NOT = { trait = broken_in }
                NOT = { trait = broken }
            }
        }
        name = rsl_option_further
        
        random_list = {
                90 = {     #success
                    host = { narrative_event = { id = RSLS.21 }}
                    FROM = {
                        spouse = { prestige = -15 }
                        add_trait = broken_in
                        opinion = {
                            who = ROOT
                            modifier = rsl_opinion_slave_master
                            years = 10
                        }
                    }
                }
                10 = {    #fail
                    host = { narrative_event = { id = RSLS.213 }}
                    FROM = {
                        add_trait = broken
                }         
            }            
                
        }

    }
}

 

# Obedience training 12
narrative_event = {
    id = RSLS.212
    desc = RSLS212
    picture = GFX_evt_rsl.trainobediance3
    title = rsl_breaking_in_slave

    is_triggered_only = yes

    option = {
        name = rsl_option1
        event_target:rsl_slave_target
        character_event = { id = RSLS.1 }
        
    }
}

Link to comment

This is obviously not the way to write it :frown:

 

Could you be patient and spell it out for me?

 

Your help is really appreciated. I have been trying to mod for about a month now but  progress is slow.

 

It is fun though when you get something to work.

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use