Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

sigh...

I'm having some issue with variables, this is the wikis advice

ROOT = {
  export_to_variable = { which = global_trainstew value = stewardship who = FROM }
}
Add to display it I'm trying
[global_trainstew.GetName] [global_trainstew.GetValue]
But everything is blank. :-/

 

What I want to do, Is put the stewardship value of the person I right-CLICK ON in the variable, and then have that variable + value display in a window. I'd much appreciate this clearing up please.

Wouldn't knoe what the problem is. Maybe it's elsewhere in your script/localisation?

Link to comment

 

 


Wouldn't knoe what the problem is. Maybe it's elsewhere in your script/localisation?

 

 

I don't think so, these were pre-working events that I just tried adding to. You're saying the code in previous post is correct (in isoloation ) ?

Ok let's scale back, I've just right clicked a targetted decision on someone.

This launches a character event. In this character event is when I want to pull the CLICKED ON persons stewardship, put into a global variable. What would that small code snippet look like please?

 

 

Well I have now given up on the export to variable command. Tried a 100 different variations none work. Resorted to an

If learning = 1, set variable =1

If learning = 2. set variable =2 etc.

 

But I would be super interested in hearing if ANYONE can get the export to variable command working.

 

Next question! :P

FromFrom = {
         move_character = FROM
}	

What that does is  make ME the home-liege of FromFrom.  however I'd like it to be an IF statement that only does it  if they're NOT already part of my court.

If = {
      Limit = {
               FromFrom = {
                           Not = {
                                  <<<< AT COURT OF PLAYER(From) >>>>
                           }
               }
      }
FromFrom = {  move_character = FROM}
}	

Cheers

Link to comment
  • 2 weeks later...

I have 2 questions, 1st one important, 2nd not so much.

 

For a targetted decision, kidnapping in this case. How do I check the player has a spymaster  employed before it allows the targetted decision please?

 

Secondly I wanted to stop  the kidnapping of a heirs heir, or child of any heir

For instance King Andys son Bob is the heir - but not landed yet. Bobs son is Craig. So Craig is the heirs heir. How do stop them being a potential target of a targetted decision please?

 

I tried

Not = {
        father = { is_heir = yes}    }

But it did nothing.

 

Link to comment
  • 2 weeks later...

I'm just getting my feet wet as far as modding goes.  So far I've added my own dick size trait and made it congenital.  Problem is that my daughters are being born with dicks.  What do I add to the code to make the dick traits only for males and the breast traits only for women?

Link to comment

Hello,

 

i have a question and hope you can help me. 

 

Is it possible to ask in the script if fertility is over a percent stage?

 

Like: fertility >= 50%

 

Sincerely

Merle

Im a noob whose asked 50% of the questions in this thread, but  think I maybe have the answer

 

If = {
       Limit = {
                   ROOT = {
                            fertility = 0.50
                    }
        }
}

That SHOULD work, im thinking. Obviously change Root to the scope of who you want to check. And the fertility check works weirdly, even though it reads like it says EQUALS 0.50, what the code interprets that as is actually "is fertility at least" in this case 50%.

Link to comment

I'm just getting my feet wet as far as modding goes.  So far I've added my own dick size trait and made it congenital.  Problem is that my daughters are being born with dicks.  What do I add to the code to make the dick traits only for males and the breast traits only for women?

 

This covers males and futas (assuming you are using Dark World) for dick traits:

potential = {
    OR = {

        is_female = no
        AND = {
            is_female = yes
            trait = futa
        }
    }
}
Link to comment

 

I'm just getting my feet wet as far as modding goes.  So far I've added my own dick size trait and made it congenital.  Problem is that my daughters are being born with dicks.  What do I add to the code to make the dick traits only for males and the breast traits only for women?

 

This covers males and futas (assuming you are using Dark World) for dick traits:

potential = {
    OR = {

        is_female = no
        AND = {
            is_female = yes
            trait = futa
        }
    }
}

 

Thank you very much.  I'm going to take a guess that I should delete trait = futa completely and change is_female = no to is_male = no for preventing sons from having tits.

Link to comment

Hello, I'm super new here, :P

 

My question is, is there any way to do an event any time a character is created from thin air? It's the character that are created using create_character, create_random_diplomat, etc.

 

I can't find it anywhere in on_action trigger. I can only do it when any character is born but not the random character created by the game.

 

Hopefully you understand what I mean, I don't speak english.

Link to comment

I understand what you mean. I don't think there is an on action trigger for that.

 

If it's you creating the character there are obviously options but if your trying to pop an event when som other mod created any character I'm afraid there is no way to track that, that I know of.

