OSP Code Combat Spear Bracing Kit (Updated)

Sinisterius

They're all in header_operations.py, why would I need to list most of the new commands here?  :lol:
 

The Shadow

Recruit
Best answers
0
Because I want to know what ones will improve Spear Bracing! 

Now I'm just being persistent because I don't think you know what ones could. 
 

Sinisterius

... lol

Warband introduced a set of new commands, which when properly used, can give an astounding effect when used correctly. For example: using the spawn_scene_prop command + slots correctly, you can create optimized, working, AI and even multiplayer Spear Bracing. Which actually works in newer versions of M&B aswell.
 

The Shadow

Recruit
Best answers
0
How is spawning a scene prop going to help Spear brace? 

The AI does use spear brace, by the way. 
 

Sinisterius

Bolkonsky said:
How is spawning a scene prop going to help Spear brace?
Looping through each agent and doing plentiful of code in each loop in a time period of ~0.1seconds for 4 times is not a good idea (one of the agent loops seems to be nested inside another agent loop which is a really bad idea). With scene props, you could optimize the scripts a lot.

I'm not trying to be negative here -- all I tried was to help. I hope I made myself clear.
 

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Please, can anyone give me some advice on how to solve the

WARNING: Usage of unassigned global variable: $setting_use_spearwall

error at the end of the compilation list ?

I really want to get the spear bracing working for my mod. Thanks in advance.
 

Sinisterius

Place this..

(assign, "$setting_use_spearwall", 1), to module_scripts.py, somewhere in game_start script (the first script). Then you shan't get that error anymore.
 

The Shadow

Recruit
Best answers
0
ZemplinTemplar said:
Bolkonsky said:
Don't worry about that, it will still work.
Well, it isn't working.
Did you add it to all the missions, like "lead_charge" and various other battles, in module_mission_templates.py? 

And by "it" I mean:

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,
You can do what Sinisterius said to get rid of the error, but that won't make it work.  It's purely aesthetic.  It's there for an option to turn it on and off in a menu somewhere, if I had to guess. 
 

Sinisterius

Bolkonsky said:
You can do what Sinisterius said to get rid of the error, but that won't make it work.  It's purely aesthetic.  It's there for an option to turn it on and off in a menu somewhere, if I had to guess. 
Umm.. no.

