[MOD] Wardrobe - Customize Character Outfits! [Help Needed for 1 Issue]

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

GorthMohogany

Recruit
40 Badges
May 30, 2016
5
4
  • Crusader Kings II
  • Age of Wonders III
  • Stellaris: Synthetic Dawn
  • Stellaris
  • Crusader Kings II: Sword of Islam
  • Cities: Skylines - Parklife
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Leviathans Story Pack
  • Stellaris: Distant Stars
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Sons of Abraham
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Cities: Skylines
  • Crusader Kings II: Way of Life
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Cities: Skylines - Natural Disasters
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
  • Stellaris - Path to Destruction bundle
Hi all,

I am working on a mod that allows you to, via character interactions, customize the clothing of a character.

This mod is inspired by the in-game clothing customization option that is part of the awesome Better Looking Garbs mod from CKII. I have a brief explanation of how it works at the end of this post. However...


I first want to highlight a problem I am currently having with the mod, and I think it has everything to due with my limited understanding of how scoping works in the game. Once this problem is resolved, I will expand on my explanation of how the mod works and also upload it.


I have successfully implemented a prototype that fully works on the player character, but I am having issues with getting this to work on non-player characters. I've poured through the IR wiki modding documentation (almost nothing is said about how scopes work with context to events) and code examples in the game files without luck. The implementation is broken down into the following:

a character interaction starts an event chain

Event 1 is hidden, designed to do some set up work for later to iterate through the clothing traits. That calls event 2
Event 2 gives options to go to the next/prev clothes option, accept, or cancel. next/prev recursively calls Event 2.


Here's the code below:



CHARACTER_INTERACTION CODE

Code:
change_clothing = {

    on_other_nation = no
    on_own_nation = yes
    message = no
   
    potential_trigger = {
        scope:target = {
            is_alive = yes
        }
    }
   
    allowed_trigger = {
        scope:target = {
            age > 5
        }
    }
   
    effect = {  
        scope:target = {
            trigger_event = { id = change_clothing.1 }
        }
    }
   
}





EVENT CODE:

Code:
EVENTS

change_clothing.0 = {
    type = character_event
    hidden = yes

    left_portrait = scope:target
    right_portrait = scope:actor

    immediate = {
        <--- ...code omitted for brevity... --->
        trigger_event = { id = change_clothing.1 }
    }
}

change_clothing.1 = {
    type = character_event

    title = "change_clothing.1.t"
    desc = "change_clothing.1.desc"

    hidden = no

    left_portrait = scope:target
    right_portrait = scope:actor

    option = {
        name = "change_clothing.1.next"

        <--- ...code omitted for brevity... --->

        trigger_event = { id = change_clothing.1 }
    }

    option = {
        name = "change_clothing.1.prev"

        <--- ...code omitted for brevity... --->

        trigger_event = { id = change_clothing.1 }
    }

    option = {
        name = "change_clothing.1.accept"

        clear_saved_scope = clothing_change_customer
    } 

    option = {
        name = "change_clothing.1.cancel"

        <--- ...code omitted for brevity... --->
    } 
}



Brief Explanation of how it works:
I'll expand a little later on how it works, but the abbreviated description is that clothing is encoded as part of a character's DNA. However, parts of this DNA can be modified in the game via traits (two in-game examples are blinded and one-eyed). As it turns out, you can leverage this to also modify a character's clothing (You also may be to modify hairstyles, beards, etc...). You also are not limited to the characters culture in terms of clothing options.
 
  • 2Like
Reactions:
I'll try help since I've had various problems with scopes too.

In my experience in Character Interactions the scope:target is always the target character of the interaction
while scope:actor is always the country using the interaction.

If you wish to limit the changing of clothing to only be possible to do to characters in a player country,
you could add in the interaction's potential_trigger the following :

Code:
    potential_trigger = {
        scope:actor = {
            is_ai = no
        }
        scope:target = {
            employer = scope:actor
            is_alive = yes
        }
    }

If you want them not shown to the player in game, you can add hidden: before each scope :
hidden:scope:actor = {
hidden:scope:target = {

----------------------

If an event is marked hidden = yes, you don't need to include portraits, descriptions or titles or options at all.
Not sure if hidden = no is needed since all events default to not being hidden.

Additionally since I think in Character Interactions the scope:actor is always a country scope, you might need to change
right_portrait = scope:actor
to for example :
right_portrait = scope:actor.current_ruler
or :
right_portrait = root.employer.current_ruler
since in a character event the ROOT is the character scope the event happened to.
That scope will find the character's employer country's current ruler for a portrait.

If you don't need to display the current ruler at all, just omit the right_portrait or left_portrait accordingly.
It doesn't matter if the event only has a left_portrait or a right_portrait. Or none at all. Or multiple of the same type.

----------------------

EDIT:
Sometimes I feel like events launched from Character Interactions do not maintain their scopes.
I usually have a sort of stepping stone event where the relevant scopes I want to use are set, to bypass relying on scope:actor or scope:target.
And then proceed with the event chain.
 
Last edited:
Thanks for the reply YTnuBF

Your insights on scopes helped me out. I was finally able to resolve my issue by changing some of the scopes you suggested as well as change the event type to country_event. Furthermore, I saved off the target scope before triggering the event so I could reference later.

Here's a preview!

Untitled1.png


Untitled2.png
 
  • 2Like
Reactions: