OSP Kit Combat Battlefield Tactics kit. Multiple formations per team+command revamp!

Users who are viewing this thread

othr said:
How did you get around the gk_order... vs gk_order_charge key problem Idbil?  I got it to work but it'd be best if I could get it to trigger when the right keys are pressed.

You can try Motomataru code up. There are some issues with respond of units, but soon it run perfectly

@doc82nd

You are try it in Warband module system, but code that Motomataru posted is for Mount&Blade Vainilla.
I am waiting to we have final formations code for post tutorial here like impement to Warband.
 
Oh ok...
Makes sense.
Actually I got it to work a little bit when I put it into module_triggers...
But not stale enough for me to keep.
I'm excited to see this ported over to warband :smile:
 
I did something similar, I was wondering if there was a better way as this is pretty clunky.
 
othr said:
I did something similar, I was wondering if there was a better way as this is pretty clunky.

Fragile is how I see it. One thing goes wrong, and the tracking gets lost. I've actually got it working so long as I hit the function keys slowly enough to avoid what looks like simultaneous trigger fires. Idibil with the same code has nothing but trouble.

Now I've struck a fatal flaw: Warband disables ESC while the order menus are up (so as not to pull up the game options when the player backs out of the order menu). Problem is, now we can't capture when the player backs out either, killing our fragile order tracking.

Bottom line is: game_key_clicked has to return virtual values now that compound keystrokes are involved. I've given this my best shot.
 
So i'm slightly confused.
Sorry i'm a new coder so please be a bit more patient...

So there is no way to get this code to work for warband?
I'm actually slightly confused because of the fragmented posts on what code to use... I understand the key problem, but if you dont pound the keys than it should still work?
If so, do you mind breaking down installing this kit barney style for me?
 
doc82nd said:
So i'm slightly confused.
Sorry i'm a new coder so please be a bit more patient...

So there is no way to get this code to work for warband?
I'm actually slightly confused because of the fragmented posts on what code to use... I understand the key problem, but if you dont pound the keys than it should still work?
If so, do you mind breaking down installing this kit barney style for me?

To be used in Warband, the module_mission_templates triggers portion of the "kit" must be replaced. With orders in WB given through combinations of function keys, the mod code must keep track of whether the player has pressed the first or second of the function keys. This makes the code fragile, as a single failure puts the code on the "wrong foot." Moreover, Warband suspends the ESC key after the first function key, so it is impossible to tell if the player backs out of the middle of an order with ESC. So although command capture can be "pretty good," as http://www.youtube.com/watch?v=JhCwfKX0kUE shows, it ultimately cannot be done to full satisfaction. At least, not until game_key_clicked() models virtual command keys so that the player does not have to track the status of a compound keystroke. I mean, one can hardly tell the player not to use the ESC key, right?

But if you disagree, I offer what I developed below. Note that is is a "verbose" version, with debugging messages to see how well it is tracking commands on your machine. For a final version, comment out or remove the unindented display_message().

So you would use the same M&B module_scripts and module_constants code I posted June 8, but with this module_missions_templates code (see exact description of how to use this trigger set from June 8 post).

Make sense?

Code:
# Formations triggers v2 by motomataru, Warband port
# Global variables	*_formation_type holds type of formation: see "Formation modes" in module_constants
#					*_formation_move_order hold the current move order for the formation
#					*_space hold the multiplier of extra space ordered into formation by the player

