maw said:anyone of you talents feel challenged to do a formation that places ranged weapon troop behind a defensive line of melee troops? maw
André de Cuyne said:only farmers, watchmen and townsmen.
Sheep_Archer said:How would checking which weapon an agent is currently using help?
Open the file module_scripts.py and put the script before the last bracket (']'). Save and compile the module. Check here for more info about the Module System.Rathyr said:
(0.5, 0, 0, [],
[
(get_player_agent_no, ":player_agent_no"),
(entry_point_get_position,1,11),(entry_point_get_position,5,15),
(entry_point_get_position,2,12),(entry_point_get_position,6,16),
(entry_point_get_position,3,13),(entry_point_get_position,7,17),
(entry_point_get_position,4,14),(entry_point_get_position,8,1,
(entry_point_get_position,9,19),
(try_for_agents,":agents"),
(neq, ":agents", ":player_agent_no"),
(agent_is_alive, ":agents"),
(agent_is_human, ":agents"),
(neg|agent_is_defender, ":agents"),
(agent_get_slot, ":agent_destination", ":agents", 1),
(str_store_agent_name,40,":agents"),
(assign,reg(40),":agent_destination"),
# (display_message, "str_debug_string_1"),
(agent_get_position, 35, ":agents"),
(try_begin),
(eq, ":agent_destination", 0),
(try_begin),
(agent_set_scripted_destination, ":agents", 1),
(agent_set_slot,":agents",1,1),
(assign,":agent_destination",1),
(try_end),
(else_try),
(eq,":agent_destination",1),
(try_begin),
(get_distance_between_positions,":current_destination",35,1),
(lt,":current_destination", 200),
(agent_set_scripted_destination, ":agents", 2),
(agent_set_slot,":agents",1,2),
(assign,":agent_destination",2),
(try_end),
(else_try),
(eq,":agent_destination",2),
(try_begin),
(get_distance_between_positions,":current_destination",35,2),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 3),
(agent_set_slot,":agents",1,3),
(assign,":agent_destination",3),
(try_end),
(else_try),
(eq,":agent_destination",3),
(try_begin),
(get_distance_between_positions,":current_destination",35,3),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 4),
(agent_set_slot,":agents",1,4),
(assign,":agent_destination",4),
(try_end),
(else_try),
(eq,":agent_destination",4),
(try_begin),
(get_distance_between_positions,":current_destination",35,4),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 5),
(agent_set_slot,":agents",1,5),
(assign,":agent_destination",5),
(try_end),
(else_try),
(eq,":agent_destination",5),
(try_begin),
(get_distance_between_positions,":current_destination",35,5),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 6),
(agent_set_slot,":agents",1,6),
(assign,":agent_destination",6),
(try_end),
(else_try),
(eq,":agent_destination",6),
(try_begin),
(get_distance_between_positions,":current_destination",35,6),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 7),
(agent_set_slot,":agents",1,7),
(assign,":agent_destination",7),
(try_end),
(else_try),
(eq,":agent_destination",7),
(try_begin),
(get_distance_between_positions,":current_destination",35,7),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", ,
(agent_set_slot,":agents",1,,
(assign,":agent_destination",,
(try_end),
(else_try),
(eq,":agent_destination",,
(try_begin),
(get_distance_between_positions,":current_destination",35,,
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(try_end),
(else_try),
(eq,":agent_destination",9),
(try_begin),
(get_distance_between_positions,":current_destination",35,9),
(lt,":current_destination", 300),
(agent_clear_scripted_mode, ":agents"),
(agent_set_slot,":agents",1,10),#with agent slot 10 you can check which agents are already clear of scripts, and you could call new scripts on them
(try_end),
(try_end),
(try_end),
(0.5, 0, 0, [],
[
(get_player_agent_no, ":player_agent_no"),
(entry_point_get_position,1,11),(entry_point_get_position,5,15),
(entry_point_get_position,2,12),(entry_point_get_position,6,16),
(entry_point_get_position,3,13),(entry_point_get_position,7,17),
(entry_point_get_position,4,14),(entry_point_get_position,8,1,
(entry_point_get_position,9,19),
(try_for_agents,":agents"),
(neq, ":agents", ":player_agent_no"),
(agent_is_alive, ":agents"),
(agent_is_human, ":agents"),
(neg|agent_is_defender, ":agents"),
(agent_get_slot, ":agent_destination", ":agents", 1),
(str_store_agent_name,40,":agents"),
(assign,reg(40),":agent_destination"),
# (display_message, "str_debug_string_1"),
(agent_get_position, 35, ":agents"),
(try_begin),
(eq, ":agent_destination", 0),
(try_begin),
(agent_set_scripted_destination, ":agents", 1),
(agent_set_slot,":agents",1,1),
(assign,":agent_destination",1),
(try_end),
(else_try),
(eq,":agent_destination",1),
(try_begin),
(get_distance_between_positions,":current_destination",35,1),
(lt,":current_destination", 200),
(agent_set_scripted_destination, ":agents", 2),
(agent_set_slot,":agents",1,2),
(assign,":agent_destination",2),
(try_end),
(else_try),
(eq,":agent_destination",2),
(try_begin),
(get_distance_between_positions,":current_destination",35,2),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 3),
(agent_set_slot,":agents",1,3),
(assign,":agent_destination",3),
(try_end),
(else_try),
(eq,":agent_destination",3),
(try_begin),
(get_distance_between_positions,":current_destination",35,3),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 4),
(agent_set_slot,":agents",1,4),
(assign,":agent_destination",4),
(try_end),
(else_try),
(eq,":agent_destination",4),
(try_begin),
(get_distance_between_positions,":current_destination",35,4),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 5),
(agent_set_slot,":agents",1,5),
(assign,":agent_destination",5),
(try_end),
(else_try),
(eq,":agent_destination",5),
(try_begin),
(get_distance_between_positions,":current_destination",35,5),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 6),
(agent_set_slot,":agents",1,6),
(assign,":agent_destination",6),
(try_end),
(else_try),
(eq,":agent_destination",6),
(try_begin),
(get_distance_between_positions,":current_destination",35,6),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 7),
(agent_set_slot,":agents",1,7),
(assign,":agent_destination",7),
(try_end),
(else_try),
(eq,":agent_destination",7),
(try_begin),
(get_distance_between_positions,":current_destination",35,7),
(lt,":current_destination", 100),
(try_begin),
(neq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", ,
(agent_set_slot,":agents",1,,
(assign,":agent_destination",,
(else_try),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(try_end),
(try_end),
(else_try),
(eq,":agent_destination",,
(try_begin),
(get_distance_between_positions,":current_destination",35,,
(lt,":current_destination", 100),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(assign,"$front_tower_reached",1),
(else_try),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(try_end),
(else_try),
(eq,":agent_destination",9),
(try_begin),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,10),
(try_end),
(else_try),
(eq,":agent_destination",10),
(try_begin),
(get_distance_between_positions,":current_destination",35,10),
(lt,":current_destination", 300),
(agent_clear_scripted_mode, ":agents"),
(agent_set_slot,":agents",1,11),
(try_end),
(try_end),
(try_end),
]),
(10, 30, 0, [(eq,"$front_tower_reached",1)],
[(assign, "$lower_ramp",1)]),
(
"castle_attack_walls2",mtf_battle_mode,-1,
"You attack the walls of the castle...",
[
(0,mtef_attackers,af_override_horse,aif_start_alarmed,1,[]),
(0,mtef_attackers,af_override_horse,aif_start_alarmed,4,[]),
(8,mtef_defenders,af_override_horse,aif_start_alarmed,2,[]),
(9,mtef_defenders,af_override_horse,aif_start_alarmed,2,[]),
(10,mtef_defenders,af_override_horse|af_override_weapons|af_override_head,2,[itm_practice_bow2,itm_arrows,itm_sword,itm_shield_round_e]),
],
[
(ti_tab_pressed, 0, 0, [],
[
(try_begin),
(eq, "$battle_won", 1),
(finish_mission,0),
(else_try),
(call_script, "script_check_enemies_nearby"),
(question_box,"str_do_you_want_to_retreat"),
(else_try),
(display_message,"str_can_not_retreat"),
(try_end),
]),
(ti_question_answered, 0, 0, [],
[(store_trigger_param_1,":answer"),(eq,":answer",0),(finish_mission,0),]),
(0, 0, ti_once, [], [(assign,"$battle_won",0),(assign,"$enemy_reinforcement_stage",0),(assign,"$friend_reinforcement_stage",0)]),
(1, 60, ti_once, [(store_mission_timer_a,reg(1)),(ge,reg(1),10),(all_enemies_defeated,2),(neg|main_hero_fallen,0),(set_mission_result,1),(display_message,"str_msg_battle_won"),(assign,"$battle_won",1),(assign, "$g_battle_result", 1)],
[(finish_mission,1)]),
(10, 0, 0, [], [(eq,"$battle_won",1),(display_message,"str_msg_battle_won")]),
(1, 4, ti_once, [(main_hero_fallen,0)],
[(set_mission_result,-1),(finish_mission,1)]),
#Lead attackers climb the ramps over to the walls
# We assume:
# entry_point 1 = start of first ramp
# entry_point 2 = end of first ramp
# entry_point 3 = start of second ramp
# entry_point 4 = end of second ramp
(0.5, 0, 0, [],
[
(get_player_agent_no, ":player_agent_no"),
(entry_point_get_position,1,11),(entry_point_get_position,5,15),
(entry_point_get_position,2,12),(entry_point_get_position,6,16),
(entry_point_get_position,3,13),(entry_point_get_position,7,17),
(entry_point_get_position,4,14),(entry_point_get_position,8,18),
(entry_point_get_position,9,19),
(try_for_agents,":agents"),
(neq, ":agents", ":player_agent_no"),
(agent_is_alive, ":agents"),
(agent_is_human, ":agents"),
(neg|agent_is_defender, ":agents"),
(agent_get_slot, ":agent_destination", ":agents", 1),
(str_store_agent_name,40,":agents"),
(assign,reg(40),":agent_destination"),
# (display_message, "str_debug_string_1"),
(agent_get_position, 35, ":agents"),
(try_begin),
(eq, ":agent_destination", 0),
(try_begin),
(agent_set_scripted_destination, ":agents", 1),
(agent_set_slot,":agents",1,1),
(assign,":agent_destination",1),
(try_end),
(else_try),
(eq,":agent_destination",1),
(try_begin),
(get_distance_between_positions,":current_destination",35,1),
(lt,":current_destination", 200),
(agent_set_scripted_destination, ":agents", 2),
(agent_set_slot,":agents",1,2),
(assign,":agent_destination",2),
(try_end),
(else_try),
(eq,":agent_destination",2),
(try_begin),
(get_distance_between_positions,":current_destination",35,2),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 3),
(agent_set_slot,":agents",1,3),
(assign,":agent_destination",3),
(try_end),
(else_try),
(eq,":agent_destination",3),
(try_begin),
(get_distance_between_positions,":current_destination",35,3),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 4),
(agent_set_slot,":agents",1,4),
(assign,":agent_destination",4),
(try_end),
(else_try),
(eq,":agent_destination",4),
(try_begin),
(get_distance_between_positions,":current_destination",35,4),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 5),
(agent_set_slot,":agents",1,5),
(assign,":agent_destination",5),
(try_end),
(else_try),
(eq,":agent_destination",5),
(try_begin),
(get_distance_between_positions,":current_destination",35,5),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 6),
(agent_set_slot,":agents",1,6),
(assign,":agent_destination",6),
(try_end),
(else_try),
(eq,":agent_destination",6),
(try_begin),
(get_distance_between_positions,":current_destination",35,6),
(lt,":current_destination", 100),
(agent_set_scripted_destination, ":agents", 7),
(agent_set_slot,":agents",1,7),
(assign,":agent_destination",7),
(try_end),
(else_try),
(eq,":agent_destination",7),
(try_begin),
(get_distance_between_positions,":current_destination",35,7),
(lt,":current_destination", 100),
(try_begin),
(neq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 8),
(agent_set_slot,":agents",1,8),
(assign,":agent_destination",8),
(else_try),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(try_end),
(try_end),
(else_try),
(eq,":agent_destination",8),
(try_begin),
(get_distance_between_positions,":current_destination",35,8),
(lt,":current_destination", 100),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(assign,"$front_tower_reached",1),
(else_try),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,9),
(assign,":agent_destination",9),
(try_end),
(else_try),
(eq,":agent_destination",9),
(try_begin),
(eq, "$lower_ramp",1),
(agent_set_scripted_destination, ":agents", 9),
(agent_set_slot,":agents",1,10),
(try_end),
(else_try),
(eq,":agent_destination",10),
(try_begin),
(get_distance_between_positions,":current_destination",35,10),
(lt,":current_destination", 300),
(agent_clear_scripted_mode, ":agents"),
(agent_set_slot,":agents",1,11),
(try_end),
(try_end),
(try_end),
]),
(10, 30, 0, [(eq,"$front_tower_reached",1)],
[(assign, "$lower_ramp",1)]),
(ti_inventory_key_pressed, 0, 0, [],
[
(try_begin),
(eq,"$ramp",0),
(assign,"$ramp",1),
(call_script,"script_ramp"),
(else_try),
(eq,"$ramp",1),
(assign,"$ramp",0),
(call_script,"script_ramp2"),
(try_end),
]),
],
),
Ah, you copied the didn't you? You should quote first because there's a smiley in the code.DarkAnd said:Raz it gave me a sintax error
tuple index out of range
and i don't use m&b dev because mi firewall blocks but i think this aren't the error