Link to comment

Not possible. Best approximation is fire the event in all characters periodically, if they are not been accesed buly that event before, do what you want and set a flag telling the event not to do anything on that character in future repetitions.

Link to comment

I guess I'll try to do the periodical check thing, I was about to overriding all of the event that have the create_character until I read this, and that's probably a bad idea. So, Thank You very much t! I don't usually do an event that fire to all character because I think it would not be good for performance but I guess using flag will work.

Link to comment

I'm really quite stuck.. is there a way to modify/effect an NPC greater than 4 windows deep?

What I mean is

 

From is the NPC

>character event

FromFrom is now the NPC

>character event

FromFromFrom is the NPC

>character event

FromFromFromFrom is now the NPC

>character event

 

Once I get to this point, I'm stuck. ROOT obviously references the player, but how can I say add a trait to the NPC   further windows deep (ie From x5 - FromFromFromFromFrom) ??

Link to comment

I'm really quite stuck.. is there a way to modify/effect an NPC greater than 4 windows deep?

What I mean is

 

From is the NPC

>character event

FromFrom is now the NPC

>character event

FromFromFrom is the NPC

>character event

FromFromFromFrom is now the NPC

>character event

 

Once I get to this point, I'm stuck. ROOT obviously references the player, but how can I say add a trait to the NPC   further windows deep (ie From x5 - FromFromFromFromFrom) ??

 

I hate using multiple FROM, so I usually just use the save_event_target_as so I don't get lost on who's the FROM is.

 

Using that  you can save a scope so you don't have to refer to them with multiple FROM.

#In the chain

FROM = {
  save_event_target_as = mysterious_guy
}
new_character = {
  character_event = { id = seductor_letter.3 }
}

#And in the seductor_letter.3 event chain you can use it to refer as him so you don't have to use FROMFROM

event_target:mysterious_guy= {
  add_trait = lustful
}

You can keep use the event_target in the event chain so the multiple FROM won't be needed anymore

 

hopefully this help

Link to comment

 

No I just dont get it.

Can you please post a proper full on example of how to use event_target?

I know it might seem like a lot of effort  but please? I am tearing my hair out here.

Hopefully you can just copy/paste the below and edited it dead quickly, please?

character_event = { 
	id = IST.001
	desc = IST001desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

        From = { save_event_target_as = IST_target }

	option = { name = IST001option
		character_event = { id = IST.002 }  
	}
}

character_event = { 
	id = IST.002
	desc = IST002desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST002option
		character_event = { id = IST.003 }  
	}
}

character_event = { 
	id = IST.003
	desc = IST003desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST003option
		character_event = { id = IST.004 }  
	}
}

character_event = { 
	id = IST.004
	desc = IST004desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

	option = { name = IST004option
		character_event = { id = IST.005 }  
	}
}

character_event = { 
	id = IST.005
	desc = IST005desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST005option
		character_event = { id = IST.006 }  
	}
}

character_event = { 
	id = IST.006
	desc = IST006desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

        From = { save_event_target_as = IST_target }

	option = { name = IST006option
		character_event = { id = IST.007 }  
	}
}

character_event = { 
	id = IST.007
	desc = IST007desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

	option = { name = IST007option
		 **<<<<<APPLY TRAIT TO SAVED DESIRED NPC>>>>>**
	}
}

 

This is how you give traits to the ROOT character in the IST.001 event in the IST.007.

character_event = { 
	id = IST.001
	desc = IST001desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

        ROOT= { save_event_target_as = IST_target }

	option = { name = IST001option
		character_event = { id = IST.002 }  
	}
}

character_event = { 
	id = IST.002
	desc = IST002desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST002option
		character_event = { id = IST.003 }  
	}
}

character_event = { 
	id = IST.003
	desc = IST003desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST003option
		character_event = { id = IST.004 }  
	}
}

character_event = { 
	id = IST.004
	desc = IST004desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

	option = { name = IST004option
		character_event = { id = IST.005 }  
	}
}

character_event = { 
	id = IST.005
	desc = IST005desc
	picture = GFX_evt_IST1
	is_triggered_only = yes


	option = { name = IST005option
		character_event = { id = IST.006 }  
	}
}

character_event = { 
	id = IST.006
	desc = IST006desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

	option = { name = IST006option
		character_event = { id = IST.007 }  
	}
}

character_event = { 
	id = IST.007
	desc = IST007desc
	picture = GFX_evt_IST1
	is_triggered_only = yes

	option = { name = IST007option
		event_target:IST_target = { add_trait = lustful }
	}
}
Link to comment

