PDA

View Full Version : Research: Parameters for commands & console commands



Epistolary Richard
04-27-2005, 17:48
This thread is intended to try and collate all available information as to scripting commands and console commands.

The next two posts will be an maintained index of commands and console commands respectively, each will be divided into three sections
1) Commands we know are working
2) Commands that have been tested and we believe are not working as documented
3) Commands that have not been tested yet

If there are any commands either in 2) or in 3) that you know are working please post and say so, giving the parameters to use or a sample.

For console commands can you also say if they can be used on the battle map, the strategic map or both.

Many thanks.

Epistolary Richard
04-27-2005, 17:49
Script commands
All taken from docudemon_commands.txt (https://forums.totalwar.org/vb/showthread.php?t=43121) - see link for description of effects

1) Commands we know are working
Reason - Included in the vanilla game

declare_prologue Sample use: declare_prologue
terminate_prologue Sample use: terminate_prologue
move Sample use: move Gaius Julius, 20, 44
replenish_action_points Sample use: replenish_action_points Gaius Julius
replenish_units Sample use: replenish_units Gaius Julius
script Sample use: script
terminate_script Sample use: terminate_script
spawn_battle Sample use: spawn_battle custom/punic_1
if Sample use: if TimerElapsed < 1000
while Sample use: while TimerElapsed < 1000
monitor_conditions Sample use: monitor_conditions not I_CharacterIsSelected Gaius Julius
monitor_event Sample use: monitor_event IncomingMessage IncomingMessageType wonder_captured
terminate_monitor Sample use: terminate_monitor
console_command Sample use: console_command kill_character "Gaius Julius"
declare_counter Sample use: declare_counter blib
inc_counter Sample use: inc_counter blib -137
set_counter Sample use: set_counter blib -137
prepare_for_battle Sample use: prepare_for_battle
declare_show_me Sample use: declare_show_me
campaign_wait Sample use: campaign_wait 1.3
suspend_during_battle Sample use: suspend_during_battle on
set_music_state Sample use: set_music_state mobilize
point_at_character Sample use: point_at_character Gaius Julius
point_at_settlement Sample use: point_at_settlement Roma
point_at_strat_position Sample use: point_at_strat_position 44, 55
point_at_message Sample use: point_at_message 0
ui_flash_start Sample use: ui_flash_start finances_button
ui_flash_stop Sample use: ui_flash_stop
character_flash_start Sample use: character_flash_start Gaius Julius
character_flash_stop Sample use: character_flash_stop Gaius Julius
point_at_location Sample use: point_at_location pos1
point_at_unit_pos Sample use: point_at_unit_pos generals_unit
remove_battle_map_arrow Sample use: remove_battle_map_arrow
point_at_unit_card Sample use: point_at_card roman_archers
hide_ui Sample use: hide_ui
show_ui Sample use: show_ui
disable_ui Sample use: disable_ui finances_button
enable_ui Sample use: enable_ui finances_button
disable_entire_ui Sample use: disable_entire_ui
enable_entire_ui Sample use: enable_entire_ui
set_cards_selectable Sample use: set_cards_selectable false
disable_cursor Sample use: disable_cursor
enable_cursor Sample use: enable_cursor
reveal_tile Sample use: reveal_tile 25, 43
advance_advice_thread Sample use: advance_advice_thread 0098_prologue_selection no_dismiss
dismiss_advice Sample use: dismiss_advice
suspend_unscripted_advice Sample use: suspend_unscripted_advice true
disable_shortcuts Sample use: disable_shortcuts true - to disable, disable_shortcuts false - to enable them again
filter_unit_commands Sample use: filter_unit_commands on velites_alpha change_formation
filter_unit_group_commands Sample use: filter_unit_group_commands on storm_troopers change_formation
filter_unit_selection_commands Sample use: filter_unit_selection_commands on change_formation
filter_all_ui_commands Sample use: filter_all_ui_commands on
steal_esc_key Sample use:
ai_active_set Sample use: ai_active_set off
release_unit Sample use: release_unit
hiding_enabled_set Sample use: hiding_enabled_set false
pause_battle Sample use: pause_battle
unit_immediate_place Sample use: unit_immediate_place archers1 big_hill 0
unit_order_move Sample use: unit_order_move cohort1 100 60 run
unit_order_attack_unit Sample use: unit_order_attack_unit cavalry1 enemy4 run
unit_order_attack_closest_unit Sample use: unit_order_attack_closest_unit 15 run
unit_order_move_to_missile_range Sample use: unit_order_move_to_missile_range roman_archers barb_swordsmen run
unit_set_morale Sample use: unit_set_morale carthaginian_peasants wavering
unit_set_skirmish_mode Sample use: unit_set_skirmish_mode velites1 off
unit_group_unset_morale Sample use: unit_group_unset_morale infantry_group
move_strat_camera Sample use: move_camera 20,35
snap_strat_camera Sample use: snap_strat_camera 20,35
zoom_strat_camera Sample use: zoom_camera 0.4
camera_restrictions_set Sample use: camera_restrictions_set on
camera_default_mode_set Sample use: camera_default_mode_set tw
battle_default_camera Sample use: battle_default_camera
set_camera_bookmark Sample use: set_camera_bookmark 1, 100, 0, 100, 100, 0, 0 - Will set the camera bookmark to position (100,0,100), looking straight back along the z axis
camera_position_at_bookmark Sample use: camera_position_at_bookmark 0
camera_zoom_to_bookmark Sample use: camera_zoom_to_bookmark 0 50
camera_position Sample use: camera_position 0 0 0 0 0 -1
camera_zoom_to Sample use: camera_zoom_to 0 0 0 0 0 -1 50
camera_look_at_unit Sample use: camera_look_at_unit spearmen7
camera_track_unit Sample use: camera_track_unit roman_cavalry1 left 20 10 -15
camera_zoom_to_unit Sample use: camera_zoom_to_unit spearmen7
label_unit Sample use: label_unit 0 2 4 julii_hastati_2
label_location Sample use: label_location 35 58 the_big_hill
define_unit_group Sample use: define_unit_group group1 archers1 archers2 archers3 spearmen1
declare_timer Sample use: declare_timer rout_timer
restart_timer Sample use: restart_timer
battle_wait Sample use: battle_wait 1.3
play_sound_event Sample use: play_sound_event PREBATTLE_TEST
stop_sound_event Sample use: stop_sound_event PREBATTLE_TEST
unit_order_change_formation Sample use: unit_order_change_formation legionary_cohort testudo
unit_group_order_relative_move_formed Sample use: unit_group_order_relative_move_formed group6 100 -60 run
inhibit_camera_input Sample use: inhibit_camera_input true
undefine_unit_group Sample use: undefine_unit_group archer_group5

