OSP Code Combat Deployable Pavise Shield (Multiplayer 6/6/2010)

Users who are viewing this thread

Cartread

Sergeant at Arms
Works for Warband 1.125

Updated 6/6/2010: multiplayer version below & at download

Updated 6/5/2010: single-player destructible version (at download)

Updated 6/2/2010: single-player deployable, collapsible version (at download)

Problem: you're at a big disadvantage against bowmen as a crossbowman, because you need cover to reload!

pavise_ss.jpg


Solution: http://www.youtube.com/watch?v=Olnq32yEmZQ

If you have the pavise equipped and hit g, the scene prop is set in front of you.
If you hit h and are near the prop, it changes back to an item. (1st version only)
As many pavise items there are, a prop is set.

Use in any mods you like, but send me a message so I can see what's happening with it!

Download: https://sites.google.com/site/cartread/mount-blade
Comments, suggestions for improvement welcome.

Multiplayer Deployable, destructible version:
For the multiplayer version to work, you have to place (in Edit mode) pavise scene props at z position -100 (far underground).
However many pavise scene props you place there, that is the limit for the players.
mission_temp:
Code:
      #pavise
      (0, 0, 0, [],
       [
        (try_for_agents, ":cur_agent"),
        
            (agent_is_human, ":cur_agent"),         
            (agent_is_alive, ":cur_agent"),  
            (agent_get_position, pos2, ":cur_agent"),
            #==click g && has pavise
            (try_begin),

                (agent_get_wielded_item, ":shield_item", ":cur_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),
                (clear_omitted_keys),
            
                (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),

                (assign, ":pav_found", 0),#pf
                #FOR # props if prop at LATENT spot
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (eq, ":pav_found", 0),#pf
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (position_get_z, ":z_coor", pos3),
                    (eq, ":z_coor", -100*100),#-100 LATENT spot

                    (prop_instance_set_position, ":scene_prop_id", pos2),#pavise move
                    (agent_unequip_item, ":cur_agent", "itm_pavise"),
                    (assign, ":pav_found", 1),#pf
                (try_end),
            (try_end),#click g
        (try_end),#for agents
        ]),#0,0,0 pavise
item:
Code:
["pavise", "Pavise Shield",   [("pavise_wep" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,  
488 , weight(6.6)|hit_points(660)|body_armor(16)|spd_rtng(60)|shield_width(57)|shield_height(132),imodbits_shield ],
scene_props:
Code:
  ("pavise",sokf_moveable|sokf_destructible,"pavise_prop","bo_pavise", [
    #check_castle_door_use_trigger,

   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
     
   (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
      
      (assign, ":rotate_side", 86),
      
      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),      
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
      
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
      
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        #(assign, reg0, ":z_difference"),
        #(display_message, "@{!}z dif : {reg0}"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),       
  
    (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),       
      (store_trigger_param_2, ":damage"),
      
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),      
    ]),
  ]),

Single-player Deployable, destructible version:
mission_temp:
Code:
      #pavise
      (0, 0, 0, 
        [],
        [
            (get_player_agent_no, ":player_agent"),
            (agent_get_position, pos2, ":player_agent"),
            (try_begin),

                (agent_get_wielded_item, ":shield_item", ":player_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),

                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),
                (spawn_scene_prop, "spr_pavise"),#pavise spawn
                (agent_unequip_item, ":player_agent", "itm_pavise"),
            (try_end),
        ]),#0,0,0 pavise
item:
Code:
["pavise", "Pavise Shield",   [("pavise_wep" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,  
488 , weight(6.6)|hit_points(660)|body_armor(16)|spd_rtng(60)|shield_width(57)|shield_height(132),imodbits_shield ],
scene_props:
Code:
  ("pavise",sokf_moveable|sokf_destructible,"pavise_prop","bo_pavise", [
    #check_castle_door_use_trigger,

   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
     
   (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),
      
      (assign, ":rotate_side", 86),
      
      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),      
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),
      
        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),
      
        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        #(assign, reg0, ":z_difference"),
        #(display_message, "@{!}z dif : {reg0}"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),       
  
    (ti_on_scene_prop_hit,
    [
      (store_trigger_param_1, ":instance_no"),       
      (store_trigger_param_2, ":damage"),
      
      (try_begin),
        (scene_prop_get_hit_points, ":hit_points", ":instance_no"),
        (val_sub, ":hit_points", ":damage"),
        (gt, ":hit_points", 0),
        (play_sound, "snd_dummy_hit"),
      (else_try),
        (neg|multiplayer_is_server),
        (play_sound, "snd_dummy_destroyed"),
      (try_end),

      (try_begin),
        (this_or_next|multiplayer_is_server),
		(neg|game_in_multiplayer_mode),

        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        (particle_system_burst, "psys_dummy_straw", pos1, 10),
      (try_end),      
    ]),
  ]),

