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

正在查看此主题的用户

King Yngvar 说:
Thank you LCJr, I think I did what you meant. Did not work at first but I tried doing it to the mission templates as well.
Got a new message now in the build module, I'll test in game now :wink:

This is what you should see when compiling.

For where the mission template data goes look at Markus II's post on page 2.
 
Regarding the red text displaying after you win a battle:  It appears that the code in module_mission_templates is trying to run after all enemy agents are killed/knocked out.  The text does not appear when you lose a battle as there are still enemy agents alive.  I'm in the process of rewriting some of the mission_template code for BoW:X so I'll keep you up to date on my progress of resolving this...


NC
 
LCJr and I have resolved the script errors and have rewritten large chunks of this formations script.  We will post our modified scripts after we test it for a bit...


NC
 
AI Formations Script - Modified
by: LCJr and NCrawler

Here is the culmination of our efforts to improve the original AI portion of these scripts.  They seem to work fine and the 'red text' display error has been fixed.  We are in no way trying to steal Mirathei's thunder but just wanted to improve and expand upon his original ideas.


Add the following to header_operations.py above the line lhs_operations = [try_for_range,
Note: these are Winters modified operations, which I use extensively:
插入代码块:
party_is_dead = neg|party_is_active						# (party_is_dead,<party_id>),

## slot_lt operations. These check whether the value of a slot is less than a given value.
troop_slot_lt = neg|troop_slot_ge						# (troop_slot_lt,<troop_id>,<slot_no>,<value>),
party_slot_lt = neg|party_slot_ge						# (party_slot_lt,<party_id>,<slot_no>,<value>),
faction_slot_lt = neg|faction_slot_ge					# (faction_slot_lt,<faction_id>,<slot_no>,<value>),
scene_slot_lt = neg|scene_slot_ge						# (scene_slot_lt,<scene_id>,<slot_no>,<value>),
party_template_slot_lt = neg|party_template_slot_ge		# (party_template_slot_lt,<party_template_id>,<slot_no>,<value>),
agent_slot_lt = neg|agent_slot_ge						# (agent_slot_lt,<agent_id>,<slot_no>,<value>),
quest_slot_lt = neg|quest_slot_ge						# (quest_slot_lt,<quest_id>,<slot_no>,<value>),

num_active_teams_gt = neg|num_active_teams_le			# (num_active_teams_gt,<value>),

main_hero_alive = neg|main_hero_fallen					# (main_hero_alive),

agent_is_down = neg|agent_is_alive						# (agent_is_down,<agent_id>),
agent_is_horse = neg|agent_is_human						# (agent_is_horse,<agent_id>),
agent_is_enemy = neg|agent_is_ally						# (agent_is_enemy,<agent_id>),
agent_is_attacker = neg|agent_is_defender				# (agent_is_attacker,<agent_id>),


Add the following to module_mission_templates.py in the lead_charge template:
插入代码块:
                         (10,
				0,
				0,
				[
					(neq,"$battle_won",1),
						(try_for_agents,":agent"),
							(agent_is_human,":agent"),
							(agent_is_alive,":agent"),
							(agent_is_enemy,":agent"),
							(assign,reg5,":agent"),
						(try_end),
				],
				[
					(agent_get_team,":team",reg5),
					(team_get_leader,":leader",":team"),
					(agent_get_class,":class",":leader"),
					(call_script,"script_formation_end",":team",":class")
				]
			),
			
			(0.2,
				0,
				0,
				[
					(neq,"$battle_won",1),
						(try_for_agents,":agent"),
							(agent_is_human,":agent"),
							(agent_is_alive,":agent"),
							(agent_is_enemy,":agent"),
							(assign,reg5,":agent"),
						(try_end),
				],
				[
					(agent_get_team,":team",reg5),
					(team_get_leader,":leader",":team"),
					(agent_get_class,":class",":leader"),
					(store_random_in_range,":random",1,101),
						(try_begin),
							(this_or_next|eq,":class",grc_infantry),
							(eq,":class",grc_archers),
								(try_begin),
									(is_between,":random",1,21), #20% chance for 'Line Abreast' formation
									(call_script,"script_formation_line_abreast",":team",":class"),
								(else_try),
									(is_between,":random",21,41), #20% chance for 'Stagger' formation
									(call_script,"script_formation_stagger",":team",":class"),
								(else_try),
									(is_between,":random",41,61), #20% chance for 'Open Line' formation
									(call_script,"script_formation_open_line",":team",":class"),
								(else_try),
									(is_between,":random",61,100), #40% chance for 'Line' formation
									(call_script,"script_formation_line",":team",":class"),
								(try_end),
						(else_try),
							(eq,":class",grc_cavalry),
								(try_begin),
									(is_between,":random",1,21), #20% chance for 'Line Abreast' formation
									(call_script,"script_formation_line_abreast",":team",":class"),
								(else_try),
									(is_between,":random",21,41), #20% chance for 'Line' formation
									(call_script,"script_formation_line",":team",":class"),
								(else_try),
									(is_between,":random",41,61), #20% chance for 'Stagger' formation
									(call_script,"script_formation_stagger",":team",":class"),
								(else_try),
									(is_between,":random",61,100), #40% chance for 'Wedge' formation
									(call_script,"script_formation_wedge",":team",":class"),
								(try_end),
						(try_end),
				]
			),


Add the following to module_scripts.py (I put mine at the bottom):
插入代码块:
      ("formation_line",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
			(team_get_leader,":leader",":formation_team"),
			(agent_get_position,1,":leader"),
			(assign,":column",1),
			(position_move_x,1,-300),
				(try_for_agents,":agent"),
					(neq,":agent",":leader"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),
					(agent_set_scripted_destination,":agent",1),
					(position_move_x,1,100),
						(try_begin),
							(eq,":column",10),
							(position_move_x,1,-10*100),
							(position_move_y,1,-100),
							(assign,":column",1),
						(else_try),
							(val_add,":column",1),
						(try_end),
				(try_end),
		]
	),
	
	("formation_open_line",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
			(team_get_leader,":leader",":formation_team"),
			(agent_get_position,1,":leader"),
			(assign,":column",1),
			(position_move_x,1,-300),
				(try_for_agents,":agent"),
					(neq,":agent",":leader"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),
					(agent_set_scripted_destination,":agent",1),
					(position_move_x,1,200),
						(try_begin),
							(eq,":column",10),
							(position_move_x,1,-10*200),
							(position_move_y,1,-200),
							(assign,":column",1),
						(else_try),
							(val_add,":column",1),
						(try_end),
				(try_end),
		]
	),
	
	("formation_line_abreast",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
			(team_get_leader,":leader",":formation_team"),
			(agent_get_position,1,":leader"),
			(assign,":column",1),
			(position_move_x,1,-300),
				(try_for_agents,":agent"),
					(neq,":agent",":leader"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),
					(agent_set_scripted_destination,":agent",1),
					(position_move_x,1,150),
						(try_begin),
							(eq,":column",20),
							(position_move_x,1,-20*150),
							(position_move_y,1,-150),
							(assign,":column",1),
						(else_try),
							(val_add,":column",1),
						(try_end),
				(try_end),
		]
	),
	
	("formation_stagger",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
			(team_get_leader,":leader",":formation_team"),
			(agent_get_position,1,":leader"),
			(position_move_x,1,100),
			(assign,":move_y",-100),
				(try_for_agents,":agent"),
					(neq,":agent",":leader"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),
					(agent_set_scripted_destination,":agent",1),
					(position_move_x,1,100),
					(position_move_y,1,":move_y"),
					(val_mul,":move_y",-1),
				(try_end),
		]
	),
	
	("formation_wedge",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
			(team_get_leader,":leader",":formation_team"),
			(agent_get_position,1,":leader"),
			(assign,":column",1),
			(assign,":nc",3),
			(position_move_x,1,-150),
				(try_for_agents,":agent"),
					(neq,":agent",":leader"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),
					(agent_set_scripted_destination,":agent",1),
						(try_begin),
							(eq,":column",":nc"),
							(val_mul,":nc",-150),
							(position_move_x,1,":nc"),
							(position_move_y,1,-300),
							(assign,":column",1),
							(val_div,":nc",-150),
							(val_add,":nc",2),
						(else_try),
							(position_move_x,1,150),
							(val_add,":column",1),
						(try_end),
				(try_end),
		]
	),
	
	("formation_end",
		[
			(store_script_param,":formation_team",1),
			(store_script_param,":formation_class",2),
				(try_for_agents,":agent"),
					(agent_is_alive,":agent"),
					(agent_is_human,":agent"),
					(agent_get_team,":team",":agent"),
					(eq,":team",":formation_team"),
					(agent_get_class,":class",":agent"),
					(eq,":class",":formation_class"),  
					(agent_clear_scripted_mode,":agent"),
				(try_end),
		]
	),


