B Native Battle Time! - The co-op mod (v1.4 Updated 10/1/12)

Egbert

Master Knight
M&BWB
Best answers
0
Battle Time!
The co-op mod for Warband.​


Download Battle Time v1.4 For Warband v1.153
Includes version 3.1.4 of WSE.


Download Battle Time v1.31 For Warband v1.143
Includes version 2.8.1 of WSE.




Doddy said:
Advantages would be that you could have it as a kinda casual LAN game, ie have a movie going in the background, drink a few beers, one person controlling the army and then be like Guys battle time, all turn back to computers and woop some people :smile:
This mod for Warband lets you play your singleplayer campaign and host a multiplayer game whenever you have a battle. After the battle, the results can be used to impact your singleplayer campaign.


Features:
- Play your campaign in singleplayer and your battles in multiplayer.
- When you fight a battle, siege, or attack a village, host a multiplayer game so your friends can help you win the fight.
- Use a dedicated server so that players do not need to reconnect for each battle.
- Anyone that joins the MP battle can choose to be the player, a companion in the player's SP party, any lord from either team, or a random regular soldier.
- Take command of a troop division or all the troops from your chosen party.
- The main party inventory is available during the MP battle by choosing "Access Inventory" from the Esc menu before spawning or using the box at your spawn point.
- The multiplayer battle will have the correct scene, troops (weapons and skills), banners, and weather.
- After the battle, load your saved game and apply the results from the multiplayer battle.
- Great for LAN play or online with voice chat and screen sharing software.
- May be compatible with some Native savegames.
- Battle Time uses the Warband Script Enhancer, adding more features and support for dedicated servers.


Mission types that can use co-op:
- Normal encounter
- Join a battle
- Join a siege assault
- Siege attack
- Defend castle you are in
- Village attacked by bandits
- Village raid attacked by lord
- Village raid defended by lord
- Village attack when looting them
- Village train peasants
- Bandit lairs


Notes:
- "Give me time to save" - Leave the encounter (so you can save) and clear the battle setup file (so you can setup the battle again).
- "Switch to bot on death" - Allow players to spawn as regular troops if a faction is picked (even if there are no heroes).
- "Skip menu buttons" -  The setup battle option quits to the menu and after battle results are save automatically (otherwise use the menu option if you want to gather loot).
- "Use spawn formations" - Troops spawn in rows and wait up to 40 seconds before charging.
- "Disable active inventory" - No inventory access and weapons are not saved from the battle.
- "Reduce damage to players " - Reduces damage to players to 1/4 (also refills ammo from inventory box).
- Xp messages can be toggled in the Esc menu.

- Admin panel settings are saved when host returns to SP.
- Weapons and armor can be traded with the party inventory before spawning and weapons only after spawning.
- Weapons gathered during the battle are saved. If you don't want to lose something, you can put it back in the inventory box or disable inventory from the server options.
- The MS can only set some attributes to 63, so imported characters may have less stats.
- This mod does not make changes to the troop and item files, so if you want to make changes to those go ahead.

- All clients should join the server before the host starts the battle (otherwise clients will have graphic bugs).
- Dedicated servers can switch back to native MP battle modes between co-op battles to keep clients occupied while waiting for the next battle.
- Using a VPN like Hamachi may not work and give you an "Incorrect authorization key" error.
- If you don't know how to run a non-dedicated server, use the forum to get help such as here, here, here, here, here, here.
- For help with a dedicated server go here:Hosting a Dedicated Server Guide
- If you have trouble connecting to your server, make sure you have the ports forwarded on you router, and set "use_secure_connection = 0" in your rgl_config.txt


Installation:
1. Download and extract the Battle Time zip to your Warband modules folder: "Program Files\Mount&Blade Warband\Modules\Battle_Time"
2. Move all the WSE files from the "Program Files\Mount&Blade Warband\Modules\Battle_Time\WSE\" folder to the main Warband folder: Program Files\Mount&Blade".
3. Start Warband by running WSELoader.exe located in the main Warband folder: "Program Files\Mount&Blade Warband"


- If you need to run WSE from a different folder, make a shortcut to WSELoader.exe, right click on the shortcut and open properties, in the target box add at the end of the line the correct path: -p "C:\Program Files\Mount&Blade Warband\mb_warband.exe"
- Battle Time includes a new game_variables.txt which removes the gold display in MP, to add it back rename the file: game_variables_native.txt.
- To use a native save game: Copy save file from My Documents\Mount&Blade Warband Savegames\Native to My Documents\Mount&Blade Warband Savegames\Battle Time


