OSP Code Combat Spear Bracing Kit (Updated)

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Sinisterius said:
Put all of the triggers into lead_charge and then go fight a random battle with a random party (lord, bandits etc).

The lead_charge mission template is used for these kind of battles.  :grin:
Are you even serious ?!

Adding

Code:
      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,
to the code

Code:
  (
    "lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
     (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
     (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),

      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,	 
     ],
    [
makes the whole game crash !
 

Sinisterius

Add it to the second tuple.

Code:
  (
    "lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
     (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
     (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
     ],
    [
      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,   
<other code below>
   ]),
 

Sinisterius

Actually, as of now, I'm taking all my words back saying these scripts are unoptimized.

I just did a test. I had 50 AI agents in the scene (+1 including me) and I ran a loop 50 times, each time looping through each agent and making sure they're alive and human. Guess what? I got absolutely no performance lagging.

Code:
(try_for_range, reg1, 0, 50),
    (try_for_agents, ":agent"),
        (agent_is_alive, ":agent"),
        (agent_is_human, ":agent"),
    (try_end),
(try_end),
So yeah, these scripts are awesome indeed.



Another test: 100 AI agents, loop ran 70 times and each time two commands were checked. Again, no noticeable frame drop. Quite awesome..
 

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Sinisterius said:
Actually, as of now, I'm taking all my words back saying these scripts are unoptimized.

I just did a test. I had 50 AI agents in the scene (+1 including me) and I ran a loop 50 times, each time looping through each agent and making sure they're alive and human. Guess what? I got absolutely no performance lagging.

Code:
(try_for_range, reg1, 0, 50),
    (try_for_agents, ":agent"),
        (agent_is_alive, ":agent"),
        (agent_is_human, ":agent"),
    (try_end),
(try_end),
So yeah, these scripts are awesome indeed.



Another test: 100 AI agents, loop ran 70 times and each time two commands were checked. Again, no noticeable frame drop. Quite awesome..
And what does this have to do with anything ?
 

vota dc

Sergeant Knight
M&BWB
Best answers
0
Can this guide be upgraded for Warband?

["spearwall_hold", acf_thrust|acf_enforce_all|acf_align_with_ground,
  [4.0, "anim_human", combat+7310, combat+7310, blend_in_ready],
],

Gives error in Warband. If you change this code (you need to change the acfthing) you won't have any error and the game will start. But if you press any key it won't happen nothing: I don't think it is an animation problem since you should get a notify that you are bracing.
 

Caba`drin

Count
M&BWBWF&SNWVC
Best answers
0
I've updated the code for the most recent version of Warband and incorporated it into Pre-Battle Orders & Deployment. You can check out the source there or in the various compilations it appears in.
 

Lumos

Section Moderator
WBWF&SNWM&BVC
Best answers
0
The Mercenary said:
Forgot a second thing. You hit B to brace in this version. Or maybe it's G.

Hit your keyboard randomly. You'll find it eventually.
 

grimbol

Veteran
Best answers
0
hi friends,sorry for my english

I'm doing wrong

and this is necessary??

Okay, try this. Go to the top of mission_templates, where all the triggers are defined, and put it in there. Next, in your areas to use it, put these lines:

Code: [Select]

      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,

    ],
  ),


if so, exactly where I put it, the syntax right?


 

thx for help.

 

blancire

Recruit
Best answers
0
Well i tried put that script in my mod and... i cant't; that is my error, please help!!!!  :cry:
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Exporting mission_template data...
Traceback (most recent call last):
  File "process_mission_tmps.py", line 64, in <module>
    save_mission_templates(variables,variable_uses,tag_uses,quick_strings)
  File "process_mission_tmps.py", line 48, in save_mission_templates
    save_triggers(file,convert_to_identifier(mission_template[mission_template_n
ame_pos]), mission_template[mission_template_triggers_pos],variables,variable_us
es,tag_uses,quick_strings)
  File "process_mission_tmps.py", line 23, in save_triggers
    save_statement_block(file, 0, 1, trigger[trigger_consequences_pos], variable
_list,variable_uses,tag_uses,quick_strings)
  File "C:\Users\USER\Desktop\Warband mod\process_operations.py", line 449, in s
ave_statement_block
    save_statement(ofile,opcode,no_variables,statement,variable_list,variable_us
es,local_vars, local_var_uses,tag_uses,quick_strings)
  File "C:\Users\USER\Desktop\Warband mod\process_operations.py", line 401, in s
ave_statement
    ofile.write("%d "%operand)
TypeError: %d format: a number is required, not list
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: g_leave_town
WARNING: Global variable never used: g_battle_result
WARNING: Global variable never used: g_train_peasants_against_bandits_training_s
ucceeded
WARNING: Global variable never used: trainer_help_message
WARNING: Global variable never used: tutorial_1_finished
WARNING: Global variable never used: tutorial_2_finished
WARNING: Global variable never used: tutorial_3_finished
WARNING: Global variable never used: tutorial_4_finished
WARNING: Global variable never used: tutorial_5_finished
WARNING: Global variable never used: g_base_flag_team_1
WARNING: Global variable never used: g_base_flag_team_2
WARNING: Global variable never used: g_last_number_of_agents_around_belfry
WARNING: Global variable never used: g_multiplayer_round_max_seconds_div_2
WARNING: Global variable never used: g_tutorial_training_ground_current_score_2
WARNING: Global variable never used: g_tutorial_training_ground_conversation_sta
te
WARNING: Global variable never used: g_belligerent_drunk_leaving
WARNING: Global variable never used: g_belligerent_drunk
WARNING: Global variable never used: g_start_hired_assassin_fight
WARNING: Global variable never used: g_hired_assassin
WARNING: Global variable never used: g_start_assassin_fight
WARNING: Global variable never used: g_tutorial_training_ground_state
WARNING: Global variable never used: g_tutorial_training_ground_melee_trainer_at
tack_dir
WARNING: Global variable never used: relative_of_merchant_is_found
WARNING: Global variable never used: talked_with_merchant
WARNING: Global variable never used: merchant_sign_count
WARNING: Global variable never used: g_city_merchant_troop_id
WARNING: Global variable never used: g_city_merchant_agent_id
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

i didn't do the last part:
I believe that's all of it. Now, for your own mod, you have to change parts.

Find this:            (try_for_range,":spear","itm_pitch_fork","itm_wooden_shield"),

and change the first item to the beginning of where the spears are in your mod and the "item_wooden_shield" to the end.

Next, scroll down a small bit to see the area where it starts with:
                (try_begin),
                (eq,":spear","itm_war_spear"),
                (assign,":speardist",160),

and ends with:

              (else_try),
                (eq,":spear","itm_iron_staff"),
                (assign,":continue",0),
              (try_end),

You need to change it. Each "itm_somethinghere" needs to become an spear in your mod. For items that you don't want braced (iron staff is an example here), set it to ":continue",0. The other values are the length of the spear when braced. So, the war spear can kill horses from 160 M&B distance units away. This part of the code enables the AI to brace their spears.



Now scroll down to the second:                                      (try_for_range,":spear","itm_pitch_fork","itm_wooden_shield"),


Change it again.


Then scroll down a tiny bit and change it (the spear lengths) again.

This part enables the player to brace spears.
i couldn't understood that, i am not english. But i understand that is only por jik.
 

piotras

Recruit
Best answers
0
question about spear bracing:

how can I make them REMAIN in spear bracing after the first few riders?

how it works fore me is rather irritating, since the cavalry charge is always spread out, which makes the first few attackers impaled immediately after which my spearmen just stop bracing and get trashed by the few dozen other riders which mince them and stomp them into the ground

very nice feature but broken! :sad:
 

Nikephoros

Section Moderator
M&BWB
Best answers
0
Holy necroposting Batman!

I have been trying to add this kit to my mod, but despite doing everything in the instructions, including adding
(assign, "$setting_use_spearwall", 1),

in module_scripts.



I added the code at the beginning of mission_templates, and then the triggers in lead_charge, as shown below:

Code:
  (
    "lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
     (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
     (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
     ],
    [
      spearwall_trigger_1,
      spearwall_trigger_2,
      spearwall_trigger_3,
      spearwall_trigger_4,
      spearwall_trigger_5,
      spearwall_trigger_6,
      spearwall_trigger_7,
      spearwall_trigger_8,
      spearwall_trigger_9,
      (ti_on_agent_spawn, 0, 0, [],
       [rest of the code
It is like the triggers don't fire, and i don't understand why.
 

KnightV

Squire
Best answers
0
xporting strings...
xporting skills...
xporting tracks...
xporting animations...
raceback (most recent call last):
File "process_animations.py", line 61, in <module>
  write_actions(animations,len(action_codes),action_codes,"actions.txt")
File "process_animations.py", line 30, in write_actions
  file.write(" %s %d %d "%(action_codes[i_action_code],action[1], action[2]))
print flags
ypeError: %d format: a number is required, not list
xporting meshes...
xporting sounds...
xporting skins...
xporting map icons...
reating new tag_uses.txt file...
reating new quick_strings.txt file...
xporting faction data...
xporting item data...
xporting scene data...
xporting troops data
xporting particle data...
xporting scene props...
xporting tableau materials data...
xporting presentations...
xporting party_template data...
xporting parties
xporting quest data...
xporting info_page data...
xporting scripts...
RROR: Usage of unassigned local variable: :amount
RROR: Usage of unassigned local variable: :amount
xporting mission_template data...
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Local variable never used: player_agent, at: 0
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
xporting game menus data...xporting strings...
xporting skills...
xporting tracks...
xporting animations...
raceback (most recent call last):
File "process_animations.py", line 61, in <module>
  write_actions(animations,len(action_codes),action_codes,"actions.txt")
File "process_animations.py", line 30, in write_actions
  file.write(" %s %d %d "%(action_codes[i_action_code],action[1], action[2]))
print flags
ypeError: %d format: a number is required, not list
xporting meshes...
xporting sounds...
xporting skins...
xporting map icons...
reating new tag_uses.txt file...
reating new quick_strings.txt file...
xporting faction data...
xporting item data...
xporting scene data...
xporting troops data
xporting particle data...
xporting scene props...
xporting tableau materials data...
xporting presentations...
xporting party_template data...
xporting parties
xporting quest data...
xporting info_page data...
xporting scripts...
RROR: Usage of unassigned local variable: :amount
RROR: Usage of unassigned local variable: :amount
xporting mission_template data...
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Local variable never used: player_agent, at: 0
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
ARNING: Variable name used for both local and global contexts:spear_dist
xporting game menus data...








helpppppp
 

formergamer

Recruit
Best answers
0
spear bracing in Floris Evolve does NOT do damage to the incoming cavs.  It just stops them.  A bug or Floris missed a code?
 

Corbul

Sergeant at Arms
WBWF&SVC
Best answers
1
I get an error when trying to compile:
Loading module... DONE.
Loading plugins... DONE.
Checking module syntax... FAILED.
MODULE `animations` ERROR:
failed to parse element #496
  cannot convert value [4.0, 'anim_human', 27310, 27310, 7] to integer

COMPILATION FAILED.
What gives?? :sad:

And that's another post necro'd by moi :dead: