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
EVENT CODE:
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.
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.
- 2