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

xGhost4000x

General
137 Badges
Aug 5, 2009
2.128
143
  • Crusader Kings II
  • Stellaris: Apocalypse
  • Crusader Kings II: Jade Dragon
  • Steel Division: Normand 44 - Second Wave
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Third Rome
  • Knights of Honor
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Magicka 2
  • Pillars of Eternity
  • Crusader Kings II: Holy Knight (pre-order)
  • Cities: Skylines Deluxe Edition
  • War of the Vikings
  • War of the Roses
  • Warlock 2: Wrath of the Nagas
  • Warlock 2: The Exiled
  • Warlock: Master of the Arcane
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria 2
  • Ship Simulator Extremes
  • Sengoku
  • Semper Fi
  • Rome Gold
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Deus Vult
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Charlemagne
  • A Game of Dwarves
  • Crusader Kings II: Legacy of Rome
Hi so I have alot of Ideas for new events, but I have almost no clue where to start with this game.

Anyway if anyone could be so kind as to give me some help this is how far I got.

In after_battle.txt

In this, my first attempt ever to create an event, I am trying to make it so that if a general has the trait "Wounded" and loses a battle he is captured, or killed, or escapes. The problem is I have no idea how to incorporate the options, or how to get things like "EVTNAME515" to work properly. EVTNAME515 is obviously supposed to be the title at the top, and EVTDESC515 obviously the body of the text. But where do I define them?