Reason - Tested

settlement_flash_start Sample use: settlement_flash_start Tarquinii
settlement_flash_stop Sample use: settlement_flash_stop Tarquinii
simulate_mouse_click Sample use: simulate_mouse_click lclick_down
select_ui_element Sample use: select_ui_element faction_button
wait Sample use: wait 1.3
spawn_character Sample use: spawn_character julii Gaius Antio, diplomat, command 0, influence 0, management 0, subterfuge 0, age 29, , x 94, y 77



2) Commands that have been tested and we believe are not working as documented

play_video Sample use: play_video fmv/rome_intro.mpg
provoke_rebellion Sample use: provoke_rebellion Segesta
call_object_shortcut Sample use: call_object_shortcut strat_ui speedup_ai - will toggle the fast ai mode

spawn_army ... end
Sample use: spawn_army
faction romans_julii
character Foedus Chaerea, general, command 0, influence 0, management 0, subterfuge 0, age 20, , x 54, y 124
unit roman generals guard cavalry soldiers 20 exp 9 armour 1 weapon_lvl 0
unit roman legionary first cohort ii soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman legionary cohort ii soldiers 60 exp 0 armour 0 weapon_lvl 0
unit roman praetorian cohort i soldiers 60 exp 0 armour 0 weapon_lvl 0
end


3) Commands that have not been tested yet

reposition_character Sample use: reposition_character Gaius Maximus, 14, 53
engage_armies Sample use: engage_armies Gaius Julius, Epiroderix
senate_mission_help_player Sample use: senate_mission_help_player one_best_buildable_unit
senate_mission_assassination Sample use: senate_mission_assassination minor_reward Gaius Julius
senate_mission_cease_hostilities Sample use: senate_mission_cease_hostilities two_minor_exotic_units Gauls
senate_mission_declare_war Sample use: senate_mission_declare_war major_reward Gauls
senate_mission_broker_peace Sample use: senate_mission_broker_peace major_reward Gauls
senate_mission_take_city Sample use: senate_mission_assassination moderate_reward Tarquini
e_point_at_settlement Sample use:
point_at_unit_group_pos Sample use: point_at_unit_group_pos infantry_group1
point_at_card Sample use: point_at_card unit hastati 2 - to point at the second hastati card the game can find
e_point_at_unit_card Sample use: e_point_at_unit_card
show_mouse_button_animation Sample use: show_mouse_button_animation left true - start the animation showing the left mouse button being pressed. show_mouse_button_animation left false - stop the left mouse button animation. NOTE: Only 1 animation can be shown at a time
select_character Sample use: select_character Gaius Julius
e_select_character Sample use: e_select_character
select_settlement Sample use: select_settlement Roma
e_select_settlement Sample use: e_select_settlement
filter_settlement_commands Sample use: filter_settlement_commands on Arretium change_formation
filter_character_commands Sample use: filter_character_commands on Gaius Julius, change_formation (note comma)
ui_indicator Sample use: ui_indicator 0 circle 500 500 colour 255 255 0 scale 2.0 period 2.0 loop
ui_indicator_remove Sample use: ui_indicator_remove 0
unit_order_halt Sample use: unit_order_halt cohort1
unit_order_move_relative Sample use: unit_order_move_relative cohort1 0 60 run
unit_order_turn Sample use: unit_order_turn roman_archers -20 relative (turns left 20 degrees)
unit_unset_morale Sample use: unit_unset_morale peasants4
unit_set_weapon_upgrade Sample use: unit_set_weapon_upgrade spearmen1 3
unit_set_armour_upgrade Sample use: unit_set_armour_upgrade spearmen1 3
unit_set_experience Sample use: unit_set_experience roman_general 7
kill_unit Sample use: kill_unit carthaginians2
reduce_unit_strength Sample use: reduce_unit_strength carthaginians2 50
unit_set_guard_mode Sample use: unit_set_guard_mode roman_spearmen on
unit_set_fire_at_will_mode Sample use: unit_set_fire_at_will_mode roman_archers on
unit_set_formation_spacing Sample use: unit_set_formation_spacing roman_archers loose
unit_taunt Sample use: unit_taunt barb_archers
unit_use_special_ability Sample use: unit_use_special_ability barb_archers
unit_group_enable_automation Sample use: unit_group_enable_automation
unit_group_immediate_place Sample use: unit_group_immediate_place group6 100 -60 -20
unit_group_order_halt Sample use: unit_group_order_halt group6
unit_group_order_move_formed Sample use: unit_group_order_move_formed group6 100 -60 run
unit_group_order_move_unformed Sample use: unit_group_order_move_unformed group6 100 -60 run
unit_group_order_relative_move_unformed Sample use: unit_group_order_relative_move_unformed group6 100 -60 run
unit_group_move_to_missile_range_of_unit Sample use: unit_group_move_to_missile_range_of_unit archer_group enemy_spearmen3
unit_group_move_to_missile_range_of_group Sample use: unit_group_move_to_missile_range_of_group archer_group enemy_group
unit_group_order_attack_unit Sample use: unit_group_order_attack_unit group1 enemy_unit4
unit_group_order_attack_group Sample use: unit_group_order_attack_group cavalry_group1 enemy_archer_group
unit_group_order_change_group_formation Sample use: unit_group_order_change_group_formation group2 ordered_triple_line_1
unit_group_order_turn Sample use: unit_group_order_turn group2 90 (turns the group to 90 degrees)
unit_group_set_morale Sample use: unit_set_morale infantry_group routing
unit_group_change_unit_formation Sample use: unit_group_change_unit_formation hoplite_group phalanx
unit_group_set_guard_mode Sample use: unit_group_set_guard_mode group2 off
unit_group_set_skirmish_mode Sample use: unit_group_set_skirmish_mode archer_group on
unit_group_set_fire_at_will_mode Sample use: unit_group_set_fire_at_will_mode group2 off
unit_group_set_formation_spacing Sample use: unit_group_set_formation_spacing group1 loose
camera_event_cuts_active_set Sample use: camera_event_cuts_active_set off
battle_general_camera Sample use: battle_general_camera
camera_look_at_position Sample use: camera_look_at_position 123.4 56.7
e_camera_zoom_to_unit Sample use: e_camera_zoom_to_unit
remove_unit_from_group Sample use: remove_unit_from_group group1 archers1
heed_pause Sample use: heed_pause on

