-
Re: An Intermediate Guide to Scripting
Quote:
diplomatic_stance
Availability: campaign
Usage: diplomatic_stance <faction_a> <faction_b> <allied/neutral/war>:
Set the diplomatic stance between the two factions
So the usage in a script would look like this:
Code:
console_command diplomatic_stance romans_brutii parthia neutral
console_command diplomatic_stance romans_julii parthia neutral
console_command diplomatic_stance romans_scipii parthia neutral
console_command diplomatic_stance romans_senate parthia neutral
That makes all the roman factions "Neutral" toward Parthia, whether they were are war or allied. Note that only allied, neutral and war are available - there does not appear to be a way to force protectorates (I only mention this since that's what people usually seem to be looking for).
-
Re: An Intermediate Guide to Scripting
Thanks, that was easier than I thought it was.
(BTW I'm Piko on the RTR forums, that was the only thing I wasn't able to locate in your TFT files, thanks again!)
Yet another question, can you force ownership?
-
Re: An Intermediate Guide to Scripting
Can you count how many battles the player has fought in the campaign so far?
-
Re: An Intermediate Guide to Scripting
Is this what you're looking for? It doesn't actually return a number unfortunately.
Code:
---------------------------------------------------
Identifier: BattlesFought
Trigger requirements: faction
Parameters: logic token, quantity
Sample use: BattlesFought = 6
Description: How many battles has the player fought so far during this campaign?
Battle or Strat: Either
Class: BATTLES_FOUGHT
Implemented: Yes
Author: Guy
---------------------------------------------------
-
Re: An Intermediate Guide to Scripting
What do you mean?
Does it work for IF and WHILE statements?
-
Re: An Intermediate Guide to Scripting
Nope, it has an import - the only conditions that work with if and while statements are prefixed with I_
-
Re: An Intermediate Guide to Scripting
Can you force ownership of a city? If so can I have the code please?
-
Re: An Intermediate Guide to Scripting
console_command take_settlement i think, take a look at the docudemon
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by shadowstar
Can you force ownership of a city? If so can I have the code please?
Hey Piko-
As an example, on turn #100 at the start of the Julii turn, this will give the Senate control of Antioch and then create two units of Hastati in Antioch.
Code:
monitor_event FactionTurnStart FactionType romans_julii
and I_TurnNumber = 100
console_command control romans_senate
console_command capture_settlement Antioch
console_command create_unit Antioch "roman hastati" 2
console_command control romans_julii
terminate_monitor
end_monitor
This assumes the player is playing romans_julii. If not, the code gets more complicated because you'll need some sort of variable to return control of the correct faction to the player.
-
Re: An Intermediate Guide to Scripting
Hi all!
I have a question about assassination and whether it's possible to script it?
My idea involes the assassination a faction leader that i don't know the name of i.e a spawned character, has anyone tried this?
Cheers!
-
Re: An Intermediate Guide to Scripting
To my knowledge, no one's had any luck in scripting agent missions. The kill_character command, which could be used instead, as you say needs to know the character's name.
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by Stuie
Hey Piko-
As an example, on turn #100 at the start of the Julii turn, this will give the Senate control of Antioch and then create two units of Hastati in Antioch.
Code:
monitor_event FactionTurnStart FactionType romans_julii
and I_TurnNumber = 100
console_command control romans_senate
console_command capture_settlement Antioch
console_command create_unit Antioch "roman hastati" 2
console_command control romans_julii
terminate_monitor
end_monitor
This assumes the player is playing romans_julii. If not, the code gets more complicated because you'll need some sort of variable to return control of the correct faction to the player.
Thanks, I needed this for RTR: under the eagle, hereby promoting it, please visit us at: http://forums.rometotalrealism.org/i...?showforum=157 . We're only just starting out but I'm sure this information's all going to help.
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by Epistolary Richard
To my knowledge, no one's had any luck in scripting agent missions. The kill_character command, which could be used instead, as you say needs to know the character's name.
Ah, oh well - back to the drawing board. Thank you anyway.
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by Stuie
So the usage in a script would look like this:
Code:
console_command diplomatic_stance romans_brutii parthia neutral
console_command diplomatic_stance romans_julii parthia neutral
console_command diplomatic_stance romans_scipii parthia neutral
console_command diplomatic_stance romans_senate parthia neutral
That makes all the roman factions "Neutral" toward Parthia, whether they were are war or allied. Note that only allied, neutral and war are available - there does not appear to be a way to force protectorates (I only mention this since that's what people usually seem to be looking for).
I wonder, is there a way to detect the event of one faction becoming a protectorate?
If so, there might be a way to work around the annoying alliance issue with protectorates (You can“t attack allies of your protectorate without losing the protectorate), simply by setting the relations of the protectorate to all other factions to neutral.
-
Re: An Intermediate Guide to Scripting
No, there's no way that I'm aware of to detect the existence or creation of a protectorate. :sad:
-
Re: An Intermediate Guide to Scripting
Here I have learned how to script changing a city's ownership, but now I wish to change a family_members ownership, ex. G M from romans_julii to romans_brutii. I know his name.
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by shadowstar
Here I have learned how to script changing a city's ownership, but now I wish to change a family_members ownership, ex. G M from romans_julii to romans_brutii. I know his name.
As far as I know, you will need to kill_character him from the original faction and then spawn him in the new faction. No other way to force a change of allegiance that I know of.
-
Re: An Intermediate Guide to Scripting
Well maybe trigger rebelling in BI? Is that possible? Where are these docudemon files BTW?
-
Re: An Intermediate Guide to Scripting
No, as far I know there's no change allegiance command.
The docudemon files are linked in the first post of this topic. They can be found here:
https://forums.totalwar.org/vb/showthread.php?t=54299
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by shadowstar
Well maybe trigger rebelling in BI? Is that possible? Where are these docudemon files BTW?
If you're using loyalty in BI, you could always give the character a huge negative to loyalty using a trait. I haven't messed around much with loyalty though, so I'm not so sure how predictable it is.
-
Re: An Intermediate Guide to Scripting
Thanks for the replies, it sucks you have to kill the character though, makes scripting Roman civil war MUCH harder...
-
Re: An Intermediate Guide to Scripting
Has anyone found a way to script a keystroke? For instance, making the game peform a quick save in the script by having "Ctrl-S" invoked? I know there are ways to get UI elements activatedd, but I'm specifically trying to do something that has a shortcut, but no UI element. Probably not possible but I thought I'd ask.
-
Re: An Intermediate Guide to Scripting
Shortcuts can be called using a scripting command. I made a post about it somewhere, I'll see if I can dig it up. :bow:
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by Myrddraal
here is a neat scripting command which I found whilst working on the MP campaign:
call_object_shortcut
Here is an example of the syntax:
call_object_shortcut strat_ui speedup_ai
the strat_ui bit is the category of the shortcut. If you open data\text\descr_shortcuts.txt and scroll to the bottom end, you'll find a list of the shortcuts with their categories to the right.
...
-
Re: An Intermediate Guide to Scripting
Ok - I thought I tried that and it didn't work. Guess I'll try again.
Edit: Forgot my manners! Thanks for the quick response!
Edit2: Looks like I had the wrong category for the shortcut I was trying to invoke. I'll test the new one when I get home...
-
Re: An Intermediate Guide to Scripting
Were you trying the save game one?
I use it in the mp campaign script and it works.
-
Re: An Intermediate Guide to Scripting
Quote:
Originally Posted by Myrddraal
Were you trying the save game one?
I use it in the mp campaign script and it works.
No - something else. If/when I get it to work I'll report back. ~:)
-
Re: An Intermediate Guide to Scripting
Hi to all the scripters.
I've been "fighting" against some script commands, and I've revised the old thread about commands working or not working (or not tested).
As that thread was hidden in the ancient times (last year :laugh4: ), I prefer to post here my doubts and commments, and perhaps somebody could update the list.:book:
suspend_unscripted_advice true
I thought that this command disables all the advices, except those launched in the script.
If so, then I'm doing something wrong, as I put this at the beginning of the script and I receive advices about ships, armies and so on.
I'm studying the scripts from other mods and in one case (I don't remember if it was TFT) this command was repeated in all the turns of the 4tpy script.
As I'm not using 4tpy, I need a loop to keep the script monitoring events and conditions. Thus the structure of the script is this:
Code:
script
suspend_unscripted_advice true
while I_TurnNumber < 500
here the whole script
end_while
terminate_script
Should I include the suspend_unscripted advice inside the loop? I think I did it, but the advices keep on being launched.
Should I put some repetition for this command in every turn? I'm thinking in something like this:
Code:
monitor_event FactionTurnStart FactionType carthage
and I_TurnNumber < 500
suspend_unscripted_advice true
terminate_monitor
select_ui_element
I'm trying that the scripted advices will be shown directly. For this purpose I tried this structure:
Code:
advance_advice_thread MyNewAdvice_Thread no_dismiss
select_ui_element advisor_portrait_button
simulate_mouse_click lclick_down
simulate_mouse_click lclick_up
But I must click on the portrait manually.
Is the ui_element advisor_portrait_button wrong? I think I saw it in some list of ui elements.
test_message
This is the most intriguing problem for me. I've been trying to launch different types of message, such as historic events, wonder captured, civil war... with no success.
Just in case it was a problem of the conditions or event, I tried to launch it at the start and the end of the faction turn, at the start and the end of a character turn, but no way.
And all those conditions or events were functional for other commands such as advices, creation of buildings or training of units.
If the campaign must fullfil the requirements for the event, then the command test_message is useless.
What am I doing wrong?
senate_mission
About the possible update of the list of working commands, I tried several of them related with senate missions:
Code:
senate_mission_help_player (with money or units)
senate_mission_declare_war
senate_mission_take_city
The three are working, with some limitations: only for roman factions as LocalFaction, and the mission is not authomatically assigned, only the message appears.
Cheers.
-
Re: An Intermediate Guide to Scripting
Quote:
select_ui_element
I'm trying that the scripted advices will be shown directly. For this purpose I tried this structure:
... ...
But I must click on the portrait manually.
Is the ui_element advisor_portrait_button wrong? I think I saw it in some list of ui elements.
I used this once after automatically running a show me script at the start of a campaign, I wanted to dismiss the advisor. Only problem is I can't remember if it worked or not...
-
Re: An Intermediate Guide to Scripting
I can't find this anywhere else so I'll ask here.
Say there's a building in a settlement and I want the script to open the building info scroll for that particular building (ie, the equivalent of "right-clicking" the building in the city scroll). How would I go about this? IE, assume I have the "if building X exists in settlement Y" setup correct, what command could I use to open the scroll for that particular building?