We did not include the player's use of formations as we feel that the player does not need any more advantages against the rather stupid AI.  If enough interest is shown, I will modify the original scripts to get them in line with these.  Hope you find these as useful as we did.


NC
 
Some (n00b) questions:
Do I have to overwrite mirathei's formations? and add this from scratch? or add it after them? because I can't see some stuff, like key bindings, which leads me to the next question:

We did not include the player's use of formations as we feel that the player does not need any more advantages against the rather stupid AI.  If enough interest is shown, I will modify the original scripts to get them in line with these.  Hope you find these as useful as we did.
So the player can't use formations now? because that was the best part of this thing.

Sorry if the questions are dumb, I just want to be sure of everything before porting it.
 
Nice.  I have an idea I am going to try and incorporate in my mod.  I am going to try and have the enemy form into multiple formations made up of the same type of troops.  So all of the Knight Errants will form into a lance(wedge) formation and then all of the Knights of the Realm will form into their own, all of the men-at-arms would form into their own formation as well, etc.  I'll also try and incorporate that into the player's troops as well.  The idea is that you leave the leader of the unit free to act on its own so that its actions are not set.  If I can get this to work as I want it, it will allow the player to command his different units (based on the infantry, cav, archer commands already in game) to charge, hold, follow, etc.  If I can get it to work, I may try to implement a moral system that if certain things happen, the formation is disassembled (and if I can get that to work, perhaps run towards the edge of the battlefield).  I've only been messing around with Mirathei's script, so it might take awhile before I am able to get this to work.
 
