I'm going to need some, to keep up with you, LorDBulA, and The_Mark!
Question guys, which I feel is a little silly but here it is nonetheless: how do you test if a character has a certain trait, and what level of the trait? I tried the following and it doesn't work:
Code:monitor_event CharacterTurnStart TrueCondition if FactionType empire_west if Trait AgeTraitLevel1 = 1 ; do some stuff end_if end_if end_monitor
Last edited by SigniferOne; 02-05-2006 at 05:52.
Hmm, that's weird, I thought both "FactionType" and "Trait" were conditions, and thus not usable in monitor_event, but only in monitor_conditions, or "if" clauses?
Right, but then what could be the reason why isolating the conditions into their own "if" statements, e.g in my code above, doesn't work?
Because most conditionals require exports from an event (eg, settlement, character) - and therefore need to be included in a monitor_event. It's only conditionals that start with I_ that do not require an event which can be used in if and monitor_conditions.
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
While experimenting with scripts I noticed that some AdviceThreads in export_descr_advice.txt have a parameter. I found SettlementName and CharacterName. Not useful for me, but I guess some can use it to make their Advisor texts a little bit more detailed, showing the settlement's or character's name.
Is there a way to make the background script detect whether an AI faction has done something, and then have that trigger an event script at the start of the player's turn?
"The mere statement of fact, though it may excite our interest, is of no benefit to us, but when the knowledge of the cause is added, then the study of history becomes fruitful." -Polybios
Depends on what the AI faction has done. What AI event do you want to trigger it?
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
Which of the following events would be detectable for an AI nation?
Takes a (particular) city.
Declares war/peace with another nation.
Accumulates X amount of money.
Family member (specifically faction leader) dies.
Family member accumulates X command stars.
These should be possible.
Just open beginer screepting guide and dive in into RTW script documentation.
Beseiging a city would probably be best.Originally Posted by Epistolary Richard
"The mere statement of fact, though it may excite our interest, is of no benefit to us, but when the knowledge of the cause is added, then the study of history becomes fruitful." -Polybios
Besieging a city's tricky, you can put a conditional in for a monitor to fire if an enemy family member is within one tile of a certain location and if the two factions are at war.
Gets a bit cumbersome with large numbers of factions and cities, but it's possible.
LorDBulA does something similar with his Roma siege script, have a look at his code:
http://www.twcenter.net/forums/showthread.php?t=24968
You can use something like that to increment a counter and then have a separate monitor_event FactionTurnStart FactionIsLocal with an I_CompareCounter condition. Be sure to set the counter back to 0 though, otherwise it will keep triggering.
Last edited by Epistolary Richard; 03-05-2006 at 10:34.
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
This is a quite similar question, but I hope it can be done:
Is it possible to make an army (or naval army) besiege a city/port at game start through a script? I'm not very familiar with scrpits, so I hope someone could help me with this one.
- Tittils -
ER,
Sorry I was unclear. I meant to say "besieging a neutral city." Unless I'm missing something (certainly a possibility), I don't think those conditions would work with a city you do not own. Is there anything else I could try?
Thanks much.
"The mere statement of fact, though it may excite our interest, is of no benefit to us, but when the knowledge of the cause is added, then the study of history becomes fruitful." -Polybios
As it was said there is no easy way to check for siege.
The only way is to detect enemy army near a settlement.
You can do this for any faction holding city and any faction standing next to the city.
Proximity alert should be set to 2 titles. If you set it to 1 it wont be triggered if enemy attacks from any of city corners.
Oh ok, I guess I misunderstood. Thanks.
"The mere statement of fact, though it may excite our interest, is of no benefit to us, but when the knowledge of the cause is added, then the study of history becomes fruitful." -Polybios
I don't understand, I'm using Malrubius' code:
To do something to the character when a turn starts, but nothing happens. Here's the full code:Code:monitor_event CharacterTurnStart FactionType empire_west and Trait AgeTraitLevel1 = 1 ; do some stuff end_monitor
I start the campaign, press F1 and run the script, the Trait is added, I press Next Turn expecting some stuff to happen to the char based on that trait, but nothing happens... Help?Code:console_command give_trait "Gaius Fabricius" GoodCommander 2 campaign_wait 2 console_command add_money 1000 campaign_wait 2 monitor_event CharacterTurnStart FactionType empire_west and Trait GoodCommander = 2 ; do stuff end_monitor
PS: ER, would you like me to use the other thread referencing this one from now on?
Last edited by SigniferOne; 03-10-2006 at 05:00.
Is that the full script? Do you have 'script' at the beginning? end_script at the end? Do you have a loop so that the script is still running the next turn?
If you have all that try getting rid of the campaign_wait commands.
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
Maybe that's my problem. I was under the assumption that if a script was launched, that it will persist throughout the entire game session, including all the monitors. Is that right, or do I have to have some sort of loop to keep the script persisting through the turns?Do you have a loop so that the script is still running the next turn?
All of the action that I want to happen above is inside the monitor, which I thought will persist though turn 2, even though loaded at turn 1 (assuming the game wasn't reloaded).
Last edited by SigniferOne; 03-11-2006 at 02:56.
Have a look at the first script in the first post, there's your basic background script with a while loop. You need a while loop at the bottom otherwise the script will terminate immediately.
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
When script execution reaches end_script command you can guess what happens next :)
I think I figured out what was going wrong:
inside that event monitor I have two commands:
(the campaign waits are apparently necessary for all console_commands).Code:console_command add_money 10000 campaign_wait 2 console_command kill_character "Gaius Fabricius" campaign_wait 2
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.
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).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
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.:
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?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
Last edited by SigniferOne; 03-12-2006 at 07:04.
Okay guys, in order to narrow down the source of the problem, I have considerably cleaned up the campaign situation, gave the faction enough generals so that adoptions would not pop up, removed almost all the provinces owned so that there are would be no rebellions, etc. Now, practically no events happen on each turn, and yet the problem with kill_character still persists!
I don't want to clutter up ER's thread with this one problem, so I've started a new thread, where I explain the situation in less clumsy terms, the above complications have been removed as I just said, and I also posted screenshots of what goes on.
The thread is here: https://forums.totalwar.org/vb/showthread.php?t=62364
Last edited by SigniferOne; 03-12-2006 at 08:41.
A few more questions: the only way to browse if a character has one of a list of traits is by having a monitor event for each trait, right? i.e. there's no way to do something like right:
if Trait X = 1
do A
if Trait Y = 1
do B
Also, is there a limit for how many "and" conditions can exist for event_monitors? This sort of information seems not to be included in the Hardcoded Limits thread.
Last edited by SigniferOne; 03-12-2006 at 21:44.
I think that's because no one has ever hit it. From my understanding of CA it seems unlikely that they would have imposed a limit because they never expected people to be using big scripts. But equally there may be an extent by which a big monitor may not work right.
There's no easy way to do the trait thing - however if you want to use that in many different monitors then you may want to have a separate monitor to use the existence to set a counter. You can then use an if I_CompareCounter line within your monitors.
Epistolary Richard's modding Rules of CoolCool modders make their mods with the :mod command line switch
If they don't, then Cool mod-users use the Mod Enabler (JSGME)Cool modders use show_err
Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out
I've found problems in making the command test_message working:
https://forums.totalwar.org/vb/showp...65&postcount=8
Any of the experts in scripting could give me the tip?
Can someone supply me with a code for changing diplomacy between factions? Thanks.
Bookmarks