How could I get a notification of a historical battle on a certain date and time of day? Which gives you the opportunity to participate and sends you to a certain scene.
This indicates that script is called every frame. This is getting confusing. I think it works like this. When the time comes, you're redirected to the menu. When you click one of the buttons, You go back to the main world. The game calls that script again to display date. You're redirected to the menu again. It works like an infinite loop of actions. Fixed version should work.I will keep trying, since when I enter the event menu screen, it does not let me exit, I press the 2 options a thousand times and nothing ...
#################################################
(store_mod, ":cur_hour", ":num_hours", 24),
(try_begin),
(this_or_next|neq, "$g_current_hour", ":cur_hour"),
(this_or_next|neq...
If you add this code to the end of it.#script_game_get_date_text:
# This script is called from the game engine when the date needs to be displayed.
# INPUT: arg1 = number of days passed since the beginning of the game
# OUTPUT: result string = date
("game_get_date_text",
(store_mod, ":cur_hour", ":num_hours", 24),
(try_begin),
(this_or_next|neq, "$g_current_hour", ":cur_hour"),
(this_or_next|neq, "$g_current_day", ":cur_day"),
(this_or_next|neq, "$g_current_month", ":cur_month"),
(neq, "$g_current_year", ":cur_year"),
(assign, "$g_current_hour", ":cur_hour"),
(assign, "$g_current_day", ":cur_day"),
(assign, "$g_current_month", ":cur_month"),
(assign, "$g_current_year", ":cur_year"),
(call_script, "script_historical_battle_notification"),
(try_end),
TLD has no such historical battles. The mod has a starting point and then it's basically a 'What would be if' scenario.If you couldn't get anyting from produno, you may try the TLD modders. It may contain similar stuff since it the lore contains a lot of histroical battles.
Thanks, torrow i will try.If you couldn't get anyting from produno, you may try the TLD modders. It may contain similar stuff since it the lore contains a lot of histroical battles.
If all those fail, you can try something like this.
There is a script that is called to create date text.
If you add this code to the end of it.
It calls a custom script for every hour once. You may do whatever you want at that script. If it causes troubles, you can call it from a simple trigger with a 1 hour interval. Use those global variables (g_current_hour etc) inside the custom script. The rest is up to you.Code:(store_mod, ":cur_hour", ":num_hours", 24), (try_begin), (neq, "$g_current_hour", ":cur_hour"), (neq, "$g_current_day", ":cur_day"), (neq, "$g_current_month", ":cur_month"), (neq, "$g_current_year", ":cur_year"), (assign, "$g_current_hour", ":cur_hour"), (assign, "$g_current_day", ":cur_day"), (assign, "$g_current_month", ":cur_month"), (assign, "$g_current_year", ":cur_year"), (call_script, "script_historical_battle_notification"), (try_end),
I played it long time ago, so i don't remember exactly. I thought if they've added stuff like siege of Minas Tirith, they should used something similar to what he is asking for.TLD has no such historical battles. The mod has a starting point and then it's basically a 'What would be if' scenario.
Your other idea is good, I recall having seen it somewhere. Probably the best way to go with.
#script_cf_historical_battle_notification
("cf_historical_battle_notification",
[
(try_begin),
(eq, "$g_current_hour", 7),
(eq, "$g_current_day", 27),
(eq, "$g_current_month", 8),
(eq, "$g_current_year", 1814),
(jump_to_menu,"mnu_historical_battle"),
(try_end),
]),
################ Batalla Historica #######
("historical_battle", mnf_disable_all_keys,
"historical battle",
"none",[(set_background_mesh, "mesh_pic_victory")],
[
("entrar_bh",[],"Yes, I want to participate",
[(change_screen_return, 0),
]),
("salir_bh",[], "No, go to ****",
[(change_screen_return, 0)
]),
]),
I put the 2 names the same, in the origin and in the destination, I changed it because when compiling it told me that it could fail ... I don't know what else I can do ...Los nombres de los guiones son importantes. Asegúrese de que ambos tengan los mismos nombres. "script_cf_historical_battle_notification" y "script_historical_battle_notification". Ese "cf_" se agrega a los scripts que pueden fallar. Su secuencia de comandos tiene todo el código que falla en el bloque try. No es necesario nombrarlo así.
If the names are correct, i don't see any problem with the code. Maybe you can change the script call with a message to figure out the problem as i said before on your previous question like this.I put the 2 names the same, in the origin and in the destination, I changed it because when compiling it told me that it could fail ... I don't know what else I can do ...
If it displays, script has some problems. Also, as i said before, your script has all of the failable statements inside a try block. There should be no warnings about the "cf_" stuff. I can't figure out the source of that warning message from the script you posted.(display_message, "@Time for a historical event!"),
ok, I'll try as soon as I canIf the names are correct, i don't see any problem with the code. Maybe you can change the script call with a message to figure out the problem as i said before on your previous question like this.
If it displays, script has some problems. Also, as i said before, your script has all of the failable statements inside a try block. There should be no warnings about the "cf_" stuff. I can't figure out the source of that warning message from the script you posted.
(store_mod, ":cur_hour", ":num_hours", 24),
(try_begin),
(neq, "$g_current_hour", ":cur_hour"),
(neq, "$g_current_day", ":cur_day"),
(neq, "$g_current_month", ":cur_month"),
(neq, "$g_current_year", ":cur_year"),
(assign, "$g_current_hour", ":cur_hour"),
(assign, "$g_current_day", ":cur_day"),
(assign, "$g_current_month", ":cur_month"),
(assign, "$g_current_year", ":cur_year"),
(display_message, "@Time for a historical event!", 0x00C1DA),
# (call_script, "script_historical_battle_notification"),
(try_end),
#################################################
(store_mod, ":cur_hour", ":num_hours", 24),
(try_begin),
# (neq, "$g_current_hour", ":cur_hour"),
# (neq, "$g_current_day", ":cur_day"),
# (neq, "$g_current_month", ":cur_month"),
# (neq, "$g_current_year", ":cur_year"),
(assign, "$g_current_hour", ":cur_hour"),
(assign, "$g_current_day", ":cur_day"),
(assign, "$g_current_month", ":cur_month"),
(assign, "$g_current_year", ":cur_year"),
# (display_message, "@Time for a historical event!", 0x00C1DA),
(call_script, "script_cf_historical_battle_notification"),
(try_end),
###################################################
#script_cf_historical_battle_notification
("cf_historical_battle_notification",
[
# (try_begin),
(display_message, "@Time for a historical event!", 0x00C1DA),
(eq, "$g_current_hour", 7),
(eq, "$g_current_day", 27),
(eq, "$g_current_month", 8),
(eq, "$g_current_year", 1814),
(jump_to_menu,"mnu_historical_battle"),
# (try_end),
]),
I added those neq statements to makeMy question was always, why did you put neq
to make sure it does that job once per every hour. I didn't know how often 'game_get_date_text' script is called. My guesses were once every hour or once every frame. When i think about it, I should have used them like thisIt calls a custom script for every hour once.
(this_or_next|neq, "$g_current_hour", ":cur_hour"),
(this_or_next|neq, "$g_current_day", ":cur_day"),
(this_or_next|neq, "$g_current_month", ":cur_month"),
(neq, "$g_current_year", ":cur_year"),
Then you can delete those neqs completely. It indicates 'game_get_date_text' script is called once every hour.Every hour he notified me of the event and on the morning of August 27, 1814, he showed me the battle menu ...
I will keep trying, since when I enter the event menu screen, it does not let me exit, I press the 2 options a thousand times and nothing ...Then you can delete those neqs completely. It indicates 'game_get_date_text' script is called once every hour.
This indicates that script is called every frame. This is getting confusing. I think it works like this. When the time comes, you're redirected to the menu. When you click one of the buttons, You go back to the main world. The game calls that script again to display date. You're redirected to the menu again. It works like an infinite loop of actions. Fixed version should work.I will keep trying, since when I enter the event menu screen, it does not let me exit, I press the 2 options a thousand times and nothing ...
#################################################
(store_mod, ":cur_hour", ":num_hours", 24),
(try_begin),
(this_or_next|neq, "$g_current_hour", ":cur_hour"),
(this_or_next|neq, "$g_current_day", ":cur_day"),
(this_or_next|neq, "$g_current_month", ":cur_month"),
(neq, "$g_current_year", ":cur_year"),
(assign, "$g_current_hour", ":cur_hour"),
(assign, "$g_current_day", ":cur_day"),
(assign, "$g_current_month", ":cur_month"),
(assign, "$g_current_year", ":cur_year"),
(display_message, "@Time for a historical event!", 0x00C1DA),
(call_script, "script_cf_historical_battle_notification"),
(try_end),
###################################################
#script_cf_historical_battle_notification
("cf_historical_battle_notification",
[
(try_begin),
(eq, "$g_current_hour", 7),
(eq, "$g_current_day", 27),
(eq, "$g_current_month", 8),
(eq, "$g_current_year", 1814),
(display_message, "@Burning of Washington!", 0x00C1DA),
(jump_to_menu,"mnu_historical_battle"),
(try_end),
]),
There it worked hehe, thank you very much for your help.This indicates that script is called every frame. This is getting confusing. I think it works like this. When the time comes, you're redirected to the menu. When you click one of the buttons, You go back to the main world. The game calls that script again to display date. You're redirected to the menu again. It works like an infinite loop of actions. Fixed version should work.
Code:################################################# (store_mod, ":cur_hour", ":num_hours", 24), (try_begin), (this_or_next|neq, "$g_current_hour", ":cur_hour"), (this_or_next|neq, "$g_current_day", ":cur_day"), (this_or_next|neq, "$g_current_month", ":cur_month"), (neq, "$g_current_year", ":cur_year"), (assign, "$g_current_hour", ":cur_hour"), (assign, "$g_current_day", ":cur_day"), (assign, "$g_current_month", ":cur_month"), (assign, "$g_current_year", ":cur_year"), (display_message, "@Time for a historical event!", 0x00C1DA), (call_script, "script_cf_historical_battle_notification"), (try_end), ###################################################
Code:#script_cf_historical_battle_notification ("cf_historical_battle_notification", [ (try_begin), (eq, "$g_current_hour", 7), (eq, "$g_current_day", 27), (eq, "$g_current_month", 8), (eq, "$g_current_year", 1814), (display_message, "@Burning of Washington!", 0x00C1DA), (jump_to_menu,"mnu_historical_battle"), (try_end), ]),
#script_cf_historical_battle_notification
("cf_historical_battle_notification",
[
(try_begin),
(eq, "$g_current_hour", 7),
(eq, "$g_current_day", 27),
(eq, "$g_current_month", 8),
(eq, "$g_current_year", 1814),
(display_message, "@Rancagua disaster!", 0x00C1DA),
(jump_to_menu,"mnu_batalla_rancagua"),
(else_try),
(eq, "$g_current_hour", 7),
(eq, "$g_current_day", 29),
(eq, "$g_current_month", 8),
(eq, "$g_current_year", 1814),
(display_message, "@Cancha Rayada surprise!", 0x00C1DA),
(jump_to_menu,"mnu_batalla_cancharayada"),
(try_end),
]),
####################
(
"historical_battle_escene",
[
(assign, "$g_mt_mode", ctm_ranged),#
(modify_visitors_at_site, "$town_scene3"),
(reset_visitors),
(set_visitors, 25, "trp_swadian_militia", 3),
(set_visitors, 26, "trp_swadian_sergeant", 2),
(set_visitors, 27, "trp_swadian_militia", 3),
(set_visitors, 8, "trp_swadian_sergeant", 2),
(set_visitors, 9, "trp_swadian_sergeant", 2),
(set_visitors, 13, "trp_swadian_crossbowman", 3),
(set_visitors, 14, "trp_swadian_sergeant", 2),
(set_visitors, 15, "trp_swadian_sergeant", 2),
(set_visitors, 16, "trp_swadian_sergeant", 2),
(set_visitors, 17, "trp_swadian_sergeant", 2),
(set_visitors, 18, "trp_swadian_militia", 2),
(set_visitors, 19, "trp_swadian_sergeant", 2),
(set_visitors, 20, "trp_swadian_militia", 2),
(set_visitors, 21, "trp_swadian_sergeant", 2),
(set_visitors, 22, "trp_swadian_sergeant", 2),
(set_visitors, 23, "trp_swadian_crossbowman", 2),
(set_visitors, 29, "trp_of_chileno", 1),
(set_visitors, 3, "trp_swadian_merchant", 1),
(set_visitors, 10, "trp_real_delima", 10),
(set_visitors, 11, "trp_vaegir_footman", 10),
(set_visitors, 12, "trp_vaegir_skirmisher", 10),
(set_visitors, 24, "trp_vaegir_skirmisher", 8),
(set_visitors, 2, "trp_real_delima", 9),
(set_visitors, 4, "trp_vaegir_footman", 10),
(set_visitors, 5, "trp_vaegir_footman", 5),
(set_visitors, 6, "trp_vaegir_footman", 5),
(set_visitors, 7, "trp_estandarte_vp", 2),
(set_visitors, 30, "trp_of_realista", 1),
(set_visitors, 28, "trp_vaegir_merchant", 1),
(try_begin),
(this_or_next|eq,"$evento",1),
(eq,"$evento",3),
(set_jump_mission,"mt_historical_battle"),
(jump_to_scene, "$town_scene3"),
(change_screen_mission),
(else_try),
(set_jump_mission,"mt_historical_battle2"),
(jump_to_scene, "$town_scene3"),
(change_screen_mission),
(try_end),
(finish_mission),
(jump_to_menu,"mnu_historical_battle3"),
]),
################ Rancagua #################################
("batalla_rancagua", mnf_disable_all_keys,
"historical battle: Rancagua disaster!",
"none",[(set_background_mesh, "mesh_pic_rancagua")],
[
("entrar_bh1",[],"Yes I want to participate as a Patriot soldier",
[(assign, "$evento", 1),
(assign, "$g_desarrollo_bt", "str_batalla_rancagua"),# texto antes de la batalla
(assign, "$g_battle_consequences", "str_fin_rancagua"),# Texto fin batalla (consecuencias)
(jump_to_menu, "mnu_historical_battle2"),
]),
("entrar_bh2",[],"Yes I want to participate as a soldier of the Spanish crown",
[ (assign, "$evento", 2),
(assign, "$g_desarrollo_bt", "str_batalla_rancagua"),# texto antes de la batalla
(assign, "$g_battle_consequences", "str_fin_rancagua"),# Texto fin batalla (consecuencias)
(jump_to_menu, "mnu_historical_battle2"),
]),
("salir_bh",[], "Leave",
[(change_screen_map),
]),
]),
########### Cancha Rayada #############
("batalla_cancharayada", mnf_disable_all_keys,
"historical battle: Cancha Rayada surprise!",
"none",[(set_background_mesh, "mesh_pic_cancharayada")],
[
("entrar_bh1",[],"Yes I want to participate as a Patriot soldier",
[ (assign, "$evento", 3),
(assign, "$g_desarrollo_bt", "str_batalla_cancharayada"),# texto antes de la batalla
(assign, "$g_battle_consequences", "str_fin_cancharayada"),# Texto fin batalla (consecuencias)
(jump_to_menu, "mnu_historical_battle2"),
]),
("entrar_bh2",[],"Yes I want to participate as a soldier of the Spanish crown",
[ (assign, "$evento", 4),
(assign, "$g_desarrollo_bt", "str_batalla_cancharayada"),# texto antes de la batalla
(assign, "$g_battle_consequences", "str_fin_cancharayada"),# Texto fin batalla (consecuencias)
(jump_to_menu, "mnu_historical_battle2"),
]),
("salir_bh",[], "Leave",
[(change_screen_map),
]),
]),
############
("historical_battle2",mnf_disable_all_keys,
"{!}{s16}",
"none",
[(str_store_string, s16, "$g_desarrollo_bt")],# texto antes de la batalla
[
("continue",[], "Continue...",
[
(try_begin),
(eq,"$evento",1),
(assign,"$town_scene3", "scn_toma_de_talca"),
(call_script, "script_historical_battle_escene"),
(else_try),
(eq,"$evento",2),
(assign,"$town_scene3", "scn_toma_de_talca2"),
(call_script, "script_historical_battle_escene"),
(else_try),
(eq,"$evento",3),
(assign,"$town_scene3", "scn_cancharayada"),
(call_script, "script_historical_battle_escene"),
(else_try),
(eq,"$evento",4),
(assign,"$town_scene3", "scn_cancharayada2"),
(call_script, "script_historical_battle_escene"),
(try_end),
# (jump_to_menu,"mnu_historical_battle3")
]),
]),
("historical_battle3",mnf_disable_all_keys,
"{s11}",
"none",
[
(str_store_string, s11, "$g_battle_consequences"),# Texto fin batalla (consecuencias)
],
[("continue", [], "Continue...",
[(change_screen_map),
]),
]
),
(
"historical_battle",mtf_battle_mode,-1,
"Town Fight",
[
(0,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(2,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(3,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(4,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(5,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(6,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(7,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(8,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(9,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(10,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(11,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(12,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
(13,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(14,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(15,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(16,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(17,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(18,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(19,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(20,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(21,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(22,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(23,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), #
(24,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]), #
(25,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), #
(26,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), #
(27,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), #
(28,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]), #
(29,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(30,mtef_visitor_source|mtef_team_1,af_override_horse,0,1,[]),
],
[
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(call_script, "script_agent_reassign_team", ":agent_no"),
]),
########################################################################
(ti_before_mission_start, 0, 0, [],
[
(team_set_relation, 0, 2, 1),
(team_set_relation, 1, 3, 1),
(call_script, "script_place_player_banner_near_inventory_bms"),
(party_clear, "p_routed_enemies"),
(assign, "$g_latest_order_1", 1),
(assign, "$g_latest_order_2", 1),
(assign, "$g_latest_order_3", 1),
(assign, "$g_latest_order_4", 1),
]),
###########################################################
(0, 0, ti_once, [], [(start_presentation, "prsnt_killcount")]),
(0, 0, ti_once, [
(try_for_range, ":cur_group", 0, grc_infantry),
(team_give_order, "$defender_team", ":cur_group", mordr_stand_ground),
(team_give_order, "$defender_team_2", ":cur_group", mordr_stand_ground),
(try_end),
(try_for_range, ":cur_group", 0, grc_archers),
(team_give_order, "$defender_team", ":cur_group", mordr_stand_ground),
(team_give_order, "$defender_team_2", ":cur_group", mordr_stand_ground),
(try_end),
], []),
# common_battle_tab_press,
common_battle_init_banner,
common_battle_order_panel,
common_battle_order_panel_tick,
AI_kick,
##########################################################
(ti_on_agent_killed_or_wounded, 0, 0, [],
[
(store_trigger_param_1, ":dead_agent_no"),
(store_trigger_param_2, ":killer_agent_no"),
(store_trigger_param_3, ":is_wounded"),
(try_begin),
(ge, ":dead_agent_no", 0),
(neg|agent_is_ally, ":dead_agent_no"),
(agent_is_human, ":dead_agent_no"),
(agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
(party_add_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), #addition_to_p_total_enemy_casualties
(eq, ":is_wounded", 1),
(party_wound_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1),
(try_end),
(call_script, "script_apply_death_effect_on_courage_scores", ":dead_agent_no", ":killer_agent_no"),
]),
#######################################################
(ti_question_answered, 0, 0, [],
[(store_trigger_param_1,":answer"),
(eq,":answer",0),
(assign, "$pin_player_fallen", 0),
(try_begin),
(store_mission_timer_a, ":elapsed_time"),
(gt, ":elapsed_time", 20),
(str_store_string, s5, "str_retreat"),
(call_script, "script_simulate_retreat", 10, 20, 1),
(try_end),
(call_script, "script_count_mission_casualties_from_agents"),
(finish_mission,0),]),
#####################################################
common_music_situation_update,
common_battle_check_friendly_kills,
common_battle_check_victory_condition,
common_battle_victory_display,
common_battle_inventory,
########################################################
(1, 4, ti_once,
[
(main_hero_fallen),
(assign, ":pteam_alive", 0),
(try_for_agents, ":agent"), #Check players team is dead
(neq, ":pteam_alive", 1), #Break loop
(agent_is_ally, ":agent"),
(agent_is_alive, ":agent"),
(assign, ":pteam_alive", 1),
(try_end),
(eq, ":pteam_alive", 0),
],
[
(assign, "$pin_player_fallen", 1),
(change_screen_return),
# (display_message, "@Press TAB to end the battle."),
]),
]
),
with(change_screen_return),
at the end of the module mission templates.(jump_to_menu,"mnu_historical_battle3"),