I'm currently making a honeymoon decision by doing something like the pilgrimage event chain. Everything work fine but I forgot that muslim religion have multiple wife. So basically I want to make this event to have 4 option like this

 

opt1: I want to bring my first wife [name]

opt2: I want to bring my second wife [name]

opt3: I want to bring my third wife [name]

opt4: I want to bring my fourth wife [name]

 

Is there any way to do this? I can only scope to the first wife but I'm stuck on how to do the other three.

Link to comment

I'm posting from mobile so I can reference any code easily, but you should be able to do what you want in a hidden event by scoping 'any_realm_character' , consort off from, and then setting flags on each one to label second wife, third wife, etc...

 

Then you can have each option utilize the flags on that specific character for future events.

 

After the event chain completes just make another hidden event to clear flags.

 

Sort of like how DewGuru does with his Visit events

Link to comment

I'm posting from mobile so I can reference any code easily, but you should be able to do what you want in a hidden event by scoping 'any_realm_character' , consort off from, and then setting flags on each one to label second wife, third wife, etc...

 

Then you can have each option utilize the flags on that specific character for future events.

 

After the event chain completes just make another hidden event to clear flags.

 

Sort of like how DewGuru does with his Visit events

 

That seems complicated, hehe. I guess I'll just do opt1 with first wife and then opt2 for random second wife who haven't been to a honeymoon. Thanks for the help though, I'll probably do it at some point but I'm too lazy right now,  :P

 

I seem to have too much question in here but have a new question. How do you make a localisation for a temple holding name by character's religion. Example:

 

"I'd have to go to church to pray" for christian character

or 

"I'd have to go to mosque to pray" for muslim character

or

"I'd have to go to temple to pray" for pagan/indian religion character

Link to comment
character_event = {
	id = namespace.N
	desc = namespace.N.d
	picture = GFX_evt_comet
	
	trigger = {
		#conditions
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		if = {
			limit = {
				num_of_spouses > 1 #This will check if the character has more than one (living) spouse.
			}
			if = {
				limit = {
					num_of_spouses = 3 #I think muslims can only have up to 3 wives right?
				}
				random_spouse = {
					limit = { is_main_spouse = no NOT = { event_target:secondary_spouse_2 = { character = PREV } } }
					save_event_target_as = secondary_spouse_1
				}
				random_spouse = {
					limit = { is_main_spouse = no NOR = { event_target:secondary_spouse_1 = { character = PREV } } }
					save_event_target_as = secondary_spouse_2
				}
			}
		}
	}
	
	option = {
		name = LOC_KEY1
		spouse = { #This scopes to the main spouse.
			#effects
		}
	}
	option = {
		name = LOC_KEY2
		event_target:secondary_spouse_1 = {
			#effects
		}
	}
	option = {
		name = LOC_KEY3
		event_target:secondary_spouse_2 = {
			#effects
		}
	}
}

Something like that should work, it's off the top of my head but it -should- work. This way you can scope directly to the desired spouse via the event_target:secondary_spouse_1/2 so long as the event chain is unbroken (might need to make it a global event target if the chain is broken, in which case you'd want to limit who can get the events to avoid crossing targets, like making it player only for example).

 

< and > should work but might not, I can't remember if they've expanded the operators for those conditions yet.

Link to comment

For localisation you can define custom keys now.

 

In localisation\customizable_localisation create a new file (call it something like 00_a_mycustomloc.txt or whatever you want).

 

In there, do this;

defined_text = {
	name = GetReligionTempleName
	
	text = {
		localisation_key = ReligionTemple_Mosque
		trigger = {
			religion_group = muslim
		}
	}
	text = {
		localisation_key = ReligionTemple_Church
		trigger = {
			religion_group = christian
		}
	}
	text = {
		localisation_key = ReligionTemple_Temple
		trigger = {
			NOR = {
				religion_group = muslim
				religion_group = christian
			}
		}
	}
}

Then create a new file in \localisation\ called mycustomloc.csv or whatever and put in there;

ReligionTemple_Mosque;Mosque;;;;;;;;;;;;;x
ReligionTemple_Church;Church;;;;;;;;;;;;;x
ReligionTemple_Temple;Temple;;;;;;;;;;;;;x

Then when you want to use your custom key, you'd write your localisation line like;

goto_temple_pray;I'd have to go to [Root.GetReligionTempleName] to pray.;;;;;;;;;;;;;x

All of this is untested and literally typed while I'm eating lunch  :angel:

Link to comment

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...

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