D'Sparil 说:
Some (n00b) questions:
Do I have to overwrite mirathei's formations? and add this from scratch? or add it after them? because I can't see some stuff, like key bindings, which leads me to the next question:

We did not include the player's use of formations as we feel that the player does not need any more advantages against the rather stupid AI.  If enough interest is shown, I will modify the original scripts to get them in line with these.  Hope you find these as useful as we did.
So the player can't use formations now? because that was the best part of this thing.

Sorry if the questions are dumb, I just want to be sure of everything before porting it.

To use what we have modified, you would indeed have to overwrite (the ai portion anyways) Mirathei's original script.  This modification is for those, like us, that think the player already has a big enough advantage.  The player will not be using formations, only the AI.  For those that want to keep the original scripts, but want to get rid of the annoying 'red text' error, just look at how I broke down the triggers in the conditions/consequences blocks...


NC

Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...
 
NCrawler 说:
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

You got my interest.
 
Player formation is definitely essential for Legions Extended.

I have made the game balance to where such units that would make the most of formations would be penalized in one way or another to offset any critical advantages the player would get.

I am with D'Sparil on this one, and you have got our attention.
 
Beginning of multiple formations:

The group on the left are swadian footmen, the group on the right are swadian infantry.  These are just the troops I am testing it out on.  In my mod, I will make it so men-at-arms and yeoman wardens form into the same formation.  Right now I only have 1 troop type forming together.

multipleformations.jpg