Single-player Deployable, collapsible, indestructible version:
mission_temp:
Code:
      #pavise
      (0, 0, 0, 
        [],
        [

            (get_player_agent_no, ":player_agent"),
            (agent_get_position, pos2, ":player_agent"),
            #==click g && has pavise
            (try_begin),
                #(agent_has_item_equipped, ":player_agent", "itm_pavise"),
                (agent_get_wielded_item, ":shield_item", ":player_agent", 1),
                (eq, ":shield_item", "itm_pavise"),
                (key_clicked, key_g),
                (clear_omitted_keys),
            
                (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
                (position_move_y, pos2, 50),
                (set_spawn_position, pos2),

                (assign, ":pav_found", 0),#pf
                #FOR # props if prop at LATENT spot
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (eq, ":pav_found", 0),#pf
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (position_get_z, ":z_coor", pos3),
                    (eq, ":z_coor", -100*100),#-100 LATENT spot

                    (prop_instance_set_position, ":scene_prop_id", pos2),#pavise move
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                    (assign, ":pav_found", 1),#pf
                (try_end),

                (try_begin),
                    (lt, ":pav_found", 1),#pf

                    (spawn_scene_prop, "spr_pavise"),#pavise spawn
                    (get_player_agent_no, ":player_agent"),
                    (agent_unequip_item, ":player_agent", "itm_pavise"),
                (try_end),
            (try_end),

            (scene_prop_get_num_instances, ":num_props", "spr_pavise"),
            #==click h && near proped pavise
            (try_begin),
                (key_clicked, key_h),
                (clear_omitted_keys),
                #FOR # props if prop close to player
                (try_for_range, ":prop_no", 0, ":num_props"),
                    (scene_prop_get_instance, ":scene_prop_id", "spr_pavise", ":prop_no"),
                    (prop_instance_get_position, pos3, ":scene_prop_id"), #pos3 holds position of current prop
                    (get_distance_between_positions, ":player_distance", pos2, pos3),
                    (le, ":player_distance", 100),

                    (position_set_z, pos3, -100*100),#-100 LATENT spot
                    (prop_instance_set_position, ":scene_prop_id", pos3),#pavise move

                    (set_spawn_position, pos2),
                    (position_move_y, pos2, 50),
                    (spawn_item, "itm_pavise"),#pavise spawn
                (try_end),
                #(scene_prop_set_visibility, ":scene_prop_id", 0),
                #(init_position, pos1),
            (try_end),

        ]),#0,0,0 pavise
item:
Code:
["pavise", "Pavise Shield",   [("pavise_wep" ,0)], itp_merchandise|itp_type_shield|itp_cant_use_on_horseback|itp_wooden_parry, itcf_carry_board_shield,  
488 , weight(6.6)|hit_points(660)|body_armor(16)|spd_rtng(60)|shield_width(57)|shield_height(132),imodbits_shield ],
scene_prop:
Code:
("pavise",sokf_moveable,"pavise_prop","bo_pavise",[]),
 
wawawa...


HOLY ****.

I thought you were some random 'why hasn't anyone made this yet'- type of whiner, but instead, you must be one of the gods of modding, come to Earth in Mortal form to bless us thusly.

[me=FrisianDude]takes deep bow.[/me]
 
Thanks guys.
Bots can't use it for now.  That's a whole nother can of worms.
Giving them the order to deploy wouldn't be too hard to implement, I think.  As enemies..I guess they would deploy after within a certain range and then stay still.
 
very nice!

Especially in singleplayer this would be great :razz:. But I think people will 'abuse' it in Multiplayer, when for example people hide in a little barn with a whole team they will prob go mass spam with these shields on the door.
 
Ooh ooh ooh! Then the other team only needs a battering ram! HEAVE HO! *BASH* :grin:

Anyway, this is a really cool addition. Could it somehow be linked to an order you give to your troops? Archers! Deplooooy Shields!
 
Brilliant! I'm so getting this!

Cartread said:
Thanks guys.
Bots can't use it for now.  That's a whole nother can of worms.
Giving them the order to deploy wouldn't be too hard to implement, I think.  As enemies..I guess they would deploy after within a certain range and then stay still.
That would be hella awesome.  :grin:

FrisianDude said:
That's not abuse, that's tactics!
Indeed! I can just imagine some awesome scenarios. It would force the attackers to get some strategy on their side.  :grin:

If it could be destroyed with a few melee hits, it would be perfect.
 
I'm not a M&B modder, but was tinkering a while in other games. I think that implementing drop shields commands would be really easy. Although making the bots actually use them efficiently not.

Cartread, is it destroyable?
 
They're certainly destroyable when held in hand, though board shields have a lot of hitpoints. Perhaps best for me to lower those a bit. I hope the props are destroyable as well.
 
Back
Top Bottom