OSP Code Combat Shield Bash (OSP)

defiller

Regular
Best answers
0
:shock: it seems that i dont have a constant.py and animation.py in my module folder, need help! where do i put it then? :cry: i am currently using m&b warband v1.132
 

Kaesar

Recruit
Best answers
0
Happy Christmas
If someone can help me.
I have added it in the game.It looks fun.but ai does not do it.
I find this here :
Also you need to define the variables $sp_shield_bash and $sp_shield_bash_ai to 1 if you want the triggers to activate. Put this into the game_start script:
(assign, "$sp_shield_bash", 1),
(assign, "$sp_shield_bash_ai", 1),
I don't know the definite place where to put in.
Could someone help me?
thanks in advance
 

Waylander

Veteran
Best answers
0
Kaesar said:
Happy Christmas
If someone can help me.
I have added it in the game.It looks fun.but ai does not do it.
I find this here :
Also you need to define the variables $sp_shield_bash and $sp_shield_bash_ai to 1 if you want the triggers to activate. Put this into the game_start script:
(assign, "$sp_shield_bash", 1),
(assign, "$sp_shield_bash_ai", 1),
I don't know the definite place where to put in.
Could someone help me?
thanks in advance
You place it in the module_scripts.py at the top

Code:
#script_game_start:
  # This script is called when a new game is started
  # INPUT: none
  ("game_start",
   [
      (assign, "$sp_shield_bash", 1),
      (assign, "$sp_shield_bash_ai", 1),
 

Specialist

Master Knight
WB
Best answers
0
Where do I put the code in mission_templates? At the top above everything else? Or at every battle trigger?  :???:

Kind of confused...
 

Caba`drin

Count
M&BWBWF&SNWVC
Best answers
0
Specialist said:
Where do I put the code in mission_templates? At the top above everything else? Or at every battle trigger?  :???:
Put it toward the top, by the other "common_" triggers. Or, put it right after the pilgrim outfit is defined.

Then, in each template that you want shield bash active (such as "lead_charge") add the line
common_shield_bash,

with other "common_TRIGGERNAME_HERE," lines.
 

Specialist

Master Knight
WB
Best answers
0
Caba`drin said:
Specialist said:
Where do I put the code in mission_templates? At the top above everything else? Or at every battle trigger?  :???:
Put it toward the top, by the other "common_" triggers. Or, put it right after the pilgrim outfit is defined.

Then, in each template that you want shield bash active (such as "lead_charge") add the line
common_shield_bash,

with other "common_TRIGGERNAME_HERE," lines.
Thanks Caba! That answered my question
 

Guacamolez

Recruit
Best answers
0
Hi im kinda new at this i got a question: do you have to download an animation for this? or do you just have to add the scripts??
 

Caba`drin

Count
M&BWBWF&SNWVC
Best answers
0
Guacamolez said:
Hi im kinda new at this i got a question: do you have to download an animation for this? or do you just have to add the scripts??
Just add to the scripts in this case. It takes frames from existing animations.
 

Guacamolez

Recruit
Best answers
0
Caba`drin said:
Guacamolez said:
Hi im kinda new at this i got a question: do you have to download an animation for this? or do you just have to add the scripts??
Just add to the scripts in this case. It takes frames from existing animations.
for the module_scripts one can you just paste it anywhere in there?
 

narandill

Regular
Best answers
0
Can anyone help me in implementation this code to the 1.143 multiplayer mod?

I placed everything in correct places, but script dsn't work. No animation or anything....
 

Seek n Destroy

Marquis
WBWF&S
Best answers
0
Specialist, in the first post you will see:

MP version of the script, by Sinisterius.  I haven't tested this.

EDIT.
Updated to latest version.
Code:
mp_shield_bash = (
    0, 0, 0,
	[
	    (game_key_is_down, gk_defend),
		(game_key_clicked, gk_attack),
		(game_is_in_multiplayer_mode),
	],
	[		
		(multiplayer_send_message_to_server, mp_shield_bash_server),
	])
Code:
#Server/client events.
#Copy-paste this stuff right after the store_script_params in game_receive_network_message.
(try_begin),
    (eq, ":event_type", mp_shield_bash_server),
	
	#Get sender data & max players.
	(player_is_active, ":player_no"),
	(player_get_agent_id, ":agent_no", ":player_no"),
	(agent_is_active, ":agent_no"),
	(get_max_players, ":max_players"),
	
	#Check if the sender is in the correct condition.
	(agent_get_wielded_item, ":shield", ":agent_no", 1), #Offhand item.
	(is_between, ":shield", "itm_wooden_shield", "itm_steel_shield_herald03"),
	(agent_get_defend_action, ":action", ":agent_no"),
	(eq, ":action", 2), #Blocking.
	(agent_get_animation, ":anim", ":agent_no", 0),
	(neq, ":anim", "anim_shield_bash"),
	(agent_get_horse, ":horse", ":agent_no"),
	(eq, ":horse", -1), #No horse.
	
	#If everything is correct, then set the sender agent up for bash.
	(agent_set_animation, ":agent_no", "anim_shield_bash"),
	(player_get_troop_id, ":troop_no", ":player_no"),
	(troop_get_type, ":type_no", ":troop_no"),
	(try_begin),
	    (eq, ":type", tf_male),
		(try_for_range, ":player", 0, ":max_players"),
		    (player_is_active, ":player"),
			(multiplayer_send_2_int_to_player, ":player", mp_agent_play_sound_client, ":agent_no", "snd_man_yell"),
		(try_end),
	(else_try),
	    (eq, ":type", tf_female),
		(try_for_range, ":player", 0, ":max_players"),
		    (player_is_active, ":player"),
			(multiplayer_send_2_int_to_player, ":player", mp_agent_play_sound_client, ":agent_no", "snd_woman_yell"),
		(try_end),
	(try_end),
	
	#Bash. Get the closest agent within 175cm~1.75m.
	(agent_get_position, pos1, ":agent"),
	(assign, ":minimum_distance", 400),
	(assign, ":victim", -1),
	(try_for_agents, ":suspect"),
	    (neq, ":suspect", ":agent"), #Suspect can't be our local agent.
	    (agent_is_active, ":suspect"),
	    (agent_is_alive, ":suspect"),
		(agent_is_human, ":suspect"),
		
		#Compare distances.
		(agent_get_position, pos2, ":suspect"),
		(neg|position_is_behind_position, pos2, pos1),
		(get_distance_between_positions, ":distance", pos1, pos2),
		(le, ":distance", ":minimum_distance"),
		
		#If distance is sufficient..
		(assign, ":minimum_distance", ":distance"),
		(assign, ":victim", ":suspect"),
	(try_end),
	
	#If we have the victim, aka the closest agent, then deal with him. Else, do nothing.
	(ge, ":victim", 0),
	(agent_get_horse, ":horse", ":victim"),
	(eq, ":horse", -1), #No horse.
	(try_for_range, ":player", 0, ":max_players"),
	    (player_is_active, ":player"),
		(multiplayer_send_2_int_to_player, ":player", mp_agent_play_sound_client, ":victim", "snd_wooden_hit_low_armor_high_damage"),
	(try_end),
	(agent_get_position, pos2, ":victim"),
	(position_move_y, pos2, -25),
	(position_get_distance_to_ground_level, ":distance", pos2),
	(try_begin),
	    (le, ":distance", 25),
		(agent_set_position, ":victim", pos2),
		(agent_set_animation, ":victim", "anim_shield_strike"),
	(else_try),
	    (gt, ":distance", 25),
		(agent_set_animation, ":victim", "anim_shield_strike"),
	(try_end),
(else_try),
    (neq, multiplayer_is_server),
	(try_begin),
	    (eq, ":event_type", mp_agent_play_sound_client),
		(store_script_param, ":agent", 3),
		(store_script_param, ":sound", 4),
		(agent_play_sound, ":agent", ":sound"),
	(try_end),
(try_end),
Code:
#These animations go into module_animations.py
#They MUST replace existing unused animations.

##################
##Copyright: xenoargh. ##
##################
["shield_bash", 0, amf_play|amf_priority_defend|amf_use_defend_speed|amf_client_owner_prediction,
[0.75, "defend_shield_parry_all", 1, 50, blend_in_defense], #Adjust duration for balance.  Currently at 0.75 seconds, fixed.
[0.75, "defend_shield_right", 1, 50, blend_in_defense],
[0.75, "defend_shield_left", 1, 50, blend_in_defense],
[0.75, "defend_shield_right", 1, 50, blend_in_defense],   
],
 ["shield_strike", acf_enforce_all|acf_align_with_ground, amf_priority_striked|amf_play|amf_accurate_body|amf_restart,
   [1.0, "anim_human", blow+5000, blow+5010, arf_blend_in_3|arf_make_custom_sound], 
   [1.7, "anim_human", blow+5400, blow+5453, arf_blend_in_2|arf_make_custom_sound],
   [1.44, "anim_human", blow+5400, blow+5445, arf_blend_in_2|arf_make_custom_sound],   
   ],
regards,
SnD
 

rockman4417

Regular
Best answers
0
Can whether the target is knocked down or staggered be made dependent on its strength? 

Like 1-8 str = 25% chance to merely stagger
9-17 str = 50% chance to stagger
18-26 str = 75% chance to stagger
27-35 str = 90% chance to stagger

This goes by the divisible of three rule so you can hit that milestone without having to invest more points into strength.

Also you could take the basher's strength into account somehow.  But that might get really complicated.  But this way those with lower level are more vulnerable to the bash, whereas higher levels are strong enough to withstand it.  Also when the target is parrying he should always just stagger i think.  When blocking with shield he shouldn't  be affected at all.


And another idea.  Make the basher's strength determine if and how much the bash damages it's target.

Say 1-8 str = 0 damage
9-17 str = 5 damage
18-26 str = 10 damage
27-35 str = 15 damage

This way we take the basher's strength into account and the bash does a little bit of blunt damage.  But nothing gamebreaking.  Just enough to be more realistic.


As for taking the basher's shield skill into consideration.  Lets say every 5 points put in shield lowers the bash's cooldown by 1 sec and increases damage by 3.  So again it's nothing gamebreaking and you'd having to invest 10 points in shield to get that 3 sec cooldown. 


And it would be cool to have a timer above the shield icon at the bottom of the screen that starts at 5(or 4 or 3) as soon as you bash and counts down to 0.  So you know exactly when it's up again.

No idea if any of this is possible but it sure would be awesome!  :mrgreen: