I took a few notes during testing a number of things to fully understand the limits of the faction_emerge command, and of shadows faction versus 'regular' factions reemerging via the campaign script.
First, let me point these great existing tutorials:
http://www.twcenter.net/forums/showthread.php?t=221709
http://www.twcenter.net/forums/showthread.php?t=554195
http://www.twcenter.net/forums/showthread.php?t=532711
http://www.twcenter.net/forums/showthread.php?t=485535
I won't reexplain the principe or the scripts since it is already done, rather summarize and clarify points that puzzled me for a while. If a moderator or the authors from the tutos above think it should be merged somehow, no problem.
And sorry if this is already cover somewhere but I am a regular visitor of the tutorials list, so I don't think so.
1, Shadows factions versus regular reemergent scripted factions:
Big editing as I was innacurate or partly wrong in some particulars, and discovered more by accidents that pushed me to further tests. More informations on some code/commands that my tests revealed first.
Descr_strat:
re_emergent: It seem of use only for shadows factions, true and false(see false shadowing at point 3), to make them reemerge either via script or automaticaly during game revolts in place of the slaves, for factions shadowing each other.
dead_until_resurrected: For a normal faction, there seem to be few if any differences than with dead_until_emerged, but for shadowing there is a big difference. dead_until_resurrected on a shadow faction will make it emerge at the first revolt of it's playable counterpart. Coupled with re_emergent, it will completely make them replace rebels for this playable faction during the entire mod.
dead_until_emerged: The faction will never reemerge on it's own the first time, it need to be scripted. If coupled with re_emergent, after their first scripted emergence, they will respawn at each revolt, each time from my tests.
Descr_sm_factions:
Shadowed_by: Here is one that remain merky to say the least. I thought for a while that it was the one connecting the shadowing part, but if I start trying to explain my many tests I will confuse myself, and you I think.
Shadowing: Let's talk concret on this, shadowing alone seem to be all that's necessary to make two factions shadowing each other. Hopefully you will get what I mean by continue the reading.
Theorically, I think that each faction can shadow every other but it would quickly turn to a circus if you see what I mean.
In brief, true shadows factions can replace the slave faction for one or more playable factions. The big setback I coudn't overcome for true shadowing is that it appear impossible to stop it and have the slave retook ownership from the playable faction in a revolt. More clearly below.
I will use direct examples as it appear more clear to me than long explanations, romani is the playable faction here:
We have two factions shadowing each other in descr_sm_factions:
Code:
faction romani, shadowed_by scotland, shadowing scotland
faction scotland, shadowing romani, shadowed_by romani
Yes, it is a completely working code but after further tests, it appear a overkill as both factions seem to shadow each other with only one shadowed_by, and the other shadowing, or strangely with both shadowing each other without shadowed_by.
You can even set severals factions to be shadowed by and shadowing each other:
Code:
faction romani, shadowed_by scotland, shadowed_by papal_states, shadowing papal_states, shadowing scotland
faction papal_states, shadowing romani, shadowed_by romani
faction scotland, shadowing romani, shadowed_by romani
I leave it for demonstration that it can work but this seem to be working the same or almost:
Code:
faction romani
faction papal_states, shadowing romani
faction scotland, shadowing romani
Here, papal_states and scotland are dead at the campaign start, and they will never emerge the first time on their own with dead_until_emerged. Until they emerge via script once, slave will continue to shadow the romani.
From there we have two possibilities:
1, set the emergent shadows factions as re_emergent in descr_strat:
faction papal_states, balanced stalin
Code:
ai_label default
dead_until_emerged
re_emergent
denari 50000
denari_kings_purse 800
faction scotland, balanced smith
ai_label default
dead_until_emerged
re_emergent
denari 7500
denari_kings_purse 650
After their first scripted emergence, they will constantly reappear without help even after being destroyed, each time a romani settlement revolt, effectivly replacing the slave, no matter of who is the faction creator.
2, remove the re_emergent line and they will only shadow the romani when they are on map, they won't resurect on their own.
For the way I would like to use it, the second possibibility would be the best because it can be controled, while the first option is unstoppable at each settlement revolt. But I can't make it happen until what escapes me in 'normal' reemergence scripts reveal itself.
Before moving on, allow me a interesting and so far unexplained side effect:
Shadows factions are NOT re_emergent in the descr_strat, and romani own Agrigentum, settlement faction_creator is milan/greek cities. milan is a normal faction, not shadow and not re_emergent in descr_strat.
If shadows factions are on map, one get Agrigentum in revolt, as it should. If they are NOT on map, milan get the ownership of the settlement. I find it very unexplainable, and actually convenient as I think it has a logic.
Setback: It doesn't seem to work for every factions and cities, but I saw a few cases of it with others factions and settlements which have their respective faction_creator. And it never work for dead factions, only the ones on map. And it always make the original owner in war stance.
I didn't try to isolate which factions are affected by this strange side effect and vice versa since I can't understand it at all, but if faction original creators of settlement are distributed right, it can be interesting to dig in on this.
A input would be appreciated if someone else has encountered it.
Edited: I removed the shadow factions code from descr_sm_factions to test and the phenomenon above has continued on the same frequency. Therefore it is not directly related to shadows factions, even if the same messages of loyalists revolt appear in both cases. More investigating need to be done but this is apparently not within the subject here.
2, 'Gifting' regions
In Withnar tutorial, vsivak pointed that the all 'hidden faction' part is unnecessary to transfer region from one faction to a other. And he is right.
http://www.twcenter.net/forums/showt...1#post15206062
Code:
monitor_event FactionTurnEnd FactionType aksum
and I_NumberOfSettlements milan > 0
and I_NumberOfSettlements aksum > 2
campaign_wait 0.1
faction_emerge milan aksum 1 500.0 0.0 1.2 town false
campaign_wait 0.1
end_monitor
This simple example work fine and at each time it is fired. Severals tests for differents scripts confirmed it. It work between two normals factions, and from a shadow faction to a normal, and vice versa.
To target a specific settlement, you still need the console_command building chain of PO bonus/malus of course.
Code:
declare_counter egypt_rivalis
monitor_event FactionTurnEnd FactionType egypt
and I_CompareCounter roman_history_player > 0
and I_CompareCounter opposing_party_imp < 1
and I_CompareCounter opposing_party_rep < 1
and I_CompareCounter senate_civil_war_counter < 1
and I_CompareCounter refused_cleopatra > 0
and I_CompareCounter egypt_rivalis < 1
and I_NumberOfSettlements egypt > 6
if I_SettlementOwner Aleksandreia = egypt
and not I_SettlementUnderSiege Aleksandreia
and I_NumberOfSettlements scotland < 1
console_command create_building Adiacium ros_po_bonus
console_command create_building Agrigentum ros_po_bonus
console_command create_building Aleksandreia ros_po_bonus
;;;ect, ect
console_command create_building Aleksandreia ros_target
campaign_wait 0.1
faction_emerge scotland egypt 1 500.0 0.0 1.2 town false
campaign_wait 0.1
end_if
;;;; ect, ect and cleaning...
Added 3, the use of shadowing without any real shadowing.
Important edit here, I invite you to re-read if you have before 12/23. In short, you don't need a hidden faction to make the 'false' shadowing and re-emergence work.
Let's put some context here, I have no plans for normal factions to reemerge in the immediate future, but I made a few simple attempts just in case.
And the scripts on their own just didn't work for normal factions. Then I realized it didn't either for shadow factions after they have been destroyed once, unless I make them re_emergent in descr_strat, which don't suit my plans. It can't be a faulty script in cause because they always work... Unless the faction has already been destroyed during the game. Example:
Code:
monitor_event FactionTurnEnd FactionType aksum
and I_NumberOfSettlements milan > 0
and I_NumberOfSettlements aksum > 2
and I_SettlementOwner Massilia = aksum
;;and I_TurnNumber > 0
add_settlement_turmoil Massilia 1
console_command create_building Adiacium ros_po_bonus
console_command create_building Agrigentum ros_po_bonus
console_command create_building Aleksandreia ros_po_bonus
ect, ect
This test script 'gift' massilia from a greek polis to the achean ligue when those are on map. And it works with no problem each time I try it.
Now, the very same script except that the greek have been destroyed/off map.
Code:
monitor_event FactionTurnEnd FactionType aksum
and I_NumberOfSettlements milan < 1
and I_NumberOfSettlements aksum > 2
and I_SettlementOwner Massilia = aksum
;;and I_TurnNumber > 0
add_settlement_turmoil Massilia 1
console_command create_building Adiacium ros_po_bonus
console_command create_building Agrigentum ros_po_bonus
console_command create_building Aleksandreia ros_po_bonus
ect, ect
And it never work, even with spawned armies near the settlement, until I make milan a 'false' shadowing. I hope you have read well above about what I gathered from the shadowed_by, shadowing, re_emergent and dead_until_emerged code to get my point.
Edit 12/23, that's the important editing.
I once wrote here that a hidden faction was needed. I was wrong. In fact, one thing that I confused in all my tests is that the hidden faction being dead, a scripted emergence will only work ONCE for the faction falsy shadowing it. Let's not panic however because I just noticed it and found a solution illico presto.
As you will see right below, rather than shadowing a hidden faction, we are gonna shadow the slave faction, which is completely safe and allow the re-emergence with the same conditions than before.
Sorry about the mix-up, it's a honnest mistake I made presuming that since a illimited number of scripted re-emergence was working with my factions shadowing the romani, it would be the same with a hidden faction.
Let me re-say that a hidden faction is still never lost for unique names and more 'out of the box' concepts, you never know when it might be handy so I prefer keeping one myself. See added 4.
Back to the milan example. the slave slot is therefore the false shadow target.
In descr_sm_faction, find the milan entry and set it like that:
Code:
faction milan, shadowing slave
That's it, no shadowed_by anywhere, and leave slave as it is.
And every other faction can 'shadowing' slave safely then, there will never be any ownership switching that you didn't script, nor convert to the cause or other typical shadow factions effects.
Now, that's still won't work, because I presume that the problem is that once a normal/false shadow faction is destroyed, somehow the script refuse to bring it back.
And that is where the re_emergent in descr_strat can have a use. Put it to milan, and there, that's it. Even simpler than before.
Code:
faction milan, balanced smith
ai_label default
re_emergent
denari 5000
denari_kings_purse 500
now the reemergence script will work every time, without never any real shadowing between any factions, because the special slave faction never riots or rebel on itself.
So any faction shadowing it can not take it's region without scripting, and the slave being the mother shadow of all factions anyway, nothing has changed except that you have it a lot easier with re-emergence scripting.
That's beautiful no?
Somehow, I can imagine that if you are reading, you must think smartly, "well, what about just putting a normal faction as re_emergent without false shadowing?"
Well, no. Of course I tried, several times, and it doesn't make the script bring back milan, beside it woudn't be a solution since I want no re_emergent for eventuals true shadows factions.
Setback that isn't really one: Any faction with and without a shadowing, will see the messages of 'revolt suppressed', 'revolt or worse', left by CA and mostly not fitting. It's simply a matter of changing those externals text.
Well that should be all this time. Still interested if someone want to explain me the last 'secret' about normal reemergence, but it's not the end of the world, false shadowing make the scripts a little easier as there is no need for extra army spawns if you don't want some, and make the all scripting a lot more safer.
Edit, I took out the fourth part as the other uses of a hidden faction doesn't require any special knowledge or precautions that Wihwnar didn't already explained now.