Installation For Dedicated Server:
The dedicated server allows you to host the battles separately from your singleplayer game so other players are not disconnected at the end of a battle.
1. Download and install the dedicated server files (works on your own pc or a rented server).

2. Extract the Battle Time zip to your "Mount&Blade Warband Dedicated\Modules\" folder.

3. Move all the files from the "\Modules\Battle_Time\WSE" folder to the "Mount&Blade Warband Dedicated" folder where mb_warband_dedicated.exe is.

4. Open the wse_settings.ini file in the "Mount&Blade Warband Dedicated" folder, set the path to be the same folder used by your singleplayer Warband installation: "storage_path = C:\Users\****\Documents\Mount&Blade Warband\WSE" (if you leave the path blank, the default folder for the dedicated server will be something like: C:\Program Files\Mount&Blade Warband Dedicated\WSE, if you are using a remote server, you may want to use this folder and leave the path blank).

5. Open Battle_Time.txt in the "Mount&Blade Warband Dedicated" folder, set the admin password: "set_pass_admin ADMIN".

6. Start the server by running "Battle_Time_start.bat" located in the "Mount&Blade Warband Dedicated" folder (do not click on WSELoader.exe to start the dedicated server).

7. Run your singleplayer Warband game and setup a battle from the encounter menu (you should have two separate installations of Warband running: a black window for the dedicated server and your normal game for singleplayer).

8. After you setup the battle in singleplayer, quit to the main menu, click "Multiplayer", and click "Join a Game", (DO NOT click "Host a Game" if you are running a dedicated server).

9. Find your dedicated server in the list, it will be in the "Local area network" list or the "Internet" list if you have correctly forwarded the ports on your router.

10. Enter the server password to join your server as the admin.

11. Once you join the server, go to the admin panel in the Esc menu and either pick "Co-op admin panel" if the server is in a Native battle or "Load battle" if it is in co-op mode.

12. If the settings are correct, click "Start Map".

13. Pick your character and troops and use the "Start Battle" button in the Esc menu.
WSELoader.exe -r Battle_Time.txt -m Battle_Time
#WARNING: Make sure that you change the capital values with proper ones.
#uncomment the line below when you set a valid administrator password
set_pass_admin ADMINPASS
#if you have premium members, set a password for them, otherwise delete/comment out the line below
#uncomment the line below when you set a valid private password
#set_pass_private PRIVATEPASS
#uncomment the line below when you set a valid server name
#set_server_name SERVERNAME
#uncomment the line below when you set a valid welcome message
#set_welcome_message WELCOME MESSAGE
#Steam must be running in order to use valve anti cheat
#Also you must use the Steam version of the dedicated server in order to use this option
#set_enable_valve_anti_cheat 1
#setting battle (multiplayer_bt) mode
#set_mission multiplayer_bt
set_mission coop_battle
#setting max players, first one is non-premium member limit, second one is premium member limit
set_max_players 32 32
set_num_bots_voteable 20
set_map multi_scene_1
#adding all kingdoms to both sides just to randomize all of them
#adding less kingdoms will reduce the randomization set (used in set_randomize_factions command)
add_factions fac_kingdom_1 fac_kingdom_1
add_factions fac_kingdom_2 fac_kingdom_2
add_factions fac_kingdom_3 fac_kingdom_3
add_factions fac_kingdom_4 fac_kingdom_4
add_factions fac_kingdom_5 fac_kingdom_5
add_factions fac_kingdom_6 fac_kingdom_6
set_randomize_factions 1
#since default team point limit is 300, the line below is necessary for this mode
set_team_point_limit 10
#if the bottleneck is your server's bandwidth, then make sure that you set a correct value for upload limit
set_upload_limit 100000000
#if you are running more than one dedicated server on the same computer, you must give different ports to each of them
set_port 7240
#if you are running the Steam version of the dedicated server, this port must also be set, and same limitations of set_port apply for Steam port
set_steam_port 7241
set_server_log_folder Logs
set_server_ban_list_file Logs\ban_list.txt
start

Thank you to:
cmpxchg8b for his amazing Warband Script Enhancer.

Download Source code for Battle Time
WARNING: This is for modders only. If you want to add this to any other mod you will also need the source code for that mod.

This source code is OSP, if you want to use it, don't ask permission, just give proper credit and let me know if you fix any bugs.
The source for v1 is also included for interested modders because it is designed quite differently. I do not recommend using v1 anymore, because storing values in high numbered registers can cause crashes. Version 1 uses some code from rubik for his python script to get item difficulties.