character_event = {
id = 515 <------------------- What are safe event ids to use?

is_triggered_only = yes
trigger = { traits = wounded }

title = "EVTNAME515"
desc = "EVTDESC515"

option = { <----------------I have no idea what to do here.....



I think the only thing I have correct above is the trigger....

I have read things like these: http://forum.paradoxplaza.com/forum/showthread.php?t=451205
http://forum.paradoxplaza.com/forum/showthread.php?t=355677
http://forum.paradoxplaza.com/forum/showthread.php?t=370015


but without an actual full example of a event and an explanation of how it works and why I can't seem to figure it out.

I'm terribly sorry if there is already a thread with the information I request. Thank you for any help in this matter.
 
Still not sure if I'm working in the right direction, or if I'm even cut out for this. Anyway, presumably;


option A would have a 50% chance of capture, 35% of escape, and 15% of accidentally killing him in pursuit. 10 Loss of ruler popularity if you fail. 15 gain if you succeed.

option b would have a would have a 60% chance of killing him, and a 40% chance of escape. 10 Loss of ruler popularity if you fail. 15 gain if you succeed.

option c would have a 100% chance of his escape, because you take the moral high ground you gain 5 popularity.

obviously still missing triggers, as this should only happen if he is wounded AND just lost a battle.

character_event = {
id = 515( Check)

is_triggered_only = yes
trigger = { traits = wounded }

title = "EVTNAME515"
desc = "EVTDESC515"

option = {
name = "EVTOPTA515"
add_trait = prisoner <-------"Don't just stand there, after him!"
}
option = {
name = "EVTOPTB515"
<------------------Presumably titled, "I want his head on a plate!" Don't know how to kill someone via event
}
option = {
name = "EVTOPTC515"
<-----------------"He's not worth our time." He gets away? Not sure what do do...
}
 
Yep, you're definitely working in the right direction. It's good to see you're ready for some EUR modding. :)
EVTNAME515 is obviously supposed to be the title at the top, and EVTDESC515 obviously the body of the text. But where do I define them?
They refer to entries in the localisation files. Since you're creating a new event, you'll have to create a couple of new localisation entries to get it working correctly. There's an easier way, though: Just write your title and description in the event directly. If your event is called "general's life in danger", you just write title = "General's life in danger". Btw, you can make it more culture-specific by writing $GENERALTITLE$ instead of "general". Then it turns up as "polemarchos", "legatus" etc.

What are safe event ids to use?
If you want to avoid collisions with ingame events, I'd say 10 000 and above. It's a good idea to take a slightly random number, though, in order to make things easier for other modders who want to use your work (I hope you're fine with that :p ). For example, I can almost guarantee you're the first one to use ID 786490000. :D

option A would have a 50% chance of capture, 35% of escape, and 15% of accidentally killing him in pursuit. 10 Loss of ruler popularity if you fail. 15 gain if you succeed.

option b would have a would have a 60% chance of killing him, and a 40% chance of escape. 10 Loss of ruler popularity if you fail. 15 gain if you succeed.

option c would have a 100% chance of his escape, because you take the moral high ground you gain 5 popularity.
I'm sorry to disappoint you, but random effects are far from random in EUR. For some reason, the game will always pick the effect with the highest probability of happening according to the percentages. Totally sucks. :(

Also, I have a feeling you're referring to options given to the winning side. The event will trigger for the losing general. Btw, you kill characters by adding death = yes to the effects of an option.
 
Thanks for the help, I have been able to get the event to fire through the command prompt. However, I cannot get the game to take money from the national treasury. Nor can I get it to imprison my general, in fact for now the event only fires on the Leader. What changes do I need to make to get it to fire on defeat of a Wounded general? Also how do I manually add the wounded trait to a general for testing purposes?

Thanks you've been a huge help!


character_event = {
id = 4000771

is_triggered_only = yes
trigger = { traits = wounded }

title = "$GENERALTITLE$ in danger"
desc = "Your $GENERALTITLE$ is in severe danger of capture or death!"

option = {
name = "Order your $GENERALTITLE$ to lay low and make his way back home!"
treasury = -250
family_prestige = -20
loyalty = 30
}
option = {
name = "My Loyal $GENERALTITLE$ you will be a free man again! "
prisoner = yes
add_trait = maimed
family_prestige -5
loyalty = -5
}
option = {
name = "My $GENERALTITLE$ if you have any honour left, fall on your sword!"
death = yes
family_prestige = 20
}

}

EDIT: Fixed prisoner, Ruler now properly gets thrown in prison, albeit, his own prison.
 
Last edited:
It's looking good! :D
Taking money from the national treasury is done via country = { treasury = -x }. You'll have to make a new event to test this one with the wounded trait, preferably a character event with mean_time_to_happen. It should trigger for characters with in_command = yes and have one option with add_trait = wounded. When it comes to sending the character to the prison of a foreign country, I suggest using banish = yes and prisoner = yes. That would send the character to any country and imprison him. If you want the character to be sent to country you're at war with, I suppose you could make some kind of workaround with employer_country. I'll have to think about that.
 
Also, just a tip when posting events in forums: it sometimes helps to enclose your coding with code tags, like this:

Code:
character_event = {
	id = 4000771
	
	is_triggered_only = yes
	trigger = { traits = wounded }
	
	title = "$GENERALTITLE$ in danger"
	desc = "Your $GENERALTITLE$ is in severe danger of capture or death!"
	
	option = {
		name = "Order your $GENERALTITLE$ to lay low and make his way back home!"
					treasury = -250
					family_prestige = -20
					loyalty = 30
			 }
	option = {
		name = "My Loyal $GENERALTITLE$ you will be a free man again! "
		            prisoner = yes
					add_trait = maimed
					family_prestige -5
					loyalty = -5
			 }
	option = {
		name = "My $GENERALTITLE$ if you have any honour left, fall on your sword!"
					death = yes
					family_prestige = 20
			 }

}

Just makes it easier for people to read it, that's all :)

As for making your enemy imprison him, the only way I can think of is to use the move_character command and then prisoner = yes. The problem is that move_character requires a TAG/THIS/FROM/etc argument, which is near impossible to use in a simple on_actions event. You may be able to try move_character = FROM, which refers to the country which triggered the event - since the event was triggered by a battle with an enemy, it might satisfy that requirement. I have no idea, to be honest.
 
I have also being taking my first steps in a world of coding events... If someone could help me to spot, why these events aren't working

Code:
character_event = {
	id = 400772

	trigger = { in_command = yes 
		    num_of_loyal_cohorts = 1
}

	random_character = {
		limit = { in_command = yes }
}

title = "$GENERALTITLE$ has been appointed to a $GENERALTITLE$"
desc = "$GENERALTITLE$ has survived from his first few battles and is now on a journey to be a great commander."

	option = {
		name "EVTOPA 400772"			# Fighting is dangerous!
	random_character = {
	add_trait = wounded
		limit = { in_command = yes }
}
	}	


character_event = {
	id = 400773

	trigger = { num_of_loyal_cohorts = 2 }
		any_character = { 
			in_command = yes
}

title = "$GENERALTITLE$ is now a good commander."
desc = "$GENERALTITLE$ has achieved some victories in his career and has began to understand more complex tactics and strategies but it seem that the $GENERALTITLE$ in question is thinking that hes the greatest man in the nation. We should watch this developnement carefully..."

	option = {
		name = "EVTOPTA400773"			# I'am the greatest!
		ai_chance = { factor = 95 }
		change_martial = 1
		add_trait = original_thinker
		wealth = 100
		popularity = 20
		loyalty = -30
		family_prestige = 20
	}
	option = {
		name = "EVTOPTB400773"			# He is too dangerous to be let live!
		ai_chance = { factor = 5 }
		death = yes
		ruler_popularity = 15
		random_character = {
				limit = { 
					in_command = yes
	}
		ruler_add_rival =  friend_of_this
	}
}
The point in the first part is to make a modifided version of the "General in Danger"- event work (it's separate event in my computer but irrelevant time being). The point in the second is to make general to gain "veterancy" and fame with the penalty of loyalty...
(I didn't want to make own thread for this because this is more or less tied to this topic already :))
 
Code:
character_event = {
	id = 400772

	trigger = { in_command = yes 
		    num_of_loyal_cohorts = 1
}

	random_character = {
		limit = { in_command = yes }
} [color=red]#This section is sitting outside of both the triggers and the effects, why? If it's meant to be a trigger, is it meant to look for any random character in the country, or is it meant to be a further limit on the character receiving this event? Also, you don't need to add a 'limit' unless it's an effect (ie, part of an "option" section).[/color]

title = "$GENERALTITLE$ has been appointed to a $GENERALTITLE$"
desc = "$GENERALTITLE$ has survived from his first few battles and is now on a journey to be a great commander."

	option = {
		name "EVTOPA 400772" [color=red]#You need to remove the space after "EVTOPA".[/color]
	random_character = { [color=red]#random_character doesn't work unless you've already changed the scope to the country (by using "employer =" or "country ="). If you intended to make this happen to the character receiving the event, you don't need to add "random_character" since it's already a character event.[/color]
	add_trait = wounded
		limit = { in_command = yes }
}
	}	
[color=red]} #Don't forget to close off all brackets![/color]

character_event = {
	id = 400773

	trigger = { num_of_loyal_cohorts = 2 }
		any_character = { [color=red]#Again, this is sitting outside the trigger.[/color]
			in_command = yes
}

title = "$GENERALTITLE$ is now a good commander."
desc = "$GENERALTITLE$ has achieved some victories in his career and has began to understand more complex tactics and strategies but it seem that the $GENERALTITLE$ in question is thinking that hes the greatest man in the nation. We should watch this developnement carefully..." [color=red] #Careful, this description is getting quite long. The game is pretty antsy about long descriptions and titles in events.[/color]

	option = {
		name = "EVTOPTA400773"			# I'am the greatest!
		ai_chance = { factor = 95 }
		change_martial = 1
		add_trait = original_thinker
		wealth = 100
		popularity = 20
		loyalty = -30
		family_prestige = 20
	}
	option = {
		name = "EVTOPTB400773"			# He is too dangerous to be let live!
		ai_chance = { factor = 5 }
		death = yes
		ruler_popularity = 15
		random_character = {
				limit = { 
					in_command = yes
	}
		ruler_add_rival =  friend_of_this [color=red]#This is not a valid effect code, nor is "friend_of_this" a valid argument for any effect that I know of. What exactly are you trying to achieve with this?[/color]
[color=red]} #Again, close off all open brackets.[/color]
This is how I suggest you change it. I've changed some of the formatting, too, to be a bit more intuitive and thus make it easier to spot mistakes.

Code:
character_event = {
	id = 400772

	trigger = { 
		in_command = yes 
		num_of_loyal_cohorts = 1
	}

	title = "$GENERALTITLE$ has been appointed to a $GENERALTITLE$"
	desc = "$GENERALTITLE$ has survived from his first few battles and is now on a journey to be a great commander."

	option = {
		name "EVTOPA400772"			# Fighting is dangerous!
		add_trait = wounded
	}	
}

character_event = {
	id = 400773

	trigger = { 
		num_of_loyal_cohorts = 2
		in_command = yes
	}

	title = "$GENERALTITLE$ is now a good commander."
	desc = "$GENERALTITLE$ has achieved some victories in his career and has began to understand more complex tactics and strategies but it seem that the $GENERALTITLE$ in question is thinking that hes the greatest man in the nation. We should watch this developnement carefully..."

	option = {
		name = "EVTOPTA400773"			# I'am the greatest!
		ai_chance = { factor = 95 }
		change_martial = 1
		add_trait = original_thinker
		wealth = 100
		popularity = 20
		loyalty = -30
		family_prestige = 20
	}
	option = {
		name = "EVTOPTB400773"			# He is too dangerous to be let live!
		ai_chance = { factor = 5 }
		death = yes
		ruler_popularity = 15
		random_friend = {
			limit = { in_command = yes } #Not sure if you want to actually keep this
			character_event = 400774
		}
	}
}

character_event = {
	id = 400774
	
	is_triggered_only = yes
	
	title = "A friend is murdered"
	desc = "$RULERNAME$ has decided that your friend is too powerful to live. You cannot work with such a man."
	
	option = {
		name = "This is just the beginning"
		ruler = {
			add_rival = THIS
		}
	}
}
I had to add another simple event as a workaround to make the friend of the murdered general into a rival of the ruler. I'm guessing that's what you intended to do.

Hope that helps :)
 
You read my mind! I haven't had thought of limiting the rival to be a general too but it makes a lot more sense now to this "story". I'm going to test this tonight but it seems at first glance a lot better coding than it was (I wonder why:))
Thanks for helping!
And another question, is it possible to make some after battle events (it had been asked already but at least I didn't spot the answer)? I found in common folder on_actions file where are chances of getting traits like wounded etc. Is there a way to make "General in danger"- event to fire this way? Or should it be made just to fire through the wounded trait ( or some other creative way)?
 
Yes, it is quite possible to do that. In on_actions.txt, it lists the events that those actions can trigger, and the relative chances they have of firing. For example, there is the following:

Code:
in_land_battle = {
	1	= 509		#low chance that a character dies
	2	= 510		#low chance that he is wounded
	2	= 514		#low chance that a character is maimed
	10000 	= 0		#weight 10000 on nothing
}
This means that there is a total factor of 10005. There is a 1/10005 chance (per day of battle, I believe) that your character will die, 2/10005 chance that he will be wounded or 2/10005 chance that he will be maimed. If you want your event to happen during a battle, you can add it to this section like the ones above and add is_triggered_only just before your triggers to make sure it won't happen any other time.
 
I'm still trying to get this working properly.
Code:
character_event = {
	id = 4000771
	
	is_triggered_only = yes
	trigger = { 
				any_character = {
					in_command = yes
					traits = wounded
				}
				}
	
	title = "$GENERALTITLE$ in danger"
	desc = "Your $GENERALTITLE$ is in severe danger of capture or death!"
	
	option = {
		name = "Order your $GENERALTITLE$ to lay low and make his way back home!"
					country = { treasury = -250 }
					family_prestige = -20
					loyalty = 30
			 }
	option = {
		name = "My Loyal $GENERALTITLE$ you will be a free man again! "
		            prisoner = yes
					add_trait = maimed
					family_prestige -5
					loyalty = -10
			 }
	option = {
		name = "My $GENERALTITLE$ if you have any honour left, fall on your sword!"
					death = yes
					family_prestige = 20
			 }

}

I finally got the event itself to work more or less fine, the problem is getting it to fire.

Code:
#character
on_battle_lost = 
{
	#100	= 501		#10% chance to lose Victorious if you have it
	#1000 	= 0		#weight 1000 on nothing
	#100 	= 503		#gaining brave or coward
	1000 = 4000771   # My Event
}

If I'm not mistaken that should give me a 1000/1000 chance of my event firing when a battle is lost. But it still does not. Any help?
 
You should write in_command = yes traits = wounded instead of any_character = { in_command = yes traits = wounded} since it's a character event. Actually, since you're already triggering it for a commander from on_actions.txt, you shouldn't include in_command = yes at all.
 
Thank you Descartes, it now works. However I need another trigger, I need to check to see if the character is alive before the event is fired. During my first round of tests the event has shown that it will fire even if my Commander/Leader died in the battle.

How can I do this?

Code:
character_event = {
	id = 4000771
	
	is_triggered_only = yes
	trigger = { 
							
				traits = wounded
								
				}
	
	title = "$GENERALTITLE$ in danger"
	desc = "Your $GENERALTITLE$ is in severe danger of capture or death!"
	
	option = {
		name = "Order your $GENERALTITLE$ to lay low and make his way back home!"
					country = { treasury = -250 }
					family_prestige = -20
					loyalty = 30
			 }
	option = {
		name = "My Loyal $GENERALTITLE$ you will be a free man again! "
		            prisoner = yes
					add_trait = maimed
					family_prestige -5
					loyalty = -10
			 }
	option = {
		name = "My $GENERALTITLE$ if you have any honour left, fall on your sword!"
					death = yes
					family_prestige = 20
			 }

}
 
Hmm, could the event have fired before he died?
 
No it was while it was triggered by On Actions. My only guess would be that since multiple events triggered at once (New Ruler, General In Danger) perhaps the general in danger event fired before the new ruler, resulting in my leader being dead before I was able to pick an option for my event.
 
True, also no matter what option you take your leader still ends up dead if this happens, so the only logical one for anyone using this event is to take the last option as you will recieve no negative effects.