Author Topic: PYTHON SCRIPT/SCHEME EXCHANGE  (Read 288149 times)

0 Members and 1 Guest are viewing this topic.

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #390 on: April 04, 2009, 03:35:56 PM »
kt0 that sounds like an epic script, but im not sure what it does, if im right, as your character level up (and stats increase) your equipment does too? Like lets say your level 10, your gear will have X armor, then at lvl 20 it will have X+20 ? Or am I wrong, what do you mean exactly?
That's the basic idea.  I left it open as to where you stick the levelling part.  Player EXP is the obvious place, but renown gain, honor gain, time based trigger, etc. are also possibilities.  I currently have mine hooked up to renown hence the smallish values for needed xp.  I also have it hooked up to a mod menu for testing.

If you trace through the Sword of Ultimate Overkill's levels (under test data spoiler) you can see that it gains speed and damage as it levels.  You can pretty much work with any item this way.  You can even change how they look between levels since it swaps out the item ID.  I haven't figured out how to change attributes or proficiencies if you can even do that.

Why not tie it in to when you make a kill with that weapon?  Kind of like a demon weapon stealing the souls of those that are slain by it.  Yes an obvious fantasy bit, but so is having a weapon level up.

Just on a note, this is a major advantage to the player, and weapons like this should be limited (other than being unique) in an actual game setting, unless you like the kind of game you can't lose in.

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #391 on: April 04, 2009, 05:34:53 PM »
Why not tie it in to when you make a kill with that weapon?  Kind of like a demon weapon stealing the souls of those that are slain by it.  Yes an obvious fantasy bit, but so is having a weapon level up.

Just on a note, this is a major advantage to the player, and weapons like this should be limited (other than being unique) in an actual game setting, unless you like the kind of game you can't lose in.
I leave all such judgements up to the mod developers.  I've been disabused over the years of the notion that I can do more than throw words at designers when presenting them with a piece of functionality.   :wink:

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #392 on: April 04, 2009, 06:14:29 PM »
I hate the thought that a highly trained elite troop is just as unhappy about marauding about the countryside in a large party as a newly recruited peasant.  In later portions of the game (mods especially) it is super hard to keep a large army happy because of the dearth of suitable targets and the speed at which morale decays.  The following code attempts to fix this by taking troop level into account when determining morale penalty based on size. 

In module_scripts.py look for get_player_party_morale_values:
(click to show/hide)

With this change, higher level troops are more content to be in large bands which makes keeping larger armies far more convenient.  The function is not linear which confounds easy comparisons to the old system but the break even point is around level 5 with lower levels having a far greater penalty and higher levels having far less penalty.  Feel free to tweak for your needs.  As always, credit for use in publically released mods would be swell.

Llew

  • Cheap ass bum
  • Count
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: nK_Llew
  • M&BWB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #393 on: April 04, 2009, 09:15:30 PM »
Very nice man! I'm definitely going to include this in HYW.  :)
"Took me a long time to find you. Wasn't an easy road to travel. I'm angry and tired. Had to kill a lot of people along the way. Some of them tried to cheat me, some tried to lie. I didn't like it one bit. I feel like one more lie'd be the last bitter drop in a chalice full of sorrow. And then...then I'd do something I'd later regret. Now do you know why you can't lie to me?"

Dudro

  • Knight at Arms
  • *
  • -Fortis et Fidus
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #394 on: April 16, 2009, 07:47:51 PM »
(click to show/hide)


So Mordachai, I've tried to follow your instructions, and this is what I've got.
Constants:
(click to show/hide)

Dialogues:
« Last Edit: April 16, 2009, 07:57:57 PM by Dudro »

Dudro

  • Knight at Arms
  • *
  • -Fortis et Fidus
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #395 on: April 16, 2009, 07:54:43 PM »
(click to show/hide)

Dudro

  • Knight at Arms
  • *
  • -Fortis et Fidus
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #396 on: April 16, 2009, 07:56:25 PM »
(click to show/hide)
How it compiles.
Triple post because I can't have more than 40000 characters.

