There is a way to cheat a peace command, but it only works in certain situations, and it might be that this will work for you. It also means that you don't have to worry about changing the ai mid stream.
The trick is to use the inheritance command in an initial event. This, obviously, ends the war between two nations. Then have it trigger a second event that gives that just-inherited nation independence. This then triggers a third event - that includes the breakvassal command. It can also include secede-province commands, to simulate the exchange of territory.
The big challenge is in being prepared to code up enough versions of it to encompass all of the variable conditions and results you want. Let's have a pretend example of two nationa ABC and DEF who are at war. ABC owns provinces 100, 200 and 300 while DEF owns 400, 500 and 600 and you want to be able to simulate a peace command for some historical reason that is unimportant here. Both have ferocity = yes.
Code:
event = {
id = 100001
random = no
country = ABC
trigger = {
war = { country = ABC country = DEF }
OR = {
AND = {
owned = { province = 400 data = DEF } #their capital province
control = { province = 400 data = ABC }
}
AND = {
owned = { province = 500 data = DEF } #the other two
control = { province = 500 data = ABC }
owned = { province = 600 data = DEF }
control = { province = 600 data = ABC }
}
}
control = { province = 100 data = ABC } # ABC control's all its own
control = { province = 200 data = ABC }
control = { province = 300 data = ABC }
}
name = "The Peace of Snagglepuss"
desc = "Niggledy, biggledy blah, blah BOO!"
date = { year = 1452 }
offset = 100
deathdate = { year = 1467 }
action_a = {
name = "Excellent!"
command = { type = inherit which = DEF }
command = { type = trigger which = 100002 }
}
}
event = {
id = 100002
random = no
country = ABC
name = "Administrative event"
desc = "We wouldn't need to do this if Johan gave us a peace command"
action_a = {
name = "Not that he isn't awesome already"
command = { type = independence which = DEF }
command = { type = trigger which = 100003 }
}
}
event = {
id = 100003
random = no
country = DEF
name = "AI_Event"
desc = "So it goes"
action_a = {
name = "OK"
command = { type = breakvassal which = ABC }
command = { type = relation which = ABC value = -200 }
command = { type = secede province which = ABC value = 500 }
}
}
OK, so that's the simple shape of it. Some of the things that you need to be wary of are:
1. There can be a lot of variation in province ownership at the time the war begins, unless is starts really close to the beginning of the scenario. You'll need to account for that or it could be either abused or frustrating for players.
2. The independence command looks at the revolt.txt file for what to give the nation. It gets everything in the 'minimum' entry. Now, this could really cause problems if this was a civil war, for example, or any situation where the two nations share provinces in their 'minimum' entries. However, one thing most modders don't realise is that you can have multiple entries for each nation in the revolt.txt, just so long as their active dates don't overlap. Let's say that province 300 is one that both ABC and DEF would normally have had as an 'accepted' core of their nation. Well, that would have meant that, once ABC gave independence to DEF then it would have departed with provinces 300, 400, 500 and 600. Yes, you could have included another secedeprovince commond for province 300, but it would have returned sans bailiff, courthouse etc, much to the victorious player's annoyance. It would also have wiped out any provincerevolt conditions placed on their by some other event. So, instead, you could have had a distinct entry for DEF in the revolt.txt file for just the period 1452 to 1467 which defined its minimums as excluding province 300.
So, yes, there are ways around a lot of the trigger and command shortfalls, but it can mean having to be really careful and potentially write many different iterations of these events to cover all the possibilities.
Good luck.
MattyG