I think I figured out what was going wrong:
inside that event monitor I have two commands:
Code:
console_command add_money 10000
campaign_wait 2
console_command kill_character "Gaius Fabricius"
campaign_wait 2
(the campaign waits are apparently necessary for all console_commands).
Ok so here's what happens: apparently, under some conditions, the kill_character command does-not-work, and the script processing engine seems to stop processing. What's been happening in my script, and why I was prompted to post in this thread, was that I've been developing a background script for the Paeninsula Italica mod; I tried inserting just one command that had to be in my script -- kill_character -- and it would not work (hence my posts). I started this script every time I started a new campaign in our beta campaign map, so obviously we have a lot of things unbalanced yet, and a lot of provinces (over 50) rebel on the next turn. Also, the Adoption thing springs into action, since there are like 3 generals for the entire faction.
SO -- to make a long story short -- when I start the campaign and run my script, after pressing next turn, all this massive avalanche of events starts to happen on the next turn, and the kill_character event does not work. It is in the monitor correctly, and the monitor is triggered correctly, but the command simply doesn't work! How do I know the monitor is triggered correctly? Because I placed the give money command before it, which never fails to work. And what's even more, I placed a second give money command after it, e.g.
Code:
console_command add_money 10000
campaign_wait 2
console_command kill_character "Gaius Fabricius"
campaign_wait 2
console_command add_money 10000
campaign_wait 2
And the execution never reaches the second money command, and no money is added after the first. This is a very weird problem. Here's what's even weirder: sometimes, if I keep pressing Next Turn, the event_monitor is still apparently running in the background, sometimes will make the kill_character command work. So sometimes, a few turns in, the character does get killed (although the money command works always, at least the first one).
It seems that the script engine somehow gets "stuck" on the kill_character command, and simply does not proceed executing any further. I thought that maybe it's from all the events happening so fast, and tried to somehow pause the game, or at least pause all the events and UI things happening, until my script monitor runs and finishes its stuff. Thus, I tried everything imaginable, e.g.:
Code:
monitor_event FactionTurnStart FactionIsLocal
declare_show_me
hide_ui
suspend_unscripted_advice true
disable_entire_ui
console_command add_money 10000
campaign_wait 5
console_command kill_character "Gaius Fabricius"
campaign_wait 5
console_command add_money 10000
campaign_wait 5
enable_entire_ui
suspend_unscripted_advice false
show_ui
end_monitor
all the things that I guessed could suspend the proper flow of the game until my poor script has finished. None of these things work. One of the funny things is, I just added the "hide_ui" thing, to try and hide the events until my script finishes, and -- the UI gets hidden, the "adoption" event pops up anyway (due to the conditions in my campaign), and when I dismiss it, the UI continues to remain hidden. The script simply does not proceed further, beyond the kill_character command, the UI remains hidden even though the script says to unhide it. It just gets stuck. And I know that the kill_character command works always when in direct script mode (i.e. without the monitors), and it sometimes works even in the monitors, seemingly when there aren't that many events popping up. So that's what's been going on with my script :-) Anyone else have something similar?
Bookmarks