EDIT AFTERWARDS: Below is lots of irrelevant text by myself - a result of serious misunderstanding. Nothing sensitive in the monitor. I recommend that you don't spend time trying to figure out this. Instead take a look at this.
Hello guys. Now I have a really strange one, hope someone can provide an explanation and help. I'm trying to create a monitor that under certain conditions takes an enemy city (here "Roxoland"), spawns there a character "John" and gives him certain traits based on some values stored in counters B, C and D (in this example below only B is relevant) + some ancillaries. Player also gets an advisor message to inform of the event and the camera moves to show Roxoland. The script also contains a spy named "Indicatorspy" that is used to store certain data. He is not really relevant here.
I got the script working ok. When the city is taken, John appears on top of it with ancillaries 1 and 2 and traitA (these given by the first monitor) and some level of trait B (given by the second monitor). Then I cleaned the script a bit and removed unnecessary comments (here the rows regarding counter 4 and counter 10). And kaboom! the script stopped functioning correctly. Now he would get only the ancillaries and trait given by the first monitor, but trait B is completely absent! I tested multiple times and the only way I can get it back to work is to put the two commented rows back. I still have a gut feeling that it has something to do with the timing of this monitor, as these spawn army monitors seem to be somehow sensitive to errors.
Why does this happen? Does the monitor have "too many things happening" and would it need instead some wait command?
Two monitors below. The whole does not function when red rows are deleted. (Haven't tried if one of them would be enough)
Name John is not available to other factions and Trait_B levels + text file should be ok. BI 1.6 in use.Code:monitor_event FactionTurnStart FactionType romans_scipii and FactionIsLocal and I_CompareCounter counter1 = 4 and I_CompareCounter counter2 = 1 and RandomPercent < 5 advance_advice_thread PromptThreadSuccessThread 1 set_counter counter3 0 ; set_counter counter4 0 set_counter counter5 0 set_counter counter6 1 set_counter counter7 0 set_counter counter8 0 set_counter counter9 1 ; set_counter counter10 1 set_counter counter_A 1 console_command capture_settlement Roxoland spawn_army faction romans_scipii character John, named character, command 5, influence 0, management 0, subterfuge 0, age 20, , x 216, y 124 unit new superior cavalry, soldiers 10 exp 1 armour 0 weapon_lvl 0 end console_command give_ancillary John ancillary1 console_command give_ancillary John ancillary2 console_command give_trait John traitA 1 console_command kill_character "Indicatorspy" ; a spy that is used to store some game data as traits spawn_character romans_scipii Indicatorspy, spy, command 0, influence 0, management 0, subterfuge 0, age 20, , x 254, y 154 console_command give_ancillary Indicatorspy thisisindicatorspy set_counter indicator_a 1 set_counter indicator_b 1 move_strat_camera 216,124 end_monitor (Several other monitors removed between these) monitor_event FactionTurnStart FactionType romans_scipii and I_CompareCounter counter_A = 1 if I_CompareCounter counter_B = 1 console_command give_trait John Trait_B 1 end_if if I_CompareCounter counter_B = 2 console_command give_trait John Trait_B 2 end_if if I_CompareCounter counter_B = 3 console_command give_trait John Trait_B 3 end_if ... (removed a long list of similar conditions connected to counter_B, counter_C and counter_D) ... set_counter counter_A 0 end_monitor
EDITED a bit later: OK, now it gets really strange. I thought to try which of the comments is the decisive one. Removed first one and it still functioned ok. Then removed the second and in a way hoped that it would stop functioning (because then I would know the location of problem), but no no no! Now it works without the two commented rows completely fine!
I cannot be happy for this, however, since now I know that the functioning seems to be unreliable and I don't know the reason why it sometimes works and sometimes not. Any ideas?




Reply With Quote