Epistolary Richard
04-27-2005, 17:50
Console commands
All taken from Console commands & command line options for modders? (https://forums.totalwar.org/vb/showthread.php?t=41775)

1) Commands we know are working
Note, not all of these can be activated through the RomeShell console

toggle_fow
toggle_perfect_spy
show_cursorstat
bestbuy
oliphaunt
add_money {opt:faction} {amount}
create_unit {settlement/character_name} {unit_id} {opt: how many}{opt: exp/armour/weapon}
add_population {settlement_name}{amount}
move_character {name}{x},{y}
auto_win {attacker/defender}
give_ancillary {charactername}{ancillary name}
give_trait {charactername}{trait name}{opt:level}
puppify_my_love
capture_settlement {settlementname}
invulnerable_general {charactername}
date {year}
season {summer/winter}
create_building {settlement_name} {building_name}
kill_faction {faction}
kill_character {charactername}
halt_ai
control {faction}
test_victory_scroll {faction}
diplomatic_stance {faction1} {faction2} {stance}
clear_messages
test_message {messagename} ;(as per descr_event_enums)
set_building_health [settlement] [building line] [health]

2) Commands that have been tested and we believe are not working


3) Commands that have not been tested yet

oliphants.jericho
toggle_tow
auto_win
toggle_restrictcam
give_ancillary
give_trait
process_cq
character_reset
toggle_terrain
write_ui_cache
give_trait_points
list_traits
list_ancillaries
mp
list_characters
show_landings
filter_coastlines
toggle_coastlines
ai_turn_speed
amdb_min
amdb_max
amdb_offset
zoom
set_ranking_interval
regenerate_radar
adjust_sea_bed
reload_shaders
reload_textures
fire (mt | toggle | reload | int)
toggle_game_update
building_debug
reset_display
toggle_underlay
toggle_overlay
process_rq
force_diplomacy
shadow
ie
test_ancillary_localisation
perf_times
burn_piggies_burn
show_terrain_lines
message_collation_set
show_all_messages
reapply_rigid_model_influence
toggle_flowing_water
nw_stats
toggle_pr
list_units
trigger_advice
damage_wall
upgrade_effect
force_battle_victory
force_battle_defeat
output_unit_positions
show_battle_paths
show_battle_paths_for_unit
show_battle_street_plan
show_battle_marker
show_battle_circle
diplomacy_mission
event
disable_ai
run_ai

The_Mark
04-27-2005, 17:51
You should add placeholders for events and conditions also.

Simetrical
04-28-2005, 03:08
The kill_faction and kill_character commands work through scripts. I use them for debugging purposes. kill_unit, unit_group_order_relative_move_formed, play_sound_event, stop_sound_event, unit_order_change_formation, unit_order_attack_unit, unit_order_move, unit_order_move_relative, unit_set_morale, unit_set_skirmish_mode, inhibit_camera_input, and undefine_unit_group are used in the Carrhae script, and probably others are used in other battle scripts.

-Simetrical

Epistolary Richard
04-28-2005, 13:27
Updated, thanks Simetrical.

Are these the correct parameters?
kill_faction {faction}
kill_character {charactername}

Simetrical
04-29-2005, 00:16
I used quotes for the character name. Not sure if it'll work without. I know you have to include titles for captains and admirals, like "Captain Bob" rather than just "Bob". Also, the faction names are case-sensitive (they have to be all lowercase).

-Simetrical

Myrddraal
04-29-2005, 08:42
I tested the spawn_character, and it half works.

I used the code to spawn a captain (not a family member) for the scipii called Asinius Aelius. The man appears, (right model for scipii etc) but he didn't have a banner. I tried adding units to his army by using console_command add_unit, but this seemed to have no effect. I could script the army to move by using move captain asinius, x, y. But the AI seemed to ignore this new character completely. So, it didn't work.

As for spawn_army, I tried editing the syntax so that it was the same as used in descr_battle.txt for historical battles (as this is what it said it should be in the CA txt files) but again, the script did not run at all (no commands were executed, before or after the spawn_army command)

Here is something weird, for some reason the line:
console_command run_ai
won't work for me. I halt the AI, but it won't start again, no commands after that line are executed. This is very very wierd as CA use this exact line in the prologue script.... WTF?

