To create a script more things in more than one files are needed than just the trigger, so could you please post here which file(s) you edited and what exactly you did, so that people can better help you?
I've edit the export_descr_advice
The text folder export_advice(for {BackgroundScriptTitle1}Background Script {BackgroundScriptText1}Script started).
descr_strat(to add the years, and the the line ;script
;campaign_script.txt at the bottom.)
made the campaign_script.txt.
And finally made a background_script.txt( which contain 4TPY from SQPR mod.).
.
♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do ♪
♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do ♪
Sorry, should have explained better. I meant like this:
etc, not the names of the files, or your text. The actual in-game code near the sections of the file that you edited.Code:; >>>> start of regions section <<<< [...] blablabla - code [...] script campaign_script.txt
Ok.
export_descr_advice
Code:;------------------------------------------ ;AdviceThread BackgroundScriptThread ; GameArea Campaign ; ; Item BackgroundScriptItem1 ; Uninhibitable ; Verbosity 0 ; Threshold 1 ; MaxRepeats 0 ; RepeatInterval 1 ; Attitude Normal ; Presentation Default ; Title BackgroundScriptTitle1 ; On_display scripts\show_me\background_script.txt ; Text BackgroundScriptText1export_adviceCode:Trigger background_script_trigger_1 WhenToTest ButtonPressed Condition ButtonPressed faction_button AdviceThread BackgroundScriptThread 1 ;------------------------------------------ Trigger background_script_trigger_2 WhenToTest ButtonPressed Condition ButtonPressed construction_button AdviceThread BackgroundScriptThread 1 ;------------------------------------------ Trigger background_script_trigger_3 WhenToTest ButtonPressed Condition ButtonPressed recruitment_button AdviceThread BackgroundScriptThread 1 ;------------------------------------------ Trigger background_script_trigger_4 WhenToTest SettlementSelected
descr_stratCode:¬*********************************************************** ¬* * ¬* CAMPAIGN ADVICE * ¬* * ¬*********************************************************** ¬------------------- {BackgroundScriptTitle1}Background Script {BackgroundScriptText1}Script started.
campaign_script.txtCode:; >>>> start of regions section <<<< ;script ;campaign_script.txt start_date -215 summer end_date 260 summer
background_script.txtCode:script wait 1 advance_advice_thread BackgroundScriptThread wait 1 select_ui_element advisor_portrait_button simulate_mouse_click lclick_up end_script
Code:script console_command date -215 console_command season summer while I_TurnNumber = 0 end_while console_command date -215 console_command season summer while I_TurnNumber = 1 end_while console_command date -215 console_command season summer while I_TurnNumber = 2 end_while console_command date -215 console_command season winter while I_TurnNumber = 3 end_while console_command date -214 console_command season summer while I_TurnNumber = 4 end_while console_command date -214 console_command season summer while I_TurnNumber = 5 end_while console_command date -214 console_command season summer while I_TurnNumber = 6 end_while console_command date -214 console_command season winter while I_TurnNumber = 7 end_while console_command date -213 console_command season summer while I_TurnNumber = 8 end_while etc etc etc.It go on for long time At the end: console_command date 260 console_command season summer while I_TurnNumber = 1900 end_while end_script
♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do ♪
Need help trying to work a script that will deleat 1 unit and then create a new 1
This will hopefully work for upgrading units with better weapons acuracy anything ie RTW once hastati get 3 ceverons they could be replaced by princieps or ETW once a unit reaches a certain level it could be replaced with a simular unit with longer range and better acuracy.
i thought something like this may work
script
declare_counter loop
set_counter loop 0
monitor_event FactionTurnStart FactionIsLocal
and Rome "roman hastati" 1 exp3
console_command strat_disband_unit Rome "roman hastati" 1 exp 3
console_command create_unit Rome "roman princeps" 1
end_monitor
while I_CompareCounter loop = 0
end_while
the unit to be deleated would probably have to be in a city or outside on its own to get the named charactor for the captain and then Kill_charactor could be used?
Mayby disband_unit_button could work.
the recruting seems straight forward but deleation is hard.
Any sugestions/help welcome thx
Last edited by FB_Bob; March 22, 2010 at 01:15 PM.
There is no way to disband a unit in RTW/BI, short of killing it off during battle.
@EvilNelson666:
The 2 lines that are supposed to fire up the campaign script are commented out in descr_strat.txt. Uncomment them by removing the semicolons at the beginning of the lines, and move them to the very end of the file.
Last edited by HouseOfHam; March 22, 2010 at 04:01 PM.
RTR website/SVN admin
- Settlement coordinate locator -for RTW/M2TW
- EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
- RTW scripting tutorials
- n-turns per year script generator
i was thinking that if a unit was in a city it could be scripted someway to check the city for units via army selection or similar, then maybe set_cards_selectable true/false to find the unit your after and disband_unit_button, may need simulate_mouse_click, this mite work.
What do you think?
thx for replie
I've tried it before, but could never get it to work. Maybe you'll have better luck (but I wouldn't bet on it). Also, AI factions don't use the UI.
RTR website/SVN admin
- Settlement coordinate locator -for RTW/M2TW
- EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
- RTW scripting tutorials
- n-turns per year script generator
what about sometyhing like
script
declare_counter loop
set_counter loop 0
monitor_event FactionTurnStart FactionIsLocal
console_command select_settlement Rome
console_command set_cards_selectable
console_command call_object_shortcut army_overview_button
console_command simulate_mouse_click
console_command UnitType "roman hastati" 1 exp 3
console_command simulate_mouse_click
console_command disband_unit_button
console_command simulate_mouse_click
console_command create_unit Rome "roman princeps" 1
end_monitor
while I_CompareCounter loop = 0
end_while
what do you think? any sugestions that could helpthx in advance
- Only commands listed in console_command.txt need to be prefixed with console_command
- I would suggest narrowing down the monitor to Rome and checking the owner before you try to do anything there
- For the call_object_shortcut command, you may need to add strat_ui before the button name
- Not sure if you need the mouse click commands if you use call_object_shortcut. In any case, the proper syntax is simulate_mouse_click lclick_down|lclick_up
- Not sure how to select a specific unit (not the way you tried)
Code:script declare_counter loop set_counter loop 0 monitor_event SettlementTurnStart SettlementName Rome and SettlementIsLocal e_select_settlement set_cards_selectable true call_object_shortcut army_overview_button ; select unit to disband call_object_shortcut disband_unit_button console_command create_unit Rome "roman princeps" 1 end_monitor while I_CompareCounter loop = 0 end_while end_script
Last edited by HouseOfHam; March 23, 2010 at 10:58 AM.
RTR website/SVN admin
- Settlement coordinate locator -for RTW/M2TW
- EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
- RTW scripting tutorials
- n-turns per year script generator
Theres Unit_info_scroll or hud_show_units_tab
or maybe if the unit was at a pos on map it could be pointed at with cursor and then clicked on
or maybe it could be done via a keyboard macro
For disbanding ui_flash_start disband_unit_button could help
thx for taking a look HoH
Last edited by FB_Bob; April 10, 2010 at 02:50 AM.
Hello Can someone help me, because my script does not seem to work
if everything is okay?
Spoiler Alert, click show to read:
Creator of modification The Great Ancient World IV
Team-leader of Polish Project translation modifications:
Kingdoms Grand Campaign Mod 4.2 (v1.0)
Third Age: Total War 2.0/2.1 (v1.01)
Third Age: Total War 1.4/1.4.1 (v1.0)
Broken Crescent 2.02 (v0.95)
Stainless Steel 6.2 RC4 (v0.60)
INVASIO BARBARORVM 2:AFRICA VANDALORVM v1.2 (v0.7)
Last edited by Tiberius Caesar Augustus; March 28, 2010 at 07:00 AM.
Creator of modification The Great Ancient World IV
Team-leader of Polish Project translation modifications:
Kingdoms Grand Campaign Mod 4.2 (v1.0)
Third Age: Total War 2.0/2.1 (v1.01)
Third Age: Total War 1.4/1.4.1 (v1.0)
Broken Crescent 2.02 (v0.95)
Stainless Steel 6.2 RC4 (v0.60)
INVASIO BARBARORVM 2:AFRICA VANDALORVM v1.2 (v0.7)
They are but only once or perhaps only one faction because you didn't include the following at the very of the script.
Code:while I_TurnNumber < 99999 suspend_unscripted_advice true end_while
Under the patronage of Roman_Man#3, Patron of Ishan
Click for my tools and tutorials
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein
Thanks now it's works![]()
Creator of modification The Great Ancient World IV
Team-leader of Polish Project translation modifications:
Kingdoms Grand Campaign Mod 4.2 (v1.0)
Third Age: Total War 2.0/2.1 (v1.01)
Third Age: Total War 1.4/1.4.1 (v1.0)
Broken Crescent 2.02 (v0.95)
Stainless Steel 6.2 RC4 (v0.60)
INVASIO BARBARORVM 2:AFRICA VANDALORVM v1.2 (v0.7)
Hi guys!
Sorry if you consider this a dig but this thread seems to be the most comprehensive coverage of the background script execution problematic.
Therefore I wanna share my own finds here - even though it's been years since anyone worried about this.
GAMERELOADED EVENT
Indeed Bardo's final method is probably as far as we get towards automatic execution of background scripts.
But I've done some aditional testing and discovered a little bit more. First, an explanation of why the trigger on GameReloaded event works the way it does. Bardo explains on the ORG:
My testing shows the following and I'm confident this is the real way things work:Originally Posted by Bardo
- AdviceThread Lotr_Script_Thread 1 - there's no confusion here it adds 1 to the counter and opens the advise up, if Threshold is reached
- AdviceThread Lotr_Script_Thread 0 - This resets the counter first to 0 and then increases by 1.
Now the GameReloaded event. Many people suspect it doesn't work, Bardo claims it does, since his method works (and it really does). Well, both camps are right.
Mys testing shows this trigger gets fired, no doubt about it:
it does effect the counter towards the Threshold. But the Advisor never shows up and my guess here is that the moment this trigger gets fired the engine doesn't have the UI ready yet to show the advisor.Code:;------------------------------------------ LOTR-TW trigger Trigger Reload_Script_Trigger WhenToTest GameReloaded AdviceThread Lotr_Script_Thread 0
These finds brought me to an idea. Bardo uses the GameReloaded event in the background script to terminate the script when a game is reloaded (again, this really works):
Well, how about this?Code:monitor_event GameReloaded TrueCondition terminate_script end_monitor
it doesn't work - hopefully yetCode:declare_counter C_GameReloaded monitor_event GameReloaded TrueCondition set_counter C_GameReloaded 1 end_monitor monitor_conditions I_CompareCounter C_GameReloaded = 1 wait 5 console_command trigger_advice Lotr_Script_Thread advance_advice_thread Lotr_Script_Thread no_dismiss set_counter C_GameReloaded 0 terminate_script end_monitor. The logic would seem right but I'm really new to RTW scripting so I might be missing some obvious flaw in this concept...
I'll certainly keep on testing this
ADDITIONAL SMALL FINDS
When you reload a game, occasionally, showing the advisor with the current season and date(advance_advice_thread Season_Year_TurnXX_Thread), it shows only the Startup advisor (Lotr_Script_Thread). Yet, the script is started - when you end the turn, you get the season and year when your turn begins.
Using "suspend_unscripted_advice true" at the start of the script does seem to prevent that.
Next, the following in Bardo's script somehow messed things up:
I have removed it and experienced no problems at all.Code:wait 1 select_ui_element advisor_dismiss_button simulate_mouse_click lclick_up
So this is my version of the background script:
Hope this helps and we're not done yet with thisCode:script suspend_unscripted_advice true declare_show_me ....
Last edited by Greno Zee; December 15, 2010 at 06:06 AM.
Hey, I'm glad people still continues reasearching on this. I feel we still need a complete guide about the advice file, but after many test, all I got was some theories about how it works, nothing really confirmed.
Good point about this:
Your explanation seems to confirm my experiments with threshold=1. But then, if threshold is 2, this advice is never launched?Code:AdviceThread Lotr_Script_Thread 0 - This resets the counter first to 0 and then increases by 1.
This code is not needed, it simply closes the advisor when the script is executed:
About the line:Code:wait 1 select_ui_element advisor_dismiss_button simulate_mouse_click lclick_up
I do not use it because our mod launches unscripted advices and that line would avoid them.Code:suspend_unscripted_advice true
In fact, all my reaserch about launching scripts was focused to avoid the use of that command suspend_unscripted_advice. Many scripters seems to use HouseOfHam method, that is simpler and gets similar results. But there is one little advantage of my method, that it is very important to me:
- When you are playing a campaign with scripts activated, and you reload a savegame, the script is reactivated automatically.
(It is not completely automatic because: If you load a savegame when you just entered the game, you need to press on advisor portrait, the same with both methods).
About this...
I'd say it is exactly the same than this:Code:declare_counter C_GameReloaded monitor_event GameReloaded TrueCondition set_counter C_GameReloaded 1 end_monitor monitor_conditions I_CompareCounter C_GameReloaded = 1 wait 5 console_command trigger_advice Lotr_Script_Thread advance_advice_thread Lotr_Script_Thread no_dismiss set_counter C_GameReloaded 0 terminate_script end_monitor
I tested something similar, with different waiting times, and I had no luck.Code:monitor_event GameReloaded TrueCondition wait 5 console_command trigger_advice Lotr_Script_Thread advance_advice_thread Lotr_Script_Thread no_dismiss terminate_script end_monitor
As you say, I'm sure GameReloaded does work, but I have been unable to use it directly to launch the advices.
I wish you more luck.
Last edited by Bardo; December 15, 2010 at 12:25 PM.