To add Battle Time to your mod:
1. Copy the 3 extra module files (these only include code for Battle Time):
      module_coop_mission_templates.py
      module_coop_presentations.py
      module_coop_scripts.py
2. Search all files for #COOP BEGIN
3. Copy the parts from #COOP BEGIN to #COOP END into the corresponding module files
4. Download and install the Warband Script Enhancer, and paste the header_operations_addon.py file at the end of your header_operations.py
5. Copy the SceneObj folder to your mod (this overwrites scn_lair_steppe_bandits.sco to fix the ai mesh)
6. In your mod's module.ini change damage_interrupt_attack_threshold_mp  = 3.0
7. If you don't want the player's gold display in MP mode, copy game_variables.txt to your mod folder

When you encounter a battle:
1. Choose "Give me time to save" if you did not save the game IMMEDIATELY before the battle (also clears the battle setup file so you can setup the battle again). Then rejoin the encounter.
2. Choose "Setup multiplayer battle" to play the battle in multiplayer mode. This will prepare the multiplayer admin panel with the settings for the current battle.


3. Choose "Quit game (will not save)" when you are ready to continue to the battle in multiplayer mode.


4. Go to multiplayer mode.
5. Choose "Host a game" (if you are using a dedicated server, click join a game and login as the admin and open the admin panel).
6. Choose "Start Map" to begin the battle, or "Load Battle" if necessary.





7. Choose a faction and choose a hero troop if you dont't want to spawn as a regular soldier.




8. Select which groups of troops you want to command.


9. After the host and all clients have chosen a hero to play as, the host can click "Start battle".
10. Players can change equipment with the main party inventory before the battle starts or equip weapons from the chest after spawning.


11. When one team has been defeated, use the menu option "End Battle" to save results.

After the battle:
1. Load the saved game that you saved right before the battle.
2. Encounter the same party that you did when you started the battle. Because you saved before the first encounter, this second repeated encounter is the only one that is actually used.
3. Choose "Use multiplayer battle results" this will inflict casualties to your party and any parties that were in the battle.

4. Continue playing singleplayer until you fight again.

Battle Time v1.4 10/1/12
Update to Warband 1.153
Added menu option to spawn as random troop
Added option to disable heroes being captured after a defeat
Changed siege retreat formula to only occur if defender has enough troops
Known bug: facecodes may show as player profile in MP


Battle Time v1.31 9/24/11
Fix dedicated server config
Fix siege tower bug


Battle Time v1.3 8/9/11
Update to Warband 1.143
Custom face codes now used in MP (requires WSE)
Added server option to reduce damage to player by 1/4 (also refills ammo from inventory box)
Added server option to disable inventory access in battle
Check box to command all troops in party is on by default
Xp messages are set to on by default
Inventory item detail detail popup now shows correct imod stats
Fixed bug with dedicated server maplist rotation that couldn't be stopped


Battle Time Patch to 1.21 (last version for WB 1.134)
Battle Time v1.21 5/1/11
Works with WSE 1.5
Fix spawning without horses
Fix hero health in MP
Possible fix for siege tower movement bug



Battle Time v1.2 3/20/11
Battle Time now uses the Warband Script Enhancer, adding more features and support for dedicated servers.
Dedicated servers can switch back to native MP battle modes between co-op battles to keep clients occupied while waiting for the next battle

Ally lords are now properly attached to battles
Fixed bug with lords weapons and armor in battles
Lowered team troop ratio for battles with a large advantage, max is now 2:1
Commanding "all in party" now only gives you troops not requested by other players in your party
Villagers can be commanded by their village lord if he is in the battle
Skip admin panel is now disabled, it was messy and didn't make battle setup faster
Battles can be ended manually to allow extra time to gather loot by disabling "Skip menu buttons"
Siege rounds wait longer for players to rejoin, but can be started manually from the menu
Using the end battle option from the Esc menu before the battle is finished now results in a retreat
Bug workaround for issues with carrying thrown weapons and bows or crossbows (If you spawn with this loadout, your weapons will only lose item modifiers)




Battle Time v1.01 2/4/11
Fixed instability issues
"Switch to bot on death" allows players to spawn as regular troops when the battle starts



Battle Time v1 2/1/11
Added bandit lair battles, village train peasants to fight bandits, encounter lord during village raid.

Main party inventory is now available during the MP battle
Items can be traded before spawning, weapons can be added or removed during battle.
Item details popups do not show stats from item modifiers, although the modifiers are saved by the server and displayed