Epistolary Richard
04-29-2005, 22:06
Did you try spawn_character for diplomats, spies and assassins as well?


Here is something weird, for some reason the line:
console_command run_ai
won't work for me. I halt the AI, but it won't start again, no commands after that line are executed. This is very very wierd as CA use this exact line in the prologue script.... WTF?

Were you using halt_ai or disable_ai? The Prologue script initially uses disable_ai before the run_ai, don't know if that would make a difference...

Epistolary Richard
05-05-2005, 09:13
As I'm not able to unpack the demo pak files I've not been able to tell if there any additional files in there that might be of use, such as the posited available_ui_elements file.

However, I have tried to compile my own list of ui_element names from those listed in vanilla:


settlement_stats_button
advanced_stats_show_trade_button
settlement_info_construction_tab
settlement_info_repair_tab
settlement_info_recruitment_tab
settlement_info_retrain_tab
selected_item_button
faction_button
combined_scroll_senate_tab
senate_scroll_missions_tab
show_hide_group_formations
?hud_show_buildings_tab ; *only mentioned in documentation*
advisor_dismiss_button
toggle_run
order_halt
play_button
radar
hud_select_prev_item_cycle ;doesn't work??? *that's a CA comment*
season_icon
end_turn
faction_turn_display
construction_button
recruitment_button
own_settlement_governor_info_panel
settlement_status_icons_group ;Highlight the settlement status icons
settlement_state_icon_revolting
settlement_state_icon_under_siege
settlement_state_icon_plague
governor_policy_inc_gadget ;Highlight the arrow button for increasing taxation level
governor_policy_dec_gadget ;Jump to highlighting the arrow button for decreasing taxation level
available_construction_options
settlement_info_repair_tab
building_browser_button ;Highlight the building browser button
show_construction_advice_button ;Highlight the request advice button
available_training_options ;Highlight the recruitment list
garrison_info_zoom_to_button ;Highlight the centre map button
siege_maintain_button
siege_assault_button
available_siege_equipment_options
siege_end_button
toggle_special_ability
decrease_taxation_gadget ; Flash the decrease taxation gadget
increase_taxation_gadget ; Flash the increase taxation gadget
character_info_command_points ;Highlight the governor's panel stats
character_info_management_points
character_info_influence_points
egg_timer
ffwd_button
ultra_ffwd_button
play_button
formation_1
formation_2
formation_3
formation_4
formation_5
formation_6
formation_7
formation_8
toggle_defend
radar
radar_zoom_in_button
radar_zoom_out_button
toggle_skirmish

The_Mark
05-06-2005, 11:41
Here's a useful console command:

diplomatic_stance {faction1} {faction2} {stance}
diplomatic_stance gauls germans allied

Stances are (at least): allied, war, neutral. The command also spawns a diplomatic message.

Myrddraal
05-06-2005, 13:04
Does anyone know how to unpak the demo paks? It must have been done.

Monkwarrior
05-09-2005, 17:26
I must acknowledge you, ER, your efforts in putting scripting as a tool in our hands. :bow:
In fact I am trying to understand the "language" to implement some scripting in my own mod. I am not an expert, so some of the questions may seem stupid, but... Anyway, here are my doubts (from your clientkingdoms mod):

- I don't understand the use of SettlementIsLocal. What does it mean? I wonder if the script only works when the settlement is owned by the human player and if this is the way to say it. In my case this can be a problem, as I would like to include "general historic events", but that only happens if the "historical conditions" are fulfiled.

- In the scripts, must "console_command" be used before any of the commands listed in post three?
Ex: console_command capture_settlement ....

For the moment I have a trigger and an advice thread that work, but now I must do a script.
I will report any success in this task, and probably more doubts.
Cheers.

Epistolary Richard
05-09-2005, 17:54
Thanks, Monkwarrior, but really I would have remained completely ignorant of scripting if others had not shown the way.

SettlementIsLocal condition
The player's faction is the local faction. This condition means that the trigger will only activate if the city being tested belongs to the player's faction and means that it's only the player that will benefit from the client's troops. If you removed the settlement is local condition then the advisor would appear during an AI turn (and subsequently disappear without you being able to run it). One of the big limitations of the event script method used in Client Kingdoms (as opposed to the background script used in Myrddraal's Multiple Turns) is that it can't be triggered easily by an event that occurs in the AI's turn.


- In the scripts, must "console_command" be used before any of the commands listed in post three?
Ex: console_command capture_settlement ....
That's right. This thread isn't very big on details, but then it's intended to be just hard-core research. Once we understand how stuff works, then it can be made reader-friendly.

Monkwarrior
05-09-2005, 23:10
Thanks, ER.
As I promised, I have a new doubt. ~D
As I told before, I was able to write a new trigger, a really simple one:

;------------------------------------------
Trigger 2902_Sicilia_Casus_Belli2_Trigger
WhenToTest FactionTurnStart

Condition I_SettlementOwner Lilybaeum = greek_cities

AdviceThread Sicilia_Casus_Belli2_Thread 1

That means, in case of Lilybaeum is conquered by greek_cities an advice will appear, in this way:

;------------------------------------------
AdviceThread Sicilia_Casus_Belli2_Thread
GameArea Campaign

Item Sicilia_Casus_Belli2_Text_01
Uninhibitable
Verbosity 0
Threshold 1
Attitude Normal
Presentation Default
Title Sicilia_Casus_Belli2_Text_01_Title
Text Sicilia_Casus_Belli2_Text_01_Text1

I have played a campaign with greek_cities and I have captured Lilybaeum. Just before pressing the end-of-turn button I saved the campaign, in order to have a quick test for this trigger. The advisor text appeared for the first time, http://img161.echo.cx/img161/720/sicilia18tg.th.jpg (http://img161.echo.cx/my.php?image=sicilia18tg.jpg)
but if I try to repeat (with or without modification), the advisor didn't appear anymore. I copied and renamed the trigger and the advice, and again it appeared only once.

I tried by putting

MaxRepeats 100

but there was no difference. Is there any problem with the repetition of a trigger? ~:confused:

Epistolary Richard
05-09-2005, 23:33
You want it to appear at the start of every faction's turn? Including the AI ones? For every turn that the Greeks hold Lilybaeum?

Well, okay, try this trigger instead:

;------------------------------------------
Trigger 2902_Sicilia_Casus_Belli2_Trigger
WhenToTest FactionTurnStart

Condition I_SettlementOwner Lilybaeum = greek_cities

AdviceThread Sicilia_Casus_Belli2_Thread 0

Monkwarrior
05-09-2005, 23:38
Thanks, I've just remarked the zero!
The answer is no, of course, but it was only a question of testing.
Now I have run a short script:

script
console_command diplomatic_stance romans_julii greek_cities war

end_script
and this is the resulthttp://img195.echo.cx/img195/3851/sicilia23ct.th.jpg (http://img195.echo.cx/my.php?image=sicilia23ct.jpg)
It works! ~D

So I can think in refining this system to stablish "security perimeters" or "security zones", where any movement will be seen as an agression.
Thanks again!

Monkwarrior
05-10-2005, 23:15
I've been also trying the question of spawn_army.
I think I've tried about a dozen of ways to write it. This is one:


spawn_army
faction romans_julii
character Publius Scipio, general, command 0, influence 0, management 0, subterfuge 0, age 23, , x 211, y 69
army
unit roman generals guard cavalry early soldiers 15 exp 0 armour 0 weapon_lvl 0
unit roman velite soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman velite soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman hastati soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman hastati soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman hastati soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman hastati soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman princeps soldiers 41 exp 0 armour 0 weapon_lvl 0
unit roman triarii soldiers 41 exp 0 armour 0 weapon_lvl 0
end

It doesn't work, of course, but perhaps there is a useful information. The show_err option says me "don't recognise this token: unit".
Does anybody know what token is?
The interesting question is that it seems that recognise everything until "unit" (so army is necessary, isn't it?). I've tried also:
roman generals...
"roman generals...
create_unit ...
and the error message is always the same: don't recognise this token {first word}.

Myrddraal
05-11-2005, 08:38
I've also tried many ways, copying entries from descr_battle.txt (like it says you should), the sample use given by CA, and even entries from descr_strat. Of course none worked.

Monkwarrior
05-16-2005, 00:42
Well, I am interested in the possibilities of scripting from the start of this research, although I am a complete ignorant about all the relative to this aspect.
Following the advice of Epistolary Richard and with the invaluable help of our moderator, Myrddraal, I've been trying to explore the use of a continuous script.
My first idea was to simulate the senate missions, either in campaigns where the senate is not present or for factions different from romans (many people claims that Carthage had also a senate and that this faction could also be splited into two).
This is my first (partial) success:

;Senate Missions Emulator, by Monkwarrior Beta Version 0.1
script

;set up counters
declare_counter SenateMission ;used to know which mission is currently assigned
declare_counter loop

;start of the first mission

advance_advice_thread Senate_Mission_M01_Thread ;communication to the player
set_counter SenateMission 1

;success in mission
monitor_event GeneralCaptureSettlement FactionType romans_julii
and SettlementName Segesta

if I_TurnNumber < 10
advance_advice_thread Senate_Mission_Success1_Thread ;message of success
console_command add_money 3000 ;this is the reward
inc_counter SenateMission 1 ;pass to the next mission
end_if

terminate_monitor
end_monitor

;mission failed
monitor_conditions I_TurnNumber = 10
and I_CompareCounter SenateMission = 1

advance_advice_thread Senate_Mission_Failed1_Thread ;time for mission is over
console_command add_money -1000 ;penalty
inc_counter SenateMission 1 ;pass to the next mission

terminate_monitor
end_monitor

while I_CompareCounter loop = 0
end_while
terminate_script

This script is completed with three advices in export_descr_advice, corresponding to the communication of the mission, the success message and the fail message.
I have checked this script in my Iberia:TotalWar campaign and it works (thanks to the "loop" idea of Myrddraal).

Why must it be considered a partial success? The advices appear only once. If I start again the campaign, they do not appear again and I must modify the advice name in all the related files. To be useful, the advices should appear only once in a campaign, but in every campaign.
Does anybody know how to repeat an advice?
Does anybody know what is this command used for?:

suspend_unscripted_advice false

Epistolary Richard
05-23-2005, 11:56
The show_err option says me "don't recognise this token: unit".
Does anybody know what token is?Token is their name for words the scripting engine recognises. The problem with the spawn_army as the sample is written is that the game doesn't recognise 'unit' as an command - either because it never did or because it's been deactivated.


Why must it be considered a partial success? The advices appear only once. If I start again the campaign, they do not appear again and I must modify the advice name in all the related files. To be useful, the advices should appear only once in a campaign, but in every campaign.
Does anybody know how to repeat an advice?I don't quite understand this, when you say start again the campaign do you mean that you are starting a new campaign or that you are reloading one that you have previously saved?

suspend_unscripted_advice false
This command means that no advice will appear unless the thread is advanced as part of the script or the player has requested a piece of advice from a help button.

Updates
The top posts have also been updated. Console commands clear_messages and test_message both work. As Myrddraal already noted, spawn_character works to some extent as well. I expanded the testing to agents and found it works fine for them - see the sample use for the command line I used.

DimeBagHo
05-26-2005, 02:55
I'm having the same problem as Monkwarrior. I am trying to set up scripts for modified victory conditions, so I only want the advice thread to trigger once per campaign. My scripts work fine, except that they either trigger just once, or they trigger every turn after the victory conditions are met. I can't get them to trigger once per campaign.

Epistolary Richard
05-26-2005, 04:17
Have you considered using a counter as a conditional (eg, if victory_counter = 0) then set the counter to 1 when the victory conditions are fulfilled, so that they won't be fulfilled in future turns?

DimeBagHo
05-26-2005, 06:16
Have you considered using a counter as a conditional (eg, if victory_counter = 0) then set the counter to 1 when the victory conditions are fulfilled, so that they won't be fulfilled in future turns?

That would work for a continuously running script, but because of the problems with continuous scripts (like not being able to save) I was planning to just use incidental scripts.

One solution is to tell users to delete preferences\advice before they start a new campaign. That has the effect of seting all the advice thread counts back to zero. But I was hoping to come up with something that would "just work" without users actually having to read the readme. ~;)

player1
05-26-2005, 06:31
Well that's the same problem I had with Civ2 even scripting long time ago.

There is a good reason why normal descr_start.txt script doesn't allow saving, so workarounds like F1 - advice need to be used.

And it's inability to save inscript variables.
So things like once per campaing are impossible, only once per session is possible.

That's for example why you can't save several first turns in prologue. It would completly mess the script if you do (no variables saved).

Epistolary Richard
05-26-2005, 08:45
My scripts work fine, except that they either trigger just once, or they trigger every turn after the victory conditions are met. I can't get them to trigger once per campaign.

Ah, sorry I was assuming you were using a background script like Monkwarrior. I don't understand what you mean when you say that they trigger just once, but they don't trigger once per campaign. Could you explain it further?

DimeBagHo
05-26-2005, 09:14
Ah, sorry I was assuming you were using a background script like Monkwarrior. I don't understand what you mean when you say that they trigger just once, but they don't trigger once per campaign. Could you explain it further?
Sure. Here is the code for a test victory condition I set up.


;------------------------------------------
AdviceThread Greek_Cities_Win_Thread
GameArea Campaign

Item Greek_Cities_Win_Text_01
Uninhibitable
Verbosity 0
Threshold 1
MaxRepeats 0
RepeatInterval 1
Attitude Excited
Presentation Default
Title Greek_Cities_Win_Text_01_Title
Script scripts\show_me\Greek_Cities_Win.txt
Text Greek_Cities_Win_Text_01_Text1

;------------------------------------------
Trigger Greek_Cities_Win_Trigger
WhenToTest FactionTurnStart

Condition FactionIsLocal
and FactionType greek_cities
and I_ThreadCount Greek_Cities_Win_Thread < 1
and I_SettlementOwner Athens = greek_cities

AdviceThread Greek_Cities_Win_Thread 1


This is just a test, so all the Greek Cities need to win is to capture Athens. When the advice thread triggers the advisor comes up and anounces that the player has won. If they hit showme then the script triggers the victory scroll.

Greek_Cities_Win_Trigger only fires once because of the I_ThreadCount condition. Even if you start a new campaign it will not fire again. If I remove that condition then the trigger and the advice thread will keep firing every turn, as long as the Greek Cities still hold Athens (assuming of course that the player continues to play after achieving victory).

If I could get it to fire just once per campaign that would be ideal, but it probably doesn't matter that much. Someone would have to play all the way through the Greek Cities campaign twice for it to be an issue - and I can always make an advice thread to remind them to delete preferences/advice if they try to start a new campaign after winning once.

Epistolary Richard
05-26-2005, 09:27
Thanks, I understand now. The way to do it is to make a permanent change to the game world that will be logged within a save game but not embedded when you start a new campaign. An example of this would be to use the victory script to add a building to a settlement that was not otherwise buildable there and then add a and not SettlementBuildingExists condition to the script. The first time the player achieves the victory conditions, there is no building there and so the conditions are true and the trigger is fired. In subsequent turns, the building is there and so the trigger is not activated. When a new campaign is started, the settlement buildings are generated afresh from descr_strat.

player1
05-26-2005, 09:47
This is great idea.
Just make sure that building can't be destroyed by player.

Epistolary Richard
05-26-2005, 09:51
It can be built in any province you like, so it can be put out of the way in Hyperborea or a completely isolated province if you're making adjustments to the map.

DimeBagHo
05-26-2005, 12:14
That is a good idea. But rather than hidding the building out of the way I think I will make it something obviously connected to victory. If the player decides to knock it down and relive victory, that's OK with me. ~:cheers:

DimeBagHo
05-26-2005, 14:02
I have tried this method out and it works fine. Here is the new trigger.


;------------------------------------------
Trigger Greek_Cities_Win_Trigger
WhenToTest SettlementTurnStart

Condition SettlementIsLocal
and SettlementName Sparta
and I_LocalFaction greek_cities
and not SettlementBuildingExists = victory_memorial
and I_SettlementOwner Athens = greek_cities

AdviceThread Greek_Cities_Win_Thread 1


Now, in addition to triggering the victory scroll the script creates a unique building, victory_memorial, in Sparta. Note that I had to change the WhenTotest to SettlementTurnStart rather than FactionTurnStart, so that I could use the SettlementBuildingExists test.

Epistolary Richard
06-18-2005, 14:40
Doubt has been cast over whether the add_money console command can be used for anyone aside from the local faction. If anyone has anything different to report, please let us know.

Epistolary Richard
08-01-2005, 17:29
According to The Mark, the following works:
set_building_health [settlement] [building line] [health]

Note that the building line possibly refers to the complex name rather than the individual building name.

Many thanks to him.

Stuie
08-09-2005, 15:57
Thanks, I've just remarked the zero!
The answer is no, of course, but it was only a question of testing.
Now I have run a short script:

script
console_command diplomatic_stance romans_julii greek_cities war

end_script
and this is the resulthttp://img195.echo.cx/img195/3851/sicilia23ct.th.jpg (http://img195.echo.cx/my.php?image=sicilia23ct.jpg)
It works! ~D

So I can think in refining this system to stablish "security perimeters" or "security zones", where any movement will be seen as an agression.
Thanks again!

Excellent! I was looking for something like this back in March when I was building the original TFT. Time to go script the Civil War.... thanks for sharing!

Edit: And victory condition triggers!! ~:eek: DimeBagHo that is just brilliant! Now I have my TFT work cut out for me...

Myrddraal
08-10-2005, 16:04
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.

Duke John
08-31-2005, 11:05
Scripting with duplicate character names
If there are multiple characters with duplicate names then the engine organises them at the start of the turn based on their coordinates. The order of checking goes like: check first top row from left right, then second row from left to right. It only checks the first character that it meets. So if you wish to check in script wether Captain Barrivendos has a specific trait then the command will turn out false if the first character doesn't have it, even when the second one in line does.

How to move an army into a settlement
Use the move command:

move Captain Barrivendos, 250, 62
Note that the characther must have enough movement points.

Duke John
08-31-2005, 11:22
...

Epistolary Richard
08-31-2005, 12:17
How to move an army into a settlement
Use the move command:

move Captain Barrivendos, 250, 62
Note that the characther must have enough movement points.

I tried this to use this to see if I could make a banner take a settlement. Does this work for that or does it only work if the banner and the settlement belong to the same faction?

Duke John
08-31-2005, 12:38
I have yet to test that. I am trying to clean up the map by moving all AI captains to a nearby settlement. It worked for the player faction, all of them moved and merged into the settlement. But when I use the move commmand for the AI the armies refuse to move. The command should work as it was used for the prologue. Do you know how to move AI armies?

Edit: discovered that AI armies cannot merge into a settlement in the player's turn. They can still be moved to other tiles though.

Epistolary Richard
08-31-2005, 16:07
Do you know how to move AI armies?
Short of the move_character console command, no. And you can't use that to move armies into settlements, they don't appear in them properly.

Lord Adherbal
08-31-2005, 18:16
I posted something about giving money and settlements to factions here:
https://forums.totalwar.org/vb/showthread.php?t=53365

not sure if it was the right forum since it's about Scripting, but it is a sort of tutorial

Epistolary Richard
09-01-2005, 11:09
Yep, that was the right forum for it. :thumbsup:

Epistolary Richard
09-20-2005, 17:17
Updates, updates, working spawn_army from Jerome Grasdyke

"Ok, i've had a quick look at spawn_army for you... the syntax you worked out above is essentially correct -- the command expects a sequence of "unit" commands followed by unit id's as phrases ... the following should work:

spawn_army
faction romans_julii
character Foedus Chaerea, general, command 0, influence 0, management 0, subterfuge 0, age 20, x 89, y 80
unit roman generals guard cavalry, soldiers 20 exp 9 armour 1 weapon_lvl 0
unit roman legionary first cohort ii, soldiers 40 exp 0 armour 0 weapon_lvl 0
unit roman legionary cohort ii, soldiers 60 exp 0 armour 0 weapon_lvl 0
unit roman praetorian cohort i, soldiers 60 exp 0 armour 0 weapon_lvl 0
end

The reason why unit and end appeared not to be recognised was because the data after and before (respectively) were incomplete.

This error is typical; understanding the Rome descr parser could have helped some. Essentially it works by parsing Words, which are letter sequences ended by whitespace, Phrases, which are word sequences ended by comma's, and Lines, which are word and phrase sequences ended by newline characters. In this case, there had to be a phrase terminator (comma) after the unit id, because otherwise the parser couldn't know where the unit id ends as a unit id is a phrase - a sequence of arbitrary words.

This is why some identifiers in the game use underscores and others not - internally some things are typed as Words and others as Phrases. If you look out for this kind of pattern it may help you spot wrongly-formed scripts... I'll see about getting you guys some docudemon files up-to-date for Barbarian Invasion."

Black Crow
10-28-2005, 20:17
hehehe that awsome... (misspelling =p)

now in my historical addon for rtr i can make hannibal be summoned at the alps in the year of 218 spreading fear into the romans... =) MUAHAHAHAHA

script if a nasty tool for the modders to spread their cruelty on innocent and good players hahahahah =) ok ok i´m not cruel, just pretending ahahhaha


OMG now i can make hole armies been summoned into historical places to force some historical wars or conflicts =) like the first slave war for example... ghahah


my historical information about the hannibal´s forces sadly are being taken out from the battle of cannae (http://www.roman-empire.net/army/cannae.html)

Epistolary Richard tanks you very much about the help your givving me sometimes and for this great information but i wonder why the ""... this information was provided for someone not listed ? =) thanks again... hehe
here is the code for the spawn army of hannibal... i´m gonna test it now

hope it works

script

spawn_army
faction carthage
character Hannibal, general, command 7, influence 8, management 0, subterfuge 0, age 20, x 89, y 80
unit carthaginian general's cavalry, soldiers 8 exp 7 armour 2 weapon_lvl 2
unit carthaginian slinger, soldiers 40 exp 2 armour 1 weapon_lvl 0
unit carthaginian slinger, soldiers 40 exp 1 armour 0 weapon_lvl 1
unit libyan spearmen, soldiers 60 exp 2 armour 1 weapon_lvl 0
unit libyan spearmen, soldiers 60 exp 0 armour 0 weapon_lvl 1
unit libyan spearmen, soldiers 60 exp 1 armour 1 weapon_lvl 0
unit aor spain infantry, soldiers 40 exp 3 armour 0 weapon_lvl 1
unit aor spain infantry, soldiers 40 exp 0 armour 1 weapon_lvl 1
unit aor spain infantry, soldiers 40 exp 4 armour 0 weapon_lvl 1
unit aor gaul swordsmen, soldiers 40 exp 1 armour 1 weapon_lvl 0
unit aor gaul swordsmen, soldiers 40 exp 0 armour 1 weapon_lvl 0
unit punic cavalry, soldiers 24 exp 2 armour 0 weapon_lvl 1
unit punic cavalry, soldiers 24 exp 1 armour 0 weapon_lvl 1
unit carthaginian elephant forest, soldiers 6 exp 3 armour 2 weapon_lvl 2
unit merc numidian cavalry, soldiers 24 exp 1 armour 0 weapon_lvl 1
unit merc numidian cavalry, soldiers 24 exp 1 armour 0 weapon_lvl 1
unit aor punic heavy cavalry, soldiers 20 exp 2 armour 1 weapon_lvl 0
unit aor punic heavy cavalry, soldiers 20 exp 2 armour 1 weapon_lvl 0
unit aor punic pikemen, soldiers 60 exp 3 armour 2 weapon_lvl 1
unit aor punic pikemen, soldiers 60 exp 3 armour 2 weapon_lvl 1
end