Ive only been working on this for a little bit, and its now 3am here and its getting hard to think straight.  I still have a ton to do.  Ill work on it more tomorrow.
 
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

Consider my interest shown NCrawler.

I'm currently wrestling with the issue of including formations in my mod 867 A.D.

An improved AI along with player access to formations (and no red-text) would go a long way to a thumbs up for formations in the mod.
 
Im sorry but i dont know how to use the formation kit...  :oops:
Can someone fully explain it?
Or are there any links where its explained?

Thx
 
ok...
i have pasted in the right script c:/program files/mount & blade/modlues/band of warriors/source/modulle_mission_templates
now when i enter battle i pres B(cause i have ranger only)but nothin happens :neutral:
So i tried I but then it say you cant open your infentory blablalba....
Can any 1 help?
Or make a tutorial?
 
1. Stop double posting.  Use the modify button.

2. All the information you need is already contained in this thread.
 
D'Sparil 说:
NCrawler 说:
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

You got my interest.

Seconded.

Markus II 说:
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

Consider my interest shown NCrawler.

I'm currently wrestling with the issue of including formations in my mod 867 A.D.

An improved AI along with player access to formations (and no red-text) would go a long way to a thumbs up for formations in the mod.

Hear hear.


grailknighthero 说:
Beginning of multiple formations:

The group on the left are swadian footmen, the group on the right are swadian infantry.  These are just the troops I am testing it out on.  In my mod, I will make it so men-at-arms and yeoman wardens form into the same formation.  Right now I only have 1 troop type forming together.

http://i283.photobucket.com/albums/kk320/grailknighthero/multipleformations.jpg

Ive only been working on this for a little bit, and its now 3am here and its getting hard to think straight.  I still have a ton to do.  Ill work on it more tomorrow.

Looking good, if you get stuck anvertise this more widely, there's many a mod maker that would jump at a chance to use this script (myself included, but this is way out of my range).
 
LCJr 说:
1. Stop double posting.  Use the modify button.

2. All the information you need is already contained in this thread.
sorry im new around here... :oops:
but i just donr get it  :cry:
 
Ealdormann Hussey 说:
D'Sparil 说:
NCrawler 说:
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

You got my interest.

Seconded.

Markus II 说:
Edit: Oh yeah, and like I said above, if enough interest is shown, I will go ahead and modify the player formations and incorporate them into this modfication.  As it stands now though, I have no desire to do so as I am only using the AI formations in my mods...

Consider my interest shown NCrawler.

I'm currently wrestling with the issue of including formations in my mod 867 A.D.

An improved AI along with player access to formations (and no red-text) would go a long way to a thumbs up for formations in the mod.

Hear hear.


grailknighthero 说:
Beginning of multiple formations:

The group on the left are swadian footmen, the group on the right are swadian infantry.  These are just the troops I am testing it out on.  In my mod, I will make it so men-at-arms and yeoman wardens form into the same formation.  Right now I only have 1 troop type forming together.

http://i283.photobucket.com/albums/kk320/grailknighthero/multipleformations.jpg

Ive only been working on this for a little bit, and its now 3am here and its getting hard to think straight.  I still have a ton to do.  Ill work on it more tomorrow.

Looking good, if you get stuck anvertise this more widely, there's many a mod maker that would jump at a chance to use this script (myself included, but this is way out of my range).

I got stuck :/  Only because if you add every troop including cav there is a huge pileup around the general withing the first few seconds and when cav get stuck they dismount, so it was a huge problem.  I tried to modify the general ai to fix it, but it only made things worse.  The code for it was extremely complicated (although it didnt cause any lag).
 
Damn. So no way of dividing skirmishers from line... No way of applying it just for infantry or archers as in your screenshot?
 
No, I think it is definitely possible, but it would require a revamp of the ai tactics in module scripts, and possibly more entry points for each side, instead of having each team spawn from 1 entry point.  I currently dont have time to mess with this, as I only have about 3 weeks left in the semester.  I was so close, the main thing that was getting in the way was the native tactics.
 
后退
顶部 底部