Admin panel settings are saved when host returns to SP
Use party button (P) to toggle xp messages.
Heroes gain weapon proficiency for kills
Main party custom troop divisions
Troops are no long killed in SP for suicide
Battle advantage is used to adjust team ratios
Map size adjusts to battle size
Many other bugfixes



BT v0.91 patch 1/1/11
Bug fixes for host, compatible with v0.9 clients
Fix siege battles with 0 troops
Fix regular troops earn xp from kills
Add messages for xp earned


BT v0.9
First release 12/22/10

Signature by captain lust

Code:
[url=http://forums.taleworlds.com/index.php/topic,150827.0.html][IMG]http://farm6.static.flickr.com/5167/5316104961_aa742646d2_o.png[/IMG][/url]
Signature by Belendor

Code:
[url=http://forums.taleworlds.com/index.php/topic,150827.0.html][IMG]http://b1108.hizliresim.com/11/8/25/10802.png[/IMG][/url]
 

Azrooh

Baron
Best answers
0
...Well. I'd say that's plenty of proof for it being real, haha.
Thanks for this, I have some friends that would be very interested :smile:

E: Holy **** this is amazing. THANK YOU.
 

phoenixguard09

Knight at Arms
WBWF&S
Best answers
0
And all those douches who had a go at you about this.  Excellent work will download later today cause its 3 am here and I'm super tired.
 

Austupaio

Duke
WBNWM&B
Best answers
0
It's not a troll. It's not a ****ing troll.

The steps make it sound like it takes a lot of effort to get from thing to another, but it's more seamless than it sounds. This is ****ing excellent.

This will beat everything else I get for Christmas by ****ing far.

I love you.

Edit; Okay, I've over-come my excitement, now I've got my serious face on. Exactly what files does this change? Is it safe to edit the troops and item_kinds?
 

Fenix_120

Sergeant
Best answers
0
hmm........


Interesting...


The possibilities...



Anyway.


THANK YOU SO VERY VERY MUCH!


Merry Christmas too!



EDIT:  Will this work with mods or just native?
 

okiN

Count
M&BWB
Best answers
0
I was wondering if anyone would ever rig something like this together, or whether we'd have to wait for the devs to add it themselves. Sounds great, I'll be sure to try it out ASAP. :smile:
 

Caba`drin

Count
M&BWBWF&SNWVC
Best answers
0
Very, very interesting!

Any plans to open your source? Would be very useful for folks trying to combine mods...and for those who may want to play with your method and see what else might be able to be done with it. A post explaining what is changed/how you communicate between the SP encounter to the MP set-up screen and back again would be more than welcome, too.

From the screenshots, my only bit of comments would be that it seems you could alter the encounter menus much further to be more responsive to where the player is in the Save-Setup-Quit process, limiting their options so it flows more intuitively. One global variable (or slot) should be enough to track that.
 

Ducksrulez

Sergeant Knight at Arms
M&BWBWF&SNW
Best answers
0
a few problems i saw where that i was messing around with my CHUCK NORRIS hacked character and the stats didn't transfer to multiplayer

and would it be possible to port your native savegame to this?
 

ThaneWulfgharn

Master Knight
Best answers
0
I didn't got this well.This mod:
Allows me to connect multiplayer(and host my friends) for any battle I play on Singleplayer Map
                                      OR
Allows me to stimulate multiplayer-like battles on Singleplayer Map(No friends hosted)
 

Egbert

Master Knight
M&BWB
Best answers
0
@Caba`drin
I'll put the source in when I'm done working on it, so it will be easy to add to other mods.
The way it works now, all the battle data is stored in registers that don't get cleared until you exit the program.


@Ducksrulez
The module can only set some attributes to 63, so imported characters may have less stats.
I tested with a native savegame and it seemed to be fine.


@ThaneWulfgharn This:
Allows me to connect multiplayer(and host my friends) for any battle I play on Singleplayer Map
 

Fenix_120

Sergeant
Best answers
0
I just got done playing with my brother over the LAN, I must say that you, Sir Egbert, are a freaking genius.

Again, Thank You.





 

Azrooh

Baron
Best answers
0
Troops don't gain exp in battle. If there's no way to fix it, it's no big deal, but it would be amazing if you could.
 

Egbert

Master Knight
M&BWB
Best answers
0
Azrooh said:
Troops don't gain exp in battle. If there's no way to fix it, it's no big deal, but it would be amazing if you could.
Which troops? If heroes are not getting xp it might be a bug.