end_script

Myrddraal
10-29-2005, 02:26
Welcome to the forum Black Crow, that army should come as a nasty surprise... :bow:

Black Crow
10-29-2005, 04:11
a few corrections :
if you wanna a family member put , named character

okok everybody must know it... i confuse myself hahaha

the new code :

script

spawn_army
faction carthage
character Hannibal, named character, command 7, influence 8, management 0, subterfuge 0, age 35, x 89, y 80
unit carthaginian general's cavalry, soldiers 18 exp 6 armour 2 weapon_lvl 2
unit carthaginian slinger, soldiers 120 exp 2 armour 1 weapon_lvl 0
unit carthaginian slinger, soldiers 120 exp 1 armour 0 weapon_lvl 1
unit libyan spearmen, soldiers 180 exp 2 armour 1 weapon_lvl 0
unit libyan spearmen, soldiers 180 exp 0 armour 0 weapon_lvl 1
unit libyan spearmen, soldiers 180 exp 1 armour 1 weapon_lvl 0
unit aor spain infantry, soldiers 120 exp 3 armour 0 weapon_lvl 1
unit aor spain infantry, soldiers 120 exp 0 armour 1 weapon_lvl 1
unit aor spain infantry, soldiers 120 exp 4 armour 0 weapon_lvl 1
unit aor gaul swordsmen, soldiers 120 exp 1 armour 1 weapon_lvl 0
unit aor gaul swordsmen, soldiers 120 exp 0 armour 1 weapon_lvl 0
unit punic cavalry, soldiers 72 exp 2 armour 0 weapon_lvl 1
unit punic cavalry, soldiers 72 exp 1 armour 0 weapon_lvl 1
unit carthaginian elephant forest, soldiers 18 exp 3 armour 2 weapon_lvl 2
unit merc numidian cavalry, soldiers 72 exp 1 armour 0 weapon_lvl 1
unit merc numidian cavalry, soldiers 72 exp 1 armour 0 weapon_lvl 1
unit aor punic heavy cavalry, soldiers 60 exp 2 armour 1 weapon_lvl 0
unit aor punic heavy cavalry, soldiers 60 exp 2 armour 1 weapon_lvl 0
unit aor punic pikemen, soldiers 180 exp 3 armour 2 weapon_lvl 1
unit aor punic pikemen, soldiers 180 exp 3 armour 2 weapon_lvl 1
end