formations_triggers = [
	(ti_before_mission_start, 0, 0, [], [
		(assign, "$gk_order", 0),
		(assign, "$gk_order_hold_over_there", 0),
		(assign, "$infantry_formation_type", formation_default),	#type set by first call; depends on faction
		(assign, "$archer_formation_type", formation_default),
		(assign, "$cavalry_formation_type", formation_wedge),
		(assign, "$infantry_space", 2),	#give a little extra space for ease of forming up
		(assign, "$archer_space", 2),
		(assign, "$cavalry_space", 0),
		(assign, "$min_troops_for_formation", 5),
		(assign, "$fclock", 1)
	]),

# Start troops in formation
	(ti_after_mission_start, 0, 0, [], [
		(display_message, "@Forming ranks."),
		(call_script, "script_player_attempt_formation", grc_infantry, formation_default),
		(call_script, "script_player_attempt_formation", grc_cavalry, formation_wedge),
		(call_script, "script_player_attempt_formation", grc_archers, formation_default),
		#init troops for when formation ends
		(get_player_agent_no, "$fplayer_agent_no"),
		(agent_get_team, "$fplayer_team_no", "$fplayer_agent_no"),
		(set_show_messages, 0),
		(try_for_range, ":dummy", 0, "$infantry_space"),
			(team_give_order, "$fplayer_team_no", grc_infantry, mordr_spread_out),
		(try_end),
		(try_for_range, ":dummy", 0, "$archer_space"),
			(team_give_order, "$fplayer_team_no", grc_archers, mordr_spread_out),
		(try_end),
		(try_for_range, ":dummy", 0, "$cavalry_space"),
			(team_give_order, "$fplayer_team_no", grc_cavalry, mordr_spread_out),
		(try_end),
		(set_show_messages, 1),
		(try_begin),
			(gt, ":dummy", 0),	#suppress compile warning
		(try_end),
	]),
	
#form ranks command
	(0, 0, 1, [(key_clicked, key_j)], [
		(str_store_string, s1, "@ranks"),
		(call_script, "script_player_attempt_formation", grc_infantry, formation_ranks)
	]),

#form shield wall command
	(0, 0, 1, [(key_clicked, key_k)], [
		(str_store_string, s1, "@shield wall"),
		(call_script, "script_player_attempt_formation", grc_infantry, formation_shield)
	]),

#form wedge command
	(0, 0, 1, [(key_clicked, key_l)], [
		(str_store_string, s1, "@wedge"),
		(call_script, "script_player_attempt_formation", grc_infantry, formation_wedge),
		(call_script, "script_player_attempt_formation", grc_cavalry, formation_wedge)
	]),

#form square command
	(0, 0, 1, [(key_clicked, key_semicolon)], [
		(str_store_string, s1, "@square"),
		(call_script, "script_player_attempt_formation", grc_infantry, formation_square)
	]),

#end formation command
	(0, 0, 1, [(key_clicked, key_u)], [
		(get_player_agent_no, ":player"),
		(agent_get_team, "$fplayer_team_no", ":player"),
		(try_begin),
			(neq, "$infantry_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_infantry),
			(call_script, "script_formation_end", "$fplayer_team_no", grc_infantry),
			(display_message, "@Infantry formation disassembled."),
			(assign, "$infantry_formation_type", formation_none),
		(try_end),
		(try_begin),
			(neq, "$cavalry_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
			(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
			(display_message, "@Cavalry formation disassembled."),
			(assign, "$cavalry_formation_type", formation_none),
		(try_end),
		(try_begin),
			(neq, "$archer_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_archers),
			(call_script, "script_formation_end", "$fplayer_team_no", grc_archers),
			(display_message, "@Archer starting line disassembled. Use HOLD to reform."),
			(assign, "$archer_formation_type", formation_none),
		(try_end),
	]),

	(0, .3, 0, [(game_key_clicked, gk_order_1)], [
		(eq, "$gk_order", gk_order_1),	#next trigger set MOVE menu?
		(game_key_is_down, gk_order_1),	#BUT player is holding down key?
		(assign, "$gk_order_hold_over_there", 1),
		(assign, "$gk_order", 0),
	]),

	(0, 0, 0, [(game_key_clicked, gk_order_1)], [
		(try_begin),
			(eq, "$gk_order", 0),
			(assign, "$gk_order", gk_order_1),
(display_message, "@MOVE menu"),

		(else_try),
			(try_begin),
				(eq, "$gk_order", gk_order_1),	#HOLD		
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(call_script, "script_player_attempt_formation", grc_infantry, "$infantry_formation_type"),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(call_script, "script_player_attempt_formation", grc_cavalry, "$cavalry_formation_type"),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(call_script, "script_player_attempt_formation", grc_archers, "$archer_formation_type"),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@HOLD"),
				
			(else_try),
				(eq, "$gk_order", gk_order_2),	#ADVANCE
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_infantry),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$infantry_formation_move_order", mordr_advance),
						# (team_set_order_position, "$fplayer_team_no", grc_infantry, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_infantry, pos63, 1),			
					(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
					(assign, "$infantry_formation_move_order", mordr_advance),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$cavalry_formation_move_order", mordr_advance),
						# (team_set_order_position, "$fplayer_team_no", grc_cavalry, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_cavalry, pos63, 1),
					(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
					(assign, "$cavalry_formation_move_order", mordr_advance),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_archers),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$archer_formation_move_order", mordr_advance),
						# (team_set_order_position, "$fplayer_team_no", grc_archers, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_archers, pos63, 1),
					(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
					(assign, "$archer_formation_move_order", mordr_advance),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@ADVANCE"),
			
			(else_try),
				(eq, "$gk_order", gk_order_3),	#HOLD FIRE
				(assign, "$gk_order", 0),
(display_message, "@HOLD FIRE"),
			(try_end),
		(try_end),
	]),
	
	(0, 0, 0, [(game_key_clicked, gk_order_2)], [
		(try_begin),
			(eq, "$gk_order", 0),
			(assign, "$gk_order", gk_order_2),
(display_message, "@FORMATION menu"),

		(else_try),
			(try_begin),
				(eq, "$gk_order", gk_order_1),	#FOLLOW
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_infantry),
					(assign, "$infantry_formation_move_order", mordr_follow),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
					(assign, "$cavalry_formation_move_order", mordr_follow),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_archers),
					(assign, "$archer_formation_move_order", mordr_follow),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@FOLLOW"),
				
			(else_try),
				(eq, "$gk_order", gk_order_2),	#FALL BACK
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_infantry),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$infantry_formation_move_order", mordr_fall_back),
						# (team_set_order_position, "$fplayer_team_no", grc_infantry, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_infantry, pos63, -1),
					(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
					(assign, "$infantry_formation_move_order", mordr_fall_back),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$cavalry_formation_move_order", mordr_fall_back),
						# (team_set_order_position, "$fplayer_team_no", grc_cavalry, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_cavalry, pos63, -1),
					(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
					(assign, "$cavalry_formation_move_order", mordr_fall_back),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_archers),
					(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
					(try_begin),	#on change of orders cancel order position
						(neq, "$archer_formation_move_order", mordr_fall_back),
						# (team_set_order_position, "$fplayer_team_no", grc_archers, pos63),
						(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
					(try_end),
					(call_script, "script_formation_move_position", "$fplayer_team_no", grc_archers, pos63, -1),
					(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
					(assign, "$archer_formation_move_order", mordr_fall_back),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@FALL BACK"),
						
			(else_try),
				(eq, "$gk_order", gk_order_3),	#FIRE AT WILL
				(assign, "$gk_order", 0),
(display_message, "@FIRE AT WILL"),
			(try_end),
		(try_end),
	]),
	
	(0, 0, 0, [(game_key_clicked, gk_order_3)], [
		(try_begin),
			(eq, "$gk_order", 0),
			(assign, "$gk_order", gk_order_3),
(display_message, "@WEAPON menu"),

		(else_try),
			(try_begin),
				(eq, "$gk_order", gk_order_1),	#CHARGE
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_infantry),
					(call_script, "script_formation_end", "$fplayer_team_no", grc_infantry),
					(display_message, "@Infantry formation disassembled."),
					(assign, "$infantry_formation_type", formation_none),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
					(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
					(display_message, "@Cavalry formation disassembled."),
					(assign, "$cavalry_formation_type", formation_none),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_archers),
					(call_script, "script_formation_end", "$fplayer_team_no", grc_archers),
					(display_message, "@Archer starting line disassembled. Use HOLD to reform."),
					(assign, "$archer_formation_type", formation_none),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@CHARGE"),
				
			(else_try),
				(eq, "$gk_order", gk_order_2),	#SPREAD OUT
				(try_begin),
					(neq, "$infantry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_infantry),
					(val_add, "$infantry_space", 1),
		#			(team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
					(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
					(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
				(try_end),
				(try_begin),
					(neq, "$cavalry_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
					(val_add, "$cavalry_space", 1),
		#			(team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
					(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
					(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
				(try_end),
				(try_begin),
					(neq, "$archer_formation_type", formation_none),
					(class_is_listening_order, "$fplayer_team_no", grc_archers),
					(val_add, "$archer_space", 1),
		#			(team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
					(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
					(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
				(try_end),
				(assign, "$gk_order", 0),
(display_message, "@SPREAD OUT"),
			
			(else_try),
				(eq, "$gk_order", gk_order_3),	#BLUNT WEAPONS
				(assign, "$gk_order", 0),
(display_message, "@BLUNT WEAPONS"),
			(try_end),
		(try_end),
	]),
	
	(0, 0, 0, [(game_key_clicked, gk_order_4)], [
		(try_begin),
			(eq, "$gk_order", gk_order_1),	#STAND GROUND
			(try_begin),
				(neq, "$infantry_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_infantry),
				(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_infantry, "$fplayer_agent_no", "$infantry_formation_type"),
				(copy_position, pos1, pos63),
				(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
				(call_script, "script_set_formation_position", "$fplayer_team_no", grc_infantry, pos63),
			(try_end),
			(try_begin),
				(neq, "$cavalry_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
				(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_cavalry, "$fplayer_agent_no", "$cavalry_formation_type"),
				(copy_position, pos1, pos63),
				(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
				(call_script, "script_set_formation_position", "$fplayer_team_no", grc_cavalry, pos63),
			(try_end),
			(try_begin),
				(neq, "$archer_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_archers),
				(call_script, "script_formation_current_position", pos63, "$fplayer_team_no", grc_archers, "$fplayer_agent_no", "$archer_formation_type"),
				(copy_position, pos1, pos63),
				(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
				(call_script, "script_set_formation_position", "$fplayer_team_no", grc_archers, pos63),
			(try_end),			
			(assign, "$gk_order", 0),
(display_message, "@STAND GROUND"),

		(else_try),
			(eq, "$gk_order", gk_order_2),	#STAND CLOSER
			(try_begin),
				(neq, "$infantry_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_infantry),
				(gt, "$infantry_space", 0),
				(val_sub, "$infantry_space", 1),
	#			(team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
				(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
			(try_end),
			(try_begin),
				(neq, "$cavalry_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
				(gt, "$cavalry_space", 0),
				(val_sub, "$cavalry_space", 1),
	#			(team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
				(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
			(try_end),
			(try_begin),
				(neq, "$archer_formation_type", formation_none),
				(class_is_listening_order, "$fplayer_team_no", grc_archers),
				(gt, "$archer_space", 0),
				(val_sub, "$archer_space", 1),
	#			(team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
				(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
			(try_end),
			(assign, "$gk_order", 0),
(display_message, "@STAND CLOSER"),
		
		(else_try),
			(eq, "$gk_order", gk_order_3),	#ANY WEAPON
			(assign, "$gk_order", 0),
(display_message, "@ANY WEAPON"),
		(try_end),
	]),
	
	(0, 0, 0, [(game_key_clicked, gk_order_5)], [
		(try_begin),
			(eq, "$gk_order", gk_order_1),	#RETREAT
			(assign, "$gk_order", 0),
(display_message, "@RETREAT"),
		(else_try),
			(eq, "$gk_order", gk_order_2),	#MOUNT
			(assign, "$gk_order", 0),
(display_message, "@MOUNT"),
		(try_end),
	]),
	
	(0, 0, 0, [(game_key_clicked, gk_order_6)], [
		(eq, "$gk_order", gk_order_2),	#DISMOUNT
		(try_begin),
			(neq, "$cavalry_formation_type", formation_none),
			(get_player_agent_no, ":player"),
			(agent_get_team, "$fplayer_team_no", ":player"),
			(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
			(call_script, "script_formation_end", "$fplayer_team_no", grc_cavalry),
			(display_message, "@Cavalry formation disassembled."),
			(assign, "$cavalry_formation_type", formation_none),
		(try_end),
		(assign, "$gk_order", 0),
(display_message, "@DISMOUNT"),
	]),

	(0, 0, 0, [
		(this_or_next|key_clicked, key_1),
		(this_or_next|key_clicked, key_2),
		(this_or_next|key_clicked, key_3),
		(this_or_next|key_clicked, key_4),
		(this_or_next|key_clicked, key_5),
		(this_or_next|key_clicked, key_6),
		(this_or_next|key_clicked, key_7),
		(this_or_next|key_clicked, key_8),
		(this_or_next|key_clicked, key_9),
		(this_or_next|key_clicked, key_0),
		(key_clicked, key_escape)	#doesn't work because ESC is omitted during command selection
	], [
(display_message, "@Back out of menu"),
		(assign, "$gk_order", 0)
	]),

#implement HOLD OVER THERE when player lets go of key
	(.5, 0, 0, [(eq, "$gk_order_hold_over_there", 1),(neg|game_key_is_down, gk_order_1)], [
		(agent_get_position, pos49, "$fplayer_agent_no"),
		(try_begin),
			(neq, "$infantry_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_infantry),
			(team_get_order_position, pos61, "$fplayer_team_no", grc_infantry),
			(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
			(call_script, "script_point_y_toward_position", pos61, pos60),
			(agent_set_position, "$fplayer_agent_no", pos61),	#fake out script_cf_formation
			(try_begin),	#ignore script failure
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_infantry, "$infantry_space", "$infantry_formation_type"),
			(try_end),
			(assign, "$infantry_formation_move_order", mordr_hold),
		(try_end),
		(try_begin),
			(neq, "$cavalry_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_cavalry),
			(team_get_order_position, pos61, "$fplayer_team_no", grc_cavalry),
			(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
			(call_script, "script_point_y_toward_position", pos61, pos60),
			(agent_set_position, "$fplayer_agent_no", pos61),	#fake out script_cf_formation
			(try_begin),	#ignore script failure
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_cavalry, "$cavalry_space", "$cavalry_formation_type"),
			(try_end),
			(assign, "$cavalry_formation_move_order", mordr_hold),
		(try_end),
		(try_begin),
			(neq, "$archer_formation_type", formation_none),
			(class_is_listening_order, "$fplayer_team_no", grc_archers),
			(team_get_order_position, pos61, "$fplayer_team_no", grc_archers),
			(call_script, "script_team_get_average_position_of_enemies_augmented", pos60, "$fplayer_team_no", grc_everyone),
			(call_script, "script_point_y_toward_position", pos61, pos60),
			(agent_set_position, "$fplayer_agent_no", pos61),	#fake out script_cf_formation
			(try_begin),	#ignore script failure
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_archers, "$archer_space", "$archer_formation_type"),
			(try_end),
			(assign, "$archer_formation_move_order", mordr_hold),
		(try_end),
		(agent_set_position, "$fplayer_agent_no", pos49),
(display_message, "@HOLD OVER THERE"),
		(assign, "$gk_order_hold_over_there", 0)
	]),

	(1, 0, 0, [	#attempt to avoid simultaneous formations function calls
		(neg|key_clicked, key_j),
		(neg|key_clicked, key_k),
		(neg|key_clicked, key_l),
		(neg|key_clicked, key_semicolon),
		(neg|key_clicked, key_u),
		(neg|game_key_clicked, gk_order_1),
		(neg|game_key_clicked, gk_order_2),
		(neg|game_key_clicked, gk_order_3),
		(neg|game_key_clicked, gk_order_4),
		(neg|game_key_clicked, gk_order_5),
		(neg|game_key_clicked, gk_order_6)
	  ], [
		(store_mod, ":fifth_second", "$fclock", 5),
		(try_begin),
			(neq, "$infantry_formation_type", formation_none),
			(try_begin),
				(eq, "$infantry_formation_move_order", mordr_follow),
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_infantry, "$infantry_space", "$infantry_formation_type"),
			(else_try),	#periodically reform
				(eq, ":fifth_second", 0),
#				(team_get_order_position, pos1, "$fplayer_team_no", grc_infantry),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_infantry),
				(call_script, "script_form_infantry", "$fplayer_team_no", "$fplayer_agent_no", "$infantry_space", "$infantry_formation_type"),
			(try_end),
		(try_end),
		(try_begin),
			(neq, "$cavalry_formation_type", formation_none),
			(try_begin),
				(eq, "$cavalry_formation_move_order", mordr_follow),
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_cavalry, "$cavalry_space", "$cavalry_formation_type"),
			(else_try),	#periodically reform
				(eq, ":fifth_second", 0),
#				(team_get_order_position, pos1, "$fplayer_team_no", grc_cavalry),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_cavalry),
				(call_script, "script_form_cavalry", "$fplayer_team_no", "$fplayer_agent_no", "$cavalry_space"),
			(try_end),
		(try_end),
		(try_begin),
			(neq, "$archer_formation_type", formation_none),
			(try_begin),
				(eq, "$archer_formation_move_order", mordr_follow),
				(call_script, "script_cf_formation", "$fplayer_team_no", grc_archers, "$archer_space", "$archer_formation_type"),
			(else_try),	#periodically reform
				(eq, ":fifth_second", 0),
#				(team_get_order_position, pos1, "$fplayer_team_no", grc_archers),
				(call_script, "script_get_formation_position", pos1, "$fplayer_team_no", grc_archers),
				(call_script, "script_form_archers", "$fplayer_team_no", "$fplayer_agent_no", "$archer_space"),
			(try_end),
		(try_end),
		(val_add, "$fclock", 1),
	]),

]
#end formations triggers
 
Alright, the good news is I got formations applied to order panel. The bad news is that to do so I had to scoop all the formations orders functionality into a single utility script. Unless someone really needs it immediately, I think I'll just put the new revision through the paces for now.
 
motomataru said:
Alright, the good news is I got formations applied to order panel. The bad news is that to do so I had to scoop all the formations orders functionality into a single utility script. Unless someone really needs it immediately, I think I'll just put the new revision through the paces for now.
Sorry it took so long for me to get back to you. I was able to get it all to work, had to port everything to the new module system and then followed your instructions and it worked wonderfully :smile:
I'd love for the code that makes it work in the order panel :smile:
Its working awesome! I would love to include this in AOCvII.
 
OK, so the order panel necessitated a rewrite of the triggers, so the full kit (again) is the following. I'm attempting to use dropbox.com to limit the amount of text I post here.


Formations v3, M&B

README
http://dl.dropbox.com/u/8432316/Formations%20v3/README.txt

module_constants unchanged from last version
http://dl.dropbox.com/u/8432316/Formations%20v3/module_constants.py

module_mission_templates overhauled from last version
http://dl.dropbox.com/u/8432316/Formations%20v3/module_mission_templates.py

module_scripts new script
http://dl.dropbox.com/u/8432316/Formations%20v3/module_scripts.py

module_scripts application to native AI unchanged
http://dl.dropbox.com/u/8432316/Formations%20v3/module_scripts_MB_AI_formations.py

module_scripts added line to script_team_give_order_from_order_panel
http://dl.dropbox.com/u/8432316/Formations%20v3/team_give_order_from_panel.py

module_presentations section added to "battle" presentation
http://dl.dropbox.com/u/8432316/Formations%20v3/module_presentations.py



Formations v3, Warband port (below are only change files from M&B section)

README
http://dl.dropbox.com/u/8432316/Formations%20v3%20WB/README.txt

module_mission_templates overhauled from last version
http://dl.dropbox.com/u/8432316/Formations%20v3%20WB/module_mission_templates_wb.py

module_scripts new script
http://dl.dropbox.com/u/8432316/Formations%20v3%20WB/module_scripts.py

module_scripts added line to script_team_give_order_from_order_panel
http://dl.dropbox.com/u/8432316/Formations%20v3%20WB/team_give_order_from_panel.py

module_presentations section added to "battle" presentation
http://dl.dropbox.com/u/8432316/Formations%20v3%20WB/module_presentations.py

Let me know of any issues. Suddenly I'm juggling lots of versions... :razz:
 
Awesome :smile:

One question!
When you order your Calvary to charge, i get a message saying formation disassembled.
Is that suppose to happen? Or did I miss something
 
doc82nd said:
Awesome :smile:

One question!
When you order your Calvary to charge, i get a message saying formation disassembled.
Is that suppose to happen? Or did I miss something

Aha! You didn't read the Readme, did you? :smile:

When I was first considering what formations ought to do, I ruled out charging. See http://forums.taleworlds.com/index.php/topic,34685.msg2530709.html#msg2530709

However, if the formation is far enough away from the enemy, it maintains it's approximate shape when charging, though for cavalry you may need to get everyone moving with an initial Advance. Or you can string together multiple advances, though this works only to get to the average position of the enemy. Or you can use the order panel to send a formation to or through a certain point, or even better (in WB) the hold-F1 "Hold Over There" function.
 
motomataru said:
doc82nd said:
Awesome :smile:

One question!
When you order your Calvary to charge, i get a message saying formation disassembled.
Is that suppose to happen? Or did I miss something

Aha! You didn't read the Readme, did you? :smile:

When I was first considering what formations ought to do, I ruled out charging. See http://forums.taleworlds.com/index.php/topic,34685.msg2530709.html#msg2530709

However, if the formation is far enough away from the enemy, it maintains it's approximate shape when charging, though for cavalry you may need to get everyone moving with an initial Advance. Or you can string together multiple advances, though this works only to get to the average position of the enemy. Or you can use the order panel to send a formation to or through a certain point, or even better (in WB) the hold-F1 "Hold Over There" function.
I remember now! Yeah it totally makes sense, and after going back and playing it... I actually like it beter this way. It works great though :smile: And i suppos ethe only reason you really need formatons is during the advance or holding out against a charging force... Great work man :smile: It's in the beta for AOC II and it is going to be there for teh release. Thank you for teh awesome code
 
doc82nd said:
I remember now! Yeah it totally makes sense, and after going back and playing it... I actually like it beter this way. It works great though :smile: And i suppos ethe only reason you really need formatons is during the advance or holding out against a charging force... Great work man :smile: It's in the beta for AOC II and it is going to be there for teh release. Thank you for teh awesome code

Thanks, man.

In other news, a couple small changes today. I've added a couple lines to triggers and scripts to handle the new retreat function new as of 1.125. This necessitated branching the WB version of the formation scripts out from M&B ones.

Also fixed native AI use of formations (backporting WB 1.125 into M&B -- works great). Now the AI formations will advance with their leaders.
 
Great work :smile: Looking forward to the next batch of features.
This really is awesome, and the AOC guys are loving it. So thank you again :smile:
 
I have tried to implement your code to Warband and followed all of your steps, but when compiling, I get the following error:
mordr_retreat is not defined

What is wrong and how can I fix it?
 
Bismarck said:
I have tried to implement your code to Warband and followed all of your steps, but when compiling, I get the following error:
mordr_retreat is not defined

What is wrong and how can I fix it?

I don't know. mordr_retreat is defined on line 41 of header_mission_templates, which is included by both files in which I reference it: module_mission_templates and module_scripts. My guess is that you've put the code in the wrong place or that you're using M&B module system or that you've misspelled mordr (like I've done).
 
There was no mordr_retreat in header_mission_templates.py, so I've added it and now it works fine. Thanks for your help!
 
Hi,

for start i'm sorry for my bad english and this stupid question.

But i'm must ask :

Where we copy your script ? Where is directory for copy your script in the Mount&Blade/ ?

Thank you :smile:
 
Asuran said:
Hi,

for start i'm sorry for my bad english and this stupid question.

But i'm must ask :

Where we copy your script ? Where is directory for copy your script in the Mount&Blade/ ?

Thank you :smile:

See the appropriate README file in my June 24 post .

Most of my code files are named after the mod files that my code needs to be copied to. A few are named after specific scripts.

I assume you've already obtained and learned to use the module system from Taleworlds downloads. http://forums.taleworlds.com/index.php/board,64.0.html

Did I answer your questions?

 
Hum okay,

i'm sorry but i'm news in this forum and in M&B world.

Thank's for you answers, i understand now
 
Back
Top Bottom