OSP Code Combat Shield Bash kit. Bug fixed and expanded!

Users who are viewing this thread

Vilhjalmr said:
OK, so I tried this, Maw, and this is what happened:


i'm so pissed that you didn't even mention how you fixed this because i am having the EXACT same errors after using maw's setup. :razz:
 
I had the same error using maw's setup. Uninstalled it, installed original one, and it works fine. Well... almost. I had one problem:

Can anyone tell me why the try for range is:

(try_for_range,":shield","itm_wooden_shield","itm_heraldic_mail_with_surcoat"),

??? Is there a practicular reason for that "itm_heraldic_mail_with_surcoat"?

Bashing didn't work for me, when I used that range. I had noticed that "itm_heraldic_mail_with_surcoat" is located higher in module_items than "itm_wooden_shield", so I changed it to:

  (try_for_range,":shield","itm_wooden_shield","itm_jarid"),

and shield bashing finally started working.
I'm not much of a scripter and I have no idea why the try range in original script was set from item located lower to item located higher. Can somebody explain this to me?
 
The shield bash script was created for .960, and the items were in a different order back then. 

[edit]  Something you can alternately do it put shields_begin and shields_end rather than the actual item names and that will work just as well.
 
I have a slight problem.

So I believe I installed everything correctly, I used maw's method for mission template par, and changed the surcoat to jarid (and vice versa).

I'm having problems getting it to work actually. (I do know how to use it because of other mods which have it.)

Any ideas?
 
i should have specified that slawomir's fix worked with the original scripts, not maw's revision, which i believe to be inherently flawed in some way. try using the original method and see if that works.
 
has anybody gotten maw's concept to work?  I'd love to implement it this way, but I get the same errors compiling my code that others are getting.....

also, does it matter what animations I paste over?  Right now I have just commented out "unused_human_anim_95" to "unused_human_anim_100" and pasted the new animations below that.  I assume there is a limit to the number of animations and this is why we have to do this?

Edit2: maws method compiles better if I remove the comma after shield_bash_kit but. I still get. Typeerror error. Getting closer...
 
Alright, here's my own implementation of maw's idea. It's not exactly what he had working for (I'm guessing) .960, but it still removes a large footprint, especially if you drop shield bash into every single scenario like I do.