end_script


the inclusion of these 2 lines dont let the script to be executed... in my case the show me how button dont appears if i input those in the script...

traits GoodAdministrator 2, GoodCommander 2, NaturalMilitarySkill 1
ancillaries poet, chirurgeon, historian, oracle, orator

this picture is a test of the old script just to test is it works and it works fine... the date, the age of hannibal, the location are all messed up, this will be corrected but it is just for tests... the picture is ...

http://paginas.terra.com.br/negocios/EPL/testhannibal.JPG

Black Crow
10-29-2005, 04:25
ok the image doesnt work... lets try this other link at imageshack

https://img496.imageshack.us/img496/7664/testhannibal6yl.th.jpg (https://img496.imageshack.us/my.php?image=testhannibal6yl.jpg)


as i forguet to add in the other post, i´m working in a historical addon for rtr
6.x that will lead the player trought the ancient wars of rome, and historical battles, and historical events... the system works on show_me script... so i accept help or sugestions =) thanks.
=)

ps. this is not a spawn i dont know how to edit a post... or i dont have permission to do it, so if a moderator could just mix these two posts ill be apreciated

aleajactaest
10-29-2005, 09:10
In your script for Hannibal, under 'spawn_army', you can put other lines :
'console_command give_trait Hannibal GoodCommander 2'
'console_command give_trait Hannibal GoodAdministrator 2' eetc...
It works. I made the same thing for Spartacus.

scorpionsting
05-11-2011, 19:01
guys I've got a problem with the create_unit command, i don't know what to type nexte because the only thing all sites are saying is: create_unit {settlement/character_name} {unit_id} {opt: how many}{opt: exp/armour/weapon}
can one of you guys post a pre made command for Armoured Hoplites because when i do it from all the sites examples my console says not reconising unit id

Squid
05-16-2011, 04:15
guys I've got a problem with the create_unit command, i don't know what to type nexte because the only thing all sites are saying is: create_unit {settlement/character_name} {unit_id} {opt: how many}{opt: exp/armour/weapon}
can one of you guys post a pre made command for Armoured Hoplites because when i do it from all the sites examples my console says not reconising unit id

The obvious problem, which the error is telling you, is that you have the wrong unit id. The command takes the unit type from EDU. Find that and you should be fine.