Author Topic: [1.011]Mount&Blade Script Enhancer 0.3  (Read 3846 times)

0 Members and 1 Guest are viewing this topic.

Thaess

  • Regular
  • *
    • View Profile
  • Faction: Neutral
[1.011]Mount&Blade Script Enhancer 0.3
« on: December 30, 2011, 06:34:44 PM »
Hello, I'd like to present you my Mount&Blade Script Enhancer for Mount&Blade 1.011. I'm not sure if there are still mods being created for 1.011, but I'm doing this just for fun and satisfaction. Why I'm sharing it? Maybe someone's still creating mod for 1.011 and this would be useful for him.

Quote from: Version 0.3
- Fixed string operations not using string tags correctly ( {reg0} {s0} etc.)
- Added operation is_first_person, set_first_person, agent_get_animation,agent_get_animation_progress, scene_prop_slot_eq, scene_prop_slot_ge, scene_prop_slot_gt, scene_prop_slot_le, scene_prop_slot_lt, scene_prop_slot_add, scene_prop_slot_sub, troop_set_name, troop_set_name_plural,
- Ability to customize agent's sounds by new operation agent_set_sound.

Changelog
(click to show/hide)

(click to show/hide)

Everything you need to run this is "Mount&Blade 1.011 Enhanced Edition". What is it? It's silently released M&B 1.011 version which is not packed with Themida, so it's possible to create such a tool.

Mount&Blade 1.011 Enhanced Edition
Download MBSE
« Last Edit: February 12, 2012, 09:04:12 PM by Thaess »

Belendor

  • Grandmaster Knight
  • *
  • When it doesn't feel right, go left.
    • Steam - Belendor
    • Twitch.tv - Belendorr
    • YouTube - Belendor
    • View Profile
    • Olympus Studios
  • Faction: Swadian
  • MP nick: WTF_Belendor
  • WBWF&SNW
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #1 on: December 30, 2011, 07:41:07 PM »
Pretty cool. Woah, didn't expect for this one-like come alive.

Lav

  • Knight at Arms
  • *
    • Skype - Eleyvie
    • Steam - eleyvie
    • View Profile
    • Lav's Warband Workshop
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #2 on: December 31, 2011, 09:12:47 AM »
Haha, great, now all you need to do is develop this enhancer to the point when good old M&B+MBSE will wipe Warband out of the market. ;-)

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #3 on: December 31, 2011, 09:29:13 AM »
Uh, is it permitted in the EULA to redistribute the main executable like this?

I mean... where did this "special edition" come from, and why isn't it going to have issues with the DRM?  Sorry, I know that's probably going to cause some hackles to rise, but, eh... it might be wise to make sure this is kosher before handing out an executable that can run the game for free and such.

Computica

  • Grandmaster Knight
  • *
  • "Cosmic Kalypso!"
    • View Profile
  • Faction: Swadian
  • MP nick: Computica
  • M&BWBWF&S
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #4 on: December 31, 2011, 10:39:48 AM »
Uh, is it permitted in the EULA to redistribute the main executable like this?

I mean... where did this "special edition" come from, and why isn't it going to have issues with the DRM?  Sorry, I know that's probably going to cause some hackles to rise, but, eh... it might be wise to make sure this is kosher before handing out an executable that can run the game for free and such.
:lol: You didn't know about the super secret enhanced edition? Look at URL of the download link.

Nice job Thaess, if you fall within the lines of the WBSE this would be great.


"The God you don't believe in does not exist"
"No need for bombs, when hate will do."

Lav

  • Knight at Arms
  • *
    • Skype - Eleyvie
    • Steam - eleyvie
    • View Profile
    • Lav's Warband Workshop
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #5 on: December 31, 2011, 02:40:52 PM »
Uh, is it permitted in the EULA to redistribute the main executable like this?
Who said a word about redistributing M&B? Mount&Blade is still available from Taleworlds, so you only need to distribute MBSE. :-)

Swyter

  • Master Knight
  • *
  • »Star Wars Conquest Dev Team Leader
    • View Profile
    • [my tiny homepage]
  • Faction: Swadian
  • MP nick: Sareth | Swyter
  • WBM&BWF&S
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #6 on: December 31, 2011, 06:47:13 PM »
This is unexpected to say the less.  :o

If you're seeking for some new additions... I particularly need these operations for speeding up the Star Wars Conquest map editing process. They are priceless for developing a copy-paste scene prop functionality through mission templates...

Code: [Select]
edit_mode_in_edit_objects_mode = 4600 #(edit_mode_in_edit_objects_mode), #Fails if the game is not in edit objects mode
edit_mode_get_num_selected_prop_instances = 4601 #(edit_mode_get_num_selected_prop_instances, <destination>), #Stores the number of selected prop instances into <destination>
edit_mode_get_selected_prop_instance = 4602 #(edit_mode_get_selected_prop_instance, <destination>, <index>), #Stores the <index>th selected prop instance into instance no into <destination>
edit_mode_select_prop_instance = 4603 #(edit_mode_select_prop_instance, <prop_instance_no>), #Stores the <1>th selected prop instance into instance no into <prop_instance_no>
edit_mode_deselect_prop_instance = 4604 #(edit_mode_deselect_prop_instance, <prop_instance_no>), #Stores the <1>th selected prop instance into instance no into <prop_instance_no>
edit_mode_get_highlighted_prop_instance = 4605 #(edit_mode_get_highlighted_prop_instance, <destination>), #Stores the highlighted prop instance into <destination>
edit_mode_set_highlighted_prop_instance = 4606 #(edit_mode_set_highlighted_prop_instance, [<prop_instance_no>]), #Stores the <1>th selected prop instance into instance no into [<prop_instance_no>]

With a bunch of the more basic ones I'm served and grateful... (multi-selection is optional)
Thank you in advance.



@xeno, Lav & Co:

They simply did a polished ninja release on 2009 and served it for a time frame, then, for an unknown reason they taked it down until we acknowledged the differences.

My mate Ar - Adunakhor and me investigated about this and later we re-uploaded the file to the repo.
Taleworlds grabbed it and is currently shipping it again from the official servers with the "enhanced version", that is how I originaly named the file on my local copy.
« Last Edit: December 31, 2011, 06:56:44 PM by Swyter »

xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #7 on: January 01, 2012, 01:20:34 AM »
How odd! 

That's cool then, just wanted to make sure this wasn't going to get anybody in trouble :-)

Thaess

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #8 on: January 01, 2012, 06:22:06 PM »
I don't know much about the edit mode, but in free time I will take a look.

Thaess

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.1
« Reply #9 on: January 07, 2012, 05:05:04 PM »
Update!
Quote from: Version 0.2
- Added optional parameter "case insensitive" to str_cmp, str_starts_with, str_ends_with
- Added operations: agent_get_item_slot, agent_set_item_slot, agent_get_used_weapon_slot,is_cheat_mode_active, set_cheat_mode, scene_prop_set_slot, scene_prop_get_slot, str_is_empty, store_trigger_param, is_edit_mode_active
- Added item flag itp_lance that allows to couch polearm while on horse (polearms without this flag can not be couched)
- Enchanced trigger ti_on_agent_hit
   Trigger Param 1: id of agent that received damage
   Trigger Param 2: id of agent that delivered damage
   Trigger Param 3: hit damage
   Trigger Param 4: hit bone
   Trigger Param 5: agent dealer's weapon
   Trigger Result: Greater or equal 0 will change the damage
- Fixed bug with storing 32bit values instead of 64.

And two little demos:
http://www.youtube.com/watch?v=s07bzasO_XE
http://www.youtube.com/watch?v=nmHRjTXnkRM

mtarini

  • Resource Wrangler
  • Knight at Arms
  • *
  • [TLD] and [OpenBRF]
    • View Profile
    • [home]
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.2
« Reply #10 on: January 18, 2012, 01:54:25 PM »
Hello, this is all very useful! And interesting! Thank you!!!

So let me get this straight.

Do I understand correctly that...

The game itself, at least in its "enhanced version", is able to process (at runtime) a wider set of operations (from the module txt files) than the normal Module System is able to produce (at module compilation time). For example, it understands more operations than the ones listed in "header_operations.py", more triggers than the one listed in "header_triggers.py", more flags for item than the ones listed in "header_items.py" etc.
So you are providing an enhancement of the module system which gives a more complete access to the operations actually supported at runtime, (by means of headers add-ons plus modifications of the txt-producing python code)... Is that so?

If so, many questions arise, mainly:
how did you find you about these operations/triggers/etc and their details?
and,
how many of these extra-bits-of-language-understood-by-the-game are left?


Apologies if any of that sounds dumb.
« Last Edit: January 18, 2012, 02:47:12 PM by mtarini »

Swyter

  • Master Knight
  • *
  • »Star Wars Conquest Dev Team Leader
    • View Profile
    • [my tiny homepage]
  • Faction: Swadian
  • MP nick: Sareth | Swyter
  • WBM&BWF&S
Re: [1.011]Mount&Blade Script Enhancer 0.2
« Reply #11 on: January 18, 2012, 02:44:34 PM »
Hello, this is all very useful! And interesting! Thank you!!!

So let me get this straight.

Do I understand correctly that...

The game itself, at least in its "enhanced version", is able to process a wider set of operations (from the module txt files) than the normal Module System is able to produce. For example, it understands more operations than the ones listed in "header_operations.py", more triggers than the one listed in "header_triggers.py", etc.
So you are providing an enhancement of the module system which gives a more complete access to the operations actually supported at runtime, (by means of headers add-ons plus modifications of the txt-producing python code)... Is that so?

Hey Marco! :)

Those script enhancers are just two independent projects, a loader, that launches the game suspended, takes over the memory or unprotects if needed, injects/ patches the code so it calls to LoadLibrary, and a DLL runtime.

The library hooks the documented function addresses, that you've previously reversed or disassembled from the PE file. Redirecting the flux to your own crafted assembler code and later returning back to the same point. (Although you can also do some bindings in a higher level language)

In this case, as it has been previously said, the game uses a switch case for itinerating between all the opcode functions. These enhancers makes the program to jump at the end of the structure to the DLL, where they've added some more functions that coexists with the original implementation. Of course, all of this is much more complex, but basically this is as far as I know.

You'll find more info and resources in places like GameDeception.
Although they're not commonly used for these kind of tasks.




- Loader (independent program)-->

CreateProcess <mount&blade.exe> (using CREATE_SUSPENDED)
WaitForInputIdle
WriteProcessMemory <whatever>
ResumeThread
...
<game runs as normal and launcher closes>

- DLL Init (game memory)-->

Your hook routines
<rest of functions, patches and enhancements that are called in determinate parts of the game
 redirecting to the new code>



- - - - - - - - - - - -
The enhanced version is needed because of the exe protector (in this case Oreans Themida) scrambles, compresses and usually obfuscates the code (the program decompresses itself in memory changing the address space after doing some checks against debuggers and so).

Making the reverse and later patching more cumbersome, challenging and changing.

mtarini

  • Resource Wrangler
  • Knight at Arms
  • *
  • [TLD] and [OpenBRF]
    • View Profile
    • [home]
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.2
« Reply #12 on: January 18, 2012, 04:21:02 PM »
Thanks, very useful info.

Even better... that means that any command can be in principle be added.

I think these two would really, really be useful:
agent_get_animation     # returns id of current animation of an agent
agent_get_animation_progress
(currently there are there are the "set" versions of these two commands)

and also:
troop_set_name (the opposite of str_store_troop_name).
(currently you can do that for parties, but not for troops)

Thaess

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.2
« Reply #13 on: January 18, 2012, 04:25:39 PM »
I will add in next version. It will be released a bit later, though.

mtarini

  • Resource Wrangler
  • Knight at Arms
  • *
  • [TLD] and [OpenBRF]
    • View Profile
    • [home]
  • Faction: Neutral
Re: [1.011]Mount&Blade Script Enhancer 0.2
« Reply #14 on: January 18, 2012, 10:26:22 PM »
Wow, will it?
This feels like Xmases used to feel.

Im cannot resist adding these to my wishlist (if they are possible--they might not be).

(agent_set_orientation, <pos1>),  same semantics as agent_set_position, but sets its orientation instead (for some reason, agent_set_position neglects orientation... which is very bad and impossible to work around).

(dead_agent_set_speed, <pos1>, <pos2>), this would set the speed of a dead agent for rag-dolling purposes. Speed is determined as difference between two positions. I know it might be a mess to do. It would be sweeter if you got to pick the bone receiving the impulse, but no need

(is_first_person),  fails if 3rd person view is set

(default_cam_get_position, <pos_no>),
(default_cam_get_aperture, <dest>),  same as "mission camera" operations, but they return the default camera, the one that the game uses when not in manual mode (currently there is no way to ask for default camera position unless camera mode is set to manual, that is, unless you set the camera position yourself)

(current_cam_get_position, <pos_no>),
(current_cam_get_aparture, <dest>),  same as "mission camera" operations, but they return current camera position, whatever it is.

-------------------------------

How difficult is to inject code? The wishlist would be so long for added features...

For example, in first person view, the camera is not where it should be, that is, between the eyes of the controlled agent, but in the origin of the "head" bone. This looks wrong, even in vanilla. It would be an instruction to add that (a translation added, at the very last). It would be even sweeter if one could customize eye position (with respect to head bone) in any way.
« Last Edit: January 18, 2012, 10:28:56 PM by mtarini »