Insert the following into module_mission_templates.py -- directly above tournament triggers = [

Code:
#shield bash
shield_bash_kit_1 = (

    ti_before_mission_start, 0, 0, [], [(assign,"$bash_readiness",0)])

shield_bash_kit_2 = (

    0.1, 0, 0, [], [(val_add,"$bash_readiness",1),])

shield_bash_kit_3 = (

    0, 0, 0, [(game_key_is_down, gk_defend),(game_key_clicked, gk_attack),],
       [(assign,":continue",0),
        (get_player_agent_no,":player"),
        (agent_is_alive,":player"),
        (try_for_range,":shield","itm_wooden_shield","itm_jarid"),
            (agent_has_item_equipped,":player",":shield"),
            (assign,":continue",1),
        (end_try),
        (eq,":continue",1),
        (agent_get_horse,":horse",":player"),
        (neg|gt,":horse",0),
        (ge,"$bash_readiness",10),
        (assign,"$bash_readiness",0),
        (call_script,"script_cf_agent_shield_bash",":player"),
        ])

shield_bash_kit_4 = (

    1.0, 0, 0, [],
       [(get_player_agent_no,":player"),
        (try_for_agents,":agent"),
           (agent_is_alive,":agent"),
           (agent_is_human,":agent"),
           (neq,":agent",":player"),
           (agent_get_class ,":class", ":agent"),
           (neq,":class",grc_cavalry),
           (assign,":continue",0),
           (try_for_range,":shield","itm_wooden_shield","itm_jarid"),
               (agent_has_item_equipped,":agent",":shield"),
               (assign,":continue",1),
           (end_try),
           (eq,":continue",1),
           (assign,":chances",0),
           (agent_get_team,":team",":agent"),
           (agent_get_position,pos1,":agent"),
           (try_for_agents,":other"),
                (agent_is_alive,":other"),
                (agent_is_human,":other"),
                (agent_get_class ,":class", ":other"),
                (neq,":class",grc_cavalry),
                (agent_get_team,":otherteam",":other"),
                (neq,":team",":otherteam"),
                (agent_get_position,pos2,":other"),
                (get_distance_between_positions,":dist",pos1,pos2),
                (neg|position_is_behind_position,pos2,pos1),
                (lt,":dist",200),
                (val_add,":chances",1),
           (end_try),
           (store_agent_hit_points,":health",":agent",0),
           (val_mul,":health",-1),
           (val_add,":health",100),
           (val_div,":health",10),
           (val_mul,":chances",":health"),
           (store_random_in_range,":rand",1,25),
           (lt,":rand",":chances"),
           (call_script,"script_cf_agent_shield_bash",":agent"),
        (end_try),])

#shield bash end

And insert the following into the same file, under any mission template in which you want shield bash:

Code:
         shield_bash_kit_1,
         shield_bash_kit_2,
         shield_bash_kit_3,
         shield_bash_kit_4,

Where possible, I usually put it under any ti_before_mission_start -- though just for my own ease of use -- like so (this one is from lead_charge)

Code:
      (ti_before_mission_start, 0, 0, [],
       [
         (team_set_relation, 0, 2, 1),
         (team_set_relation, 1, 3, 1),
         (call_script, "script_place_player_banner_near_inventory_bms"),
         ]),

      shield_bash_kit_1,
      shield_bash_kit_2,
      shield_bash_kit_3,
      shield_bash_kit_4

Also, if you want it in tournaments, go to tournament triggers = [ and insert this bit:



Code:
tournament_triggers = [
  (ti_before_mission_start, 0, 0, [], [(call_script, "script_change_banners_and_chest"),
                                       (assign, "$g_arena_training_num_agents_spawned", 0)]),

   shield_bash_kit_1,
   shield_bash_kit_2,
   shield_bash_kit_3,
   shield_bash_kit_4,

  (ti_inventory_key_pressed, 0, 0, [(display_message,"str_cant_use_inventory_arena")], []),
  (ti_tab_pressed, 0, 0, [],

Well, that's all I've got. Later on, when I'm feeling less lazy (and less inebriated) I'll see if I can't work that into just one procedure, rather than 4.

Hope it works for you.

(Edits to hide my epic fail at inserting code into this forum)

 
I see a modules folder. It that where to deposit this script? Does it need its own folder? Can I use a regular text document? :eek:

I think the best way to eradicate confusion is to turn this into a working download instead of telling everyone about the script and where to install it.
 
No.

You need the module system.  It turns the gibberish of the .txt files into readable, editable information.
 
Hey guys, I understand how to use the module system, but I do not know enough about scripting to actually change this script. I was wondering if someone couldn't help me by modifying the script and giving me the otherwise native txt files?
If you could, could you set it up like this:
Can only be used every 5 seconds
Cannot be used if below 4 in shield
Enemy stunned for a second in 5-6 in shield
Enemy goes back a bit if 7-8
Enemy is knocked down if 9-10

If anyone could do this for me, I would give them full credit in my mod.


Thanks,
        Vuk
 
Just finished reading through the thread, and I like the idea of a sheild bash, but more defensive than offensive.  I like the idea of pushing back troops, but as a few have stated here it should be based on stats a bit.  I'm thinking you would need a level of skill with shields, and enough STR to move your opponent.  I like Vuk's idea of the level of skill allows a more aggressive bash, making the most effective bash only usable by masters.  I also like that you must "recharge" for 5 seconds before doing so again.  Doing something like that and moving an opponent would be considered a power move and should be reflected with a rest time.

I think the stun is a bit long though.  5 secs would be death in a 1 on  battle.  I think that:
push back should be shield skill 3-6
push back and stun shield skill 7-8
knock down and stun shield skill 9-10

I would say that in junction with the shield skill, STR would add bonuses to the distance moved and the amount of stun time.  Don't know if that is implementable...

I think it should also be used as a shield break (not breaking the shield, but more turning the shield away stopping the apponent from blocking).  if an opponent is blocking (with shield or weapon) it should, at the weakest level, push back, and stop the opponent from blocking.

Last note is defense of this manuver.  I'm guessing that the only defense is to either block or strike.  as stated above the block basically will prevent a stun/knockdown.  Since this tactic can only be used every 5 seconds, a straight out attack could be more effective.  As to the speed of the bash, it should have a delay in starting, as a build up.  This doesn't have to be visable, but should leave the attacker open to a strike.


I'm looking to start modding myself, and just getting into the module system.  Wish I had started back in 7xx.  I want to find and modify the battle morale to add renown bonuses for slaying large numbers during a battle.
my 2 cents.
 
Mirathei said:
Pretty simple really, press the attack controll while holding the defend controll. Ai will do it automatically when applicable with some degree of randomization. Got to give Zaro credit for making the results partially dependent on the shield skill of the basher.
To install, just paste the following in to module scripts:
 

("cf_agent_shield_bash",
    [(store_script_param, ":agent",1),
    (agent_get_position,pos1,":agent"),
    (agent_set_animation, ":agent", "anim_release_bash"),
    (agent_play_sound,":agent","snd_man_grunt"),
    (assign,":victim",-1),
    (try_for_agents,":possible_victim"),
        (agent_is_alive,":possible_victim"),
        (agent_is_human,":possible_victim"),
        (neq,":possible_victim",":agent"),
        (agent_get_class ,":class", ":possible_victim"),
        (neq,":class",grc_cavalry),
        (agent_get_position,pos2,":possible_victim"),
        (get_distance_between_positions,":dist",pos1,pos2),
        (lt,":dist",150),
        (neg|position_is_behind_position,pos2,pos1),
        (assign,":victim",":possible_victim"),
    (end_try),
    (gt,":victim",-1),
    (store_random_in_range,":rand",0,2),
    (store_agent_hit_points,":hp",":victim",1),
    (val_sub,":hp",":rand"),
    (store_random_in_range,":hit_reaction",1,101),
    (store_skill_level,":a_shield",skl_shield,":victim"),
    (store_skill_level,":v_shield",skl_shield,":agent"),
    (try_begin),
        (gt,":hp",0),
        (agent_set_hit_points,":victim",":hp",1),
        (agent_play_sound,":agent","snd_shield_hit_wood_wood"),
        (agent_play_sound,":victim","snd_blunt_hit"),
        (try_begin),
          (gt,":a_shield", ":v_shield"),
              (try_begin),
                (is_between,":hit_reaction",0,10),
                (agent_set_animation, ":victim", "anim_bash_unsuccessful"),
              (else_try),
                (is_between,":hit_reaction",11,20),
                (agent_set_animation, ":victim", "anim_bash_crouch"),
              (else_try),
                (is_between,":hit_reaction",21,30),
                (agent_set_animation, ":victim", "anim_bash_mini_stun"),
              (else_try),
                (is_between,":hit_reaction",21,79),
                (agent_set_animation, ":victim", "anim_bash_stun"),
              (else_try),
                (is_between,":hit_reaction",80,100),
                (agent_set_animation, ":victim", "anim_bash_knocked"),
              (end_try),  
        (else_try),
          (lt,":a_shield", ":v_shield"),
              (try_begin),
                (is_between,":hit_reaction",0,20),
                (agent_set_animation, ":victim", "anim_bash_unsuccessful"),
              (else_try),
                (is_between,":hit_reaction",21,42),
                (agent_set_animation, ":victim", "anim_bash_crouch"),
              (else_try),
                (is_between,":hit_reaction",43,65),
                (agent_set_animation, ":victim", "anim_bash_mini_stun"),
              (else_try),
                (is_between,":hit_reaction",66,92),
                (agent_set_animation, ":victim", "anim_bash_stun"),
              (else_try),
                (is_between,":hit_reaction",93,100),
                (agent_set_animation, ":victim", "anim_bash_knocked"),
              (end_try),
        (else_try),
          (eq,":a_shield", ":v_shield"),
              (try_begin),
                (is_between,":hit_reaction",0,16),
                (agent_set_animation, ":victim", "anim_bash_unsuccessful"),
              (else_try),
                (is_between,":hit_reaction",17,33),
                (agent_set_animation, ":victim", "anim_bash_crouch"),
              (else_try),
                (is_between,":hit_reaction",34,50),
                (agent_set_animation, ":victim", "anim_bash_mini_stun"),
              (else_try),
                (is_between,":hit_reaction",51,89),
                (agent_set_animation, ":victim", "anim_bash_stun"),
              (else_try),
                (is_between,":hit_reaction",90,100),
                (agent_set_animation, ":victim", "anim_bash_knocked"),
              (end_try),
        (end_try),
    (else_try),
        (agent_play_sound,":agent","snd_shield_hit_wood_wood"),
        (agent_play_sound,":victim","snd_blunt_hit"),
        (agent_deliver_damage_to_agent,":agent",":victim"),
    (end_try),
  ]),

The following into any applicable mission template:

      (ti_before_mission_start, 0, 0, [], [(assign,"$bash_readiness",0)]),


      (0.1, 0, 0, [], [(val_add,"$bash_readiness",1),]),


      (0, 0, 0, [(game_key_is_down, gk_defend),(game_key_clicked, gk_attack),],
      [(assign,":continue",0),
        (get_player_agent_no,":player"),
        (agent_is_alive,":player"),
        (try_for_range,":shield","itm_wooden_shield","itm_heraldic_mail_with_surcoat"),
            (agent_has_item_equipped,":player",":shield"),
            (assign,":continue",1),
        (end_try),
        (eq,":continue",1),
        (agent_get_horse,":horse",":player"),
        (neg|gt,":horse",0),
        (ge,"$bash_readiness",10),
        (assign,"$bash_readiness",0),
        (call_script,"script_cf_agent_shield_bash",":player"),
        ]),

      (1.0, 0, 0, [],
      [(get_player_agent_no,":player"),
        (try_for_agents,":agent"),
          (agent_is_alive,":agent"),
          (agent_is_human,":agent"),
          (neq,":agent",":player"),
          (agent_get_class ,":class", ":agent"),
          (neq,":class",grc_cavalry),
          (assign,":continue",0),
          (try_for_range,":shield","itm_wooden_shield","itm_heraldic_mail_with_surcoat"),
              (agent_has_item_equipped,":agent",":shield"),
              (assign,":continue",1),
          (end_try),
          (eq,":continue",1),
          (assign,":chances",0),
          (agent_get_team,":team",":agent"),
          (agent_get_position,pos1,":agent"),
          (try_for_agents,":eek:ther"),
                (agent_is_alive,":eek:ther"),
                (agent_is_human,":eek:ther"),
                (agent_get_class ,":class", ":eek:ther"),
                (neq,":class",grc_cavalry),
                (agent_get_team,":eek:therteam",":eek:ther"),
                (neq,":team",":eek:therteam"),
                (agent_get_position,pos2,":eek:ther"),
                (get_distance_between_positions,":dist",pos1,pos2),
                (neg|position_is_behind_position,pos2,pos1),
                (lt,":dist",200),
                (val_add,":chances",1),
          (end_try),
          (store_agent_hit_points,":health",":agent",0),
          (val_mul,":health",-1),
          (val_add,":health",100),
          (val_div,":health",10),
          (val_mul,":chances",":health"),
          (store_random_in_range,":rand",1,25),
          (lt,":rand",":chances"),
          (call_script,"script_cf_agent_shield_bash",":agent"),
        (end_try),]),
And the following into module animations (note that these must be pasted over unused animations, not at the end of the file):

# strike_fall_back_rise_after_bashed
["bash_knocked", acf_enforce_all|acf_align_with_ground,
  [2.0, "anim_human", blow+5400, blow+5453, arf_blend_in_2],
],
# strike_chest_front_stop
["bash_stun", acf_enforce_all,
  [1.5, "anim_human", blow+5000, blow+5010, arf_blend_in_3],
],
# strike_chest_front_stop
["bash_mini_stun", acf_enforce_all,
  [0.6, "anim_human", blow+5000, blow+5010, arf_blend_in_3],
],
# anim jump end
["bash_crouch", acf_enforce_all|acf_enforce_lowerbody,
  [0.5, "anim_human", 280, 290, arf_blend_in_3],
], 
# strike_head_front_left
["bash_unsuccessful", acf_enforce_all,
  [0.55, "anim_human", blow+0, blow+10, arf_blend_in_3],
],

["release_bash", acf_enforce_all|acf_right_cut|acf_parallels_for_look_slope,
  [0.62, "anim_human", combat+5710, combat+5740, blend_in_release],
],




Things to take note of: bashing is only for and only against footmen., thus cavalry will not bash or be bashed. Also, only shields in the range referenced in red above will be bash usable. If you want to bash with a shield, put it in that range.


Enjoy.  :smile:
AfterI did it I see such report
What I do wrong? thank You
 
Hallo, I was wondering how one would go about modifiying the script so you could bash if you have just a 1 handed weapon equipped and change the animation?

Thanks in advance!
 
Back
Top Bottom