Mordachai

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #397 on: April 16, 2009, 09:46:30 PM »
The latest code that I sent you has various dependencies on SoD features.  e.g. the debug_color.  Just define one in your module_constants.py, or comment out the debug statements (they're only there to debug it).

e.g.:

debug_color = 0xFFFF0000       # solid red

Similarly, most debug sections are inside of a (try_begin), (eq, "$g_sod_debug", 1) ...  Simply comment out the entire debug block, or go ahead and add a $g_sod_debug to your mod (assign it to zero in script_start_game), and add yourself a menu option to set it to 1 when you want to see debug messages (and you can easily extend that to all of your work - simply put debug messages within try blocks that are enabled if your debug global is set to true (1).

There are probably a bunch of other dependencies in there - e.g. I reference trp_ief_*   which are the SoD faction that attacks later in the game.  Those won't be in your module, so you'll have to swap out those references with ones that make sense in your game.  e.g. that section of code determines which faction a given troop belongs to, since M&B don't store that info with troops (they're normally fac_neutral).  So, I have a series of (is_between, <first_troop>,<last_troop>+1) type statements to figure out their real faction.  So just look in your module_troop.py file and figure out what makes sense in your mod.  e.g. take out the section that has to do with the IEF, and instead look to see what troop follows the Rhodocks, and place that instead of the ief as the terminal end of the Rhodocks range.

I think I probably added another slot since I wrote the above as well, to ensure that you can't just keep asking the troop over & over until you get a good roll - so it remembers when you last talked to them and forces you to wait for the next day before trying again.  The slot number you  use for that can be any unused troop slot in your mod.  If you're not using troop slot #232, then assign that to it (Its up to you to figure out for your mod which slots you're using on which entity types.  So for troops, you're using one set of slots, which has nothing to do with parties, or factions, and so on).

Does that all make sense?

Darwin

  • Watchin' your language...
  • Language Moderator
  • *
  • Life's a play.
    • Skype - darwin989
    • Steam - the_darwin
    • View Profile
    • The Automated Mod List
  • Faction: Neutral
  • WBM&BWF&SVC
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #398 on: April 26, 2009, 11:11:14 AM »
Thanks a LOT! Now it works! :D

could you post the code?
thx

Fürwahr, ein guter Deutscher labt sich am Leid allein!

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #399 on: May 03, 2009, 10:11:13 PM »
What's this?  Two BLAMs in one day?!  Yes!  (Previous BLAM here, re:  freecam after death http://forums.taleworlds.com/index.php/topic,63178.msg1641483.html#msg1641483).

I hate the phrase "Kingdom Management" because people bandy it about with seeming indifference typically referring to Highlander's AoM implementation which just about every mod under the sun seems to use.  Undaunted by this, I built my own because I'm like that.  Here's one tasty bit of it in presentation form.

This is a very simple presentation that chugs through all the centers on the map and displays a list of them belonging to the player's faction while printing out some useful information.  It could be easily modified for various nefarious purposes not limited to changing the faction compared against, changing the data displayed, and color coding stuff in a more useful way.  Stuff it at the bottom of module_presentations.py and call from a menu or whatnot as you desire.  It handles multiple pages of stuff reasonably well adding "more" and "prev" buttons at the bottom when it's called for.

As always, credit if the code is used in a released mod would be swell.
(click to show/hide)

Stick this stuff in module_scripts.py wherever's convenient:
(click to show/hide)

Some caveats:
- it's a data window, so it's pretty dense (see screenie) and there's no pretty picture
- you will need to define kt_slot_faction_line_count somewhere like module_constants.py to 20 or so which is the number of entries per page
- there's a hefty gap between the lord and prosperity column where I stash some of my mod-specific stuff which you can see in the screenie (I also have different buildings)
- you probably don't want the presentation to bail back to the camp menu
- for the love of all that you hold dear, clear $g_kt_menu_count to zero before you start the presentation
- if you've added buildings, it's reasonably straightforward to add them to the list
- this isn't the exact code I use; mine has some other trickery and some extra stuff so I haven't tested exactly this code

Screenie:
(click to show/hide)

5-11-2009:  fixed a bug where the counts were off (my test case was where I owned all the fiefs)
« Last Edit: May 12, 2009, 04:16:46 AM by kt0 »

NaglFaar

  • Baron
  • *
    • View Profile
  • Faction: Nord
  • MP nick: NaglFaar
  • WBM&BNW
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #400 on: May 03, 2009, 10:26:39 PM »
Wow and WOW.

2 Blams in 1 day?
Impressive!
Mæli þarft eða þegi


the thread is in Alpha stages and when all the ideas have been put together and implemented the taleworlds post shall be completed.

passivechicken

  • Recruit
  • *
  • You wont like Mister Yellow when he's angry..
    • View Profile
  • Faction: Vaegir
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #401 on: May 12, 2009, 02:22:38 AM »
  GAAaAAH! I still don't understand what Python does..
When life gives you lemons, make lemonade. If life gives you scotch, then drink so much you think it's lemonade.

Graylord

  • Count
  • *
  • Fiddlesticks, i say!
    • View Profile
    • Ultimate Gamer
  • Faction: Vaegir
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #402 on: May 14, 2009, 05:04:24 PM »
So i have this script:
(click to show/hide)
What it does is enabling the player to travel to a specific village from the town menu.
But i need to make it only appear in a specific town, how do i do that?
I'm making a game!

http://www.desura.com/games/modulated
Click the link above to read more!

Amman de Stazia

  • Master Knight
  • *
  • schizophrenic? There's three of us now!
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #403 on: May 17, 2009, 07:33:13 AM »
So i have this script:
(click to show/hide)
What it does is enabling the player to travel to a specific village from the town menu.
But i need to make it only appear in a specific town, how do i do that?

replace
           (party_slot_eq,"$current_town",slot_party_type, spt_town)
with an operation to identify a specific town,

eg  (eq,"$current_town",p_zendar)
http://forums.taleworlds.net/index.php/topic,12250.msg208344.html#msg208344

Family IS more important than Mount and Blade. 

Family D'Stazia.  (A, K and S )

PS - this line plugs TPW - The Peninsular War mod.http://forums.taleworlds.net/index.php/topic,42454.0.html

Amman de Stazia

  • Master Knight
  • *
  • schizophrenic? There's three of us now!
    • View Profile
  • Faction: Neutral
Re: kt0's guide to overpowered items
« Reply #404 on: May 17, 2009, 07:56:42 AM »
Kt0 - can this be applied to horses too?  To make a horse level up with the player?
I'm envisaging that as the player levels up, the horse gets stronger and faster (combat training, better feed, muscle development, etc)...

On further reading of your script I guess the answer is negative - the script swaps the item for a (better_item) - or else as one of the others said, you can add stats to the player...
« Last Edit: May 17, 2009, 08:22:50 AM by Amman de Stazia »
http://forums.taleworlds.net/index.php/topic,12250.msg208344.html#msg208344

Family IS more important than Mount and Blade. 

Family D'Stazia.  (A, K and S )

PS - this line plugs TPW - The Peninsular War mod.http://forums.taleworlds.net/index.php/topic,42454.0.html