These triggers only run if the global variable setting_use_variable equals to 1. If you don't assign it, then it isn't equal to anything (the game engine might automatically make it 0, but the triggers still won't run because the variable needs to be 1). Just take a short look at the conditions block..
 

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Sinisterius said:
Place this..

(assign, "$setting_use_spearwall", 1), to module_scripts.py, somewhere in game_start script (the first script). Then you shan't get that error anymore.
In the first line, right after ("game_start", or only after the [ bracket beneath it ?  :???:

Bolkonsky said:
Did you add it to all the missions, like "lead_charge" and various other battles, in module_mission_templates.py? 

And by "it" I mean:

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,
You can do what Sinisterius said to get rid of the error, but that won't make it work.  It's purely aesthetic.  It's there for an option to turn it on and off in a menu somewhere, if I had to guess.
Of course. Between the mission's already existing code and the final two brackets, just as the manual said. It had no effect at all.
 

Sinisterius

Here's how it should look.

Code:
("game_start",
[
     (assign, "$setting_use_spearwall", 1),
     <other code>
]),
 

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Thanks, that did get rid of the problem, but the bracing doesn't work anyway.

I'm giving up on the code. It's impossible to implement properly and I get the feeling it will be semi-useless ingame.  :sad: Thanks anyway.
 

The Shadow

Recruit
Best answers
0
Sinisterius said:
Bolkonsky said:
You can do what Sinisterius said to get rid of the error, but that won't make it work.  It's purely aesthetic.  It's there for an option to turn it on and off in a menu somewhere, if I had to guess. 
Umm.. no.

These triggers only run if the global variable setting_use_variable equals to 1. If you don't assign it, then it isn't equal to anything (the game engine might automatically make it 0, but the triggers still won't run because the variable needs to be 1). Just take a short look at the conditions block..
Read my post again please. 

Adding (assign, "$setting_use_spearwall", 1) to module_scripts will not solve his problem of Spear Brace not working, just like I said.  All it does is get rid of the warnings in the compilation, purely aesthetic.  That's there so that someone can make an option to turn it on and off!  Read the thread!

ZemplinTemplar said:
Thanks, that did get rid of the problem, but the bracing doesn't work anyway.

I'm giving up on the code. It's impossible to implement properly and I get the feeling it will be semi-useless ingame.  :sad: Thanks anyway.
I'm sorry to hear that.  What missions did you add it to? 

 

Sinisterius

Bolkonsky said:
Adding (assign, "$setting_use_spearwall", 1) to module_scripts will not solve his problem of Spear Brace not working, just like I said.  All it does is get rid of the warnings in the compilation, purely aesthetic.  That's there so that someone can make an option to turn it on and off!  Read the thread!
You do realize that the triggers need the global variable setting_use_spearwall to be set to 1? If you don't set it to anything, it will be 0.. For gods sake, you said it yourself, it's for turning on/off.. it doesn't simply remove the compiling error, it actually enables the triggers which contain the main process of Spear Bracing! *zing*

Read this twice before replying.
Sinisterius said:
These triggers only run if the global variable setting_use_variable equals to 1. If you don't assign it, then it isn't equal to anything (the game engine might automatically make it 0, but the triggers still won't run because the variable needs to be 1). Just take a short look at the conditions block..
The (assign, "$setting_use_spearwall", 1), goes to script_game_start because that script is automatically called by the game engine when you start a new game. You set that variable to 1 and, in essence, you allow the Spear Bracing triggers to run. Now, I refer you to this.
 

The Shadow

Recruit
Best answers
0
I will say it again.  Adding the code to the top of module_scripts will not solve his problem of it not working.  I'm pretty sure that this:

ZemplinTemplar said:
Thanks, that did get rid of the problem, but the bracing doesn't work anyway.

I'm giving up on the code. It's impossible to implement properly and I get the feeling it will be semi-useless ingame.  :sad: Thanks anyway.
Proves it. 

Maybe you can ask the creator?  Or someone who uses the code, and got it working, that did not do that?  (Me, in case you can't figure it out.)  So no, it's not needed for it to function. 

 

Sinisterius

Bolkonsky said:
I will say it again.  Adding the code to the top of module_scripts will not solve his problem of it not working.
Maybe you can ask the creator?  Or someone who uses the code, and got it working, that did not do that?  (Me, in case you can't figure it out.)  So no, it's not needed for it to function.
Yeah..

dunde] Good modder should accomodate said:
I got those errors too at first so all I did was this.
spearwall_trigger_1 = (0.2, 0, ti_once, [], [
        (assign,"$spear_in_position",0),
        *(assign,"$setting_use_spearwall",1),*
        (try_for_agents,":agent"),
          (agent_set_slot,":agent",slot_agent_spearwall,0),
          (agent_set_slot,":agent",slot_agent_x,0),
          (agent_set_slot,":agent",slot_agent_y,0),
          (agent_set_slot,":agent",slot_agent_z,0),
          (agent_set_slot,":agent",slot_agent_speed,0),
        (try_end),
        ])
Notice the star where I set $setting_use_spearwall to 1. That will fix the $setting use spearwall problem.
[/quote]

Do a search for setting_use_spearwall and you'll find others who had this problem as well. I guess you must be a magician if you got it to work without defining setting_use_spearwall anywhere.  :lol:
 

ZemplinTemplar

Sergeant
WBNWVCWF&S
Best answers
0
Bolkonsky said:
ZemplinTemplar said:
Thanks, that did get rid of the problem, but the bracing doesn't work anyway.

I'm giving up on the code. It's impossible to implement properly and I get the feeling it will be semi-useless ingame.  :sad: Thanks anyway.
I'm sorry to hear that.  What missions did you add it to?
Basically into every one of them (except lead_charge, I think). Their names are written a bit chaotically in the code, so I was rather cautious of dumping the 9 spearwall lines into every one of them and only added it to two Quick Battle missions at first. Still, pressing B and holding down a polearm (or vice versa) currently does absolutely nothing.

Bolkonsky said:
Proves it. Maybe you can ask the creator ? Or someone who uses the code, and got it working, that did not do that?  (Me, in case you can't figure it out.)  So no, it's not needed for it to function.
I know it's not.
But the bracing didn't even work before that.
Basically, I have no idea what to expect once it starts working.
 

Sinisterius

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: