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

0 Members and 1 Guest are viewing this topic.

SupaNinjaMan

  • Baron
  • *
  • 🆗🆒
    • Steam - sionfel
    • Twitch.tv - Sionfel
    • YouTube - DinosaurWithRobotEye
    • View Profile
  • Faction: Nord
  • MP nick: SupaNinjaMan
  • M&BWBWF&SNWVC
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #435 on: September 30, 2009, 10:22:00 PM »
goodness vader, you are a skilled man.

nice refinement
-

cdvader

  • Guest
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #436 on: October 01, 2009, 12:35:38 PM »
Berserker Pride's agent regeneration is good, it's item based, but I thought I'd make one which would be slot based (more optimized, IMO). Thought and done.

What my script does is that every time a agent spawns somewhere, it checks if it's a king, lord, companion or you, the player, and gives the regeneration rate modifier. Then, every 3 seconds in the game, it adds the regeneration rate modifier to the HP.

It's very simple, too, so you probably won't have any troubles implementing it in. All you have to do is add 'regeneration_info,' and 'regeneration' to your battle mission templates.

(click to show/hide)
(click to show/hide)

You can also get all the scripts (clean version) here: http://www.2shared.com/file/8156078/7f4a6cbc/Regeneration.html.

NaglFaar

  • Baron
  • *
    • View Profile
  • Faction: Nord
  • MP nick: NaglFaar
  • WBM&BNW
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #437 on: October 01, 2009, 01:13:32 PM »
Nice!
I love refined scripts. Don't know why thou  :?
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.

ragnarokk1966

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
  • M&BWBWF&S
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #438 on: October 05, 2009, 07:00:39 PM »
Hello All,

I love the script that cdvader put up for adding stats to items.  I am going to mess around with it once I get home from work.  Is there anyway to add exp to the items so they will level up on their own?  Like the item you get in the Conquest mod.  Any ideas on how to do this? 

Thanks in advance

DuoGum

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #439 on: October 06, 2009, 03:12:43 PM »
The M&B version does not cause problems with the MS since the changes between 0.960 and 1.01x concerns gameplay. Not the MS structure.

Correct the first error spawned :

Quote
TypeError: 'tuple' object is not callable

It is a pure Python error, not a MS one.
You have certainly forgotten something somewhere in your typo...

I don't understand  :cry:

Berserker Pride

  • Grandmaster Knight
  • *
  • Fearless Scripter of the Berserk Mod
    • View Profile
  • Faction: Vaegir
  • MP nick: CoR_Berserker
  • WB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #440 on: October 06, 2009, 06:02:08 PM »
Missing a comma or bracket the code will probably work with 1.011 once you find the typo.

André de Cuyne

  • Knight
  • *
  • Mahaa ! ! !
    • View Profile
  • Faction: Neutral
  • WB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #441 on: October 07, 2009, 01:21:33 PM »
bla bla bla...

I don't understand  :cry:

You have forgotten a comma somewhere in your code. Certainly at the end of a line.
A tuple is a data container which in Python is enclosed with parenthesis.
Basically, the Module System is a set of lists containing tuples.
lists and tuples members MUST be separated with commas, otherwise, you get a " 'tuple' [or list] object is not callable " error.

Check the code arround the line 2625 in 'module_simple_triggers.py'.
D'or à lion de sable armé et lampassé de gueules, à bande de même chargée de trois étoiles d'argent. "J'astend fortune"

The PyME 0.9.5 is on the repository !

The simplest way to edit the Module System.

DuckSauce

  • Sergeant at Arms
  • *
    • View Profile
    • FragOut! Website
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #442 on: October 08, 2009, 01:47:28 PM »
Just a mini-script from me, nothing that grand, but some beginner may find it usefull, you never know :D
Ok so here goes, the script can be used to set the level of a skill to something lower or higher, rather then just raise(and lower) it according to what it is at that moment. For my mod this was usefull in the character backgrounds section which I expanded with something special(will probably share when done with that) as I might want to set the rider skill of a player to 9, regardless of his current level at the skill, so it won't be 10 or 8 for example.

Put this somewhere below the other scripts:
(click to show/hide)

To set the skill you call the script like this:
(click to show/hide)

Replacing skl_riding with any skill you want and 10 with any level you want it to be at.
You can also lower the skill as well.

Haven't thoroughly tested this yet, but it's a simple script so it's unlikely any major issues come up, if you try to raise above 10 it should automatically stop at 10(unless you've modded it so that you can go above 10 ofcourse).

You could for example use it for an item that while equipped changes your leadership skill to 5 but no higher or lower, no sweat if it's only 1 item maybe, but with multiple items that speficially will set rather then increase/decrease the skill level a script will be handy :D

WilliamBerne

  • Master Knight
  • *
    • View Profile
    • WWII Gunnery
  • Faction: Khergit
  • MP nick: WilliamBerne
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #443 on: October 09, 2009, 11:35:13 AM »
when you are checking a presentation in game, click left ctrl to display the coordinate that the position your mouse currently at, easy to locate the right coordinate you need.
(click to show/hide)


CinuzIta

  • Sergeant Knight at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #444 on: October 18, 2009, 04:53:27 PM »
someone can help me?

i'm trying to implement duel kit...i've managed to insert all the codes but module_game_menu's one...

while compiling, i get this error:

Code: [Select]
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
Error: Unable to find object:mt_arena_duel_thing_std
ERROR: Illegal Identifier:mt_arena_duel_thing_std
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: array_party_num
WARNING: Global variable never used: talk_array_no

______________________________

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

and here's the code:
(click to show/hide)


ideas? :?



-EDIT: SOLVED
« Last Edit: November 18, 2009, 10:22:42 PM by CinuzIta »

(click to show/hide)

Jezze

  • Baron
  • *
    • Steam - oll_jezze
    • View Profile
  • Faction: Rhodok
  • MP nick: Saltbag
  • WBM&BNWVC
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #445 on: November 20, 2009, 09:39:43 PM »
I was sick of when starting a new game, that you always spawned on the same places. So I looked for this piece of code and changed some things.

These codes regulates that you will always spawn in the neighbourhood of any trainging grounds on the map. I screwed around with the training grounds and after a while and my charac. spawned only at 1 from that time. So, to let your character spawn at much different places, I came up with this;

(click to show/hide)

I just replaced all the training_ground by villages and now every time you start a new game, your character will spawn at a random village  :). I think it is also possible for towns, castles etc. but I didn't tried that out yet.

I do not know if anyone has done this before but maybe it can help you if you need it.

NaglFaar

  • Baron
  • *
    • View Profile
  • Faction: Nord
  • MP nick: NaglFaar
  • WBM&BNW
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #446 on: November 21, 2009, 12:27:44 AM »
Could be a nice addition to a mod indeed.
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.

Pisces

  • Veteran
  • *
    • View Profile
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #447 on: November 29, 2009, 07:28:12 AM »
I've been playing around with trying to ensure certain troops have both a lance and a sword. I originally started with just adding a lance to the troop, which of course doesn't work as it adds it to the template of a troop, so the template is called and gets either a sword, lance or both randomly like normal. There appears to be no operation to give it to an agent. So I was trying an alternate strategy of reassigning the troops to an alternate entry point and deleting or removing the originals. I have very limited experience with mission_templates and scene editing so I haven't got it to work yet. I am just wondering if anyone has followed this line of logic before and can give any advice.

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #448 on: November 29, 2009, 09:11:58 PM »
Culture-specific shop inventories

Prerequisites
1. Following scripts assume that factions are set correct for all troops (normally in native for regular troops nords are outlaws, vaerigs and swadian are neutral, khergits are khergits (should be kingdom_3)).

2. Merchants factions are set to original factions of their towns.

Code injection

Anywhere in module_constants.py, better to add around other slot_item_
(click to show/hide)

At the header of module_scripts.py
(click to show/hide)

In module_scripts.py just before scripts = [
(click to show/hide)
(Respect spaces!)

In module_scripts.py in game_start
(click to show/hide)

Anywhere in module_scripts.py inside  scripts
(click to show/hide)

In armor, weapon and horse merchant refresh triggers in module_triggers.py between (try_for_range,reg(2),...), and (troop_add_merchandise,reg(2),...),
(click to show/hide)

(click to show/hide)

Remarks

1. Current code take into account all troops (regulars, lords, merchants).  To set custom range you should change
  for i_troop in xrange(len(troops)):
on
for i_troop in range(trp_troop1, trp_troop2+1):
also you need to import ID_troops. More sophisticated ranges requires more sophisticated code.

2. Non-factional items will never appear in shops.  There are multiple bypasses. Shortest by description  - add one troop per faction and fill its inventory with non-factional items that you need in shops.

3. Debug code
(click to show/hide)

4. It is possible to avoid setting faction for merchants (there are couple reasons for that). Instead you can calculate offset for reg2 from town_1_<merchant type> and get original faction of town_1 + offset.

5. Lords in native have sometimes not that evident equipment,  kettle hat will be very popular.

6. No changes are needed for def set_item_faction() if you have more or less factions or have e.g. outlaw items seller. You should check only troop factions, refresh triggers and debug code (if you are going to use the last).
« Last Edit: November 29, 2009, 10:07:22 PM by Rongar »


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.

Arnior

  • Recruit
  • *
  • Long is he waiting for Polished Landscapes...
    • View Profile
  • Faction: Bandit
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #449 on: November 30, 2009, 12:31:31 PM »
It is actually stupid you can only give your troops max agi_30, str_30 and so on. These variables are defined in header_troops.py.

I changed that file, so now everyone can give there troops a max of _255 (no higher value is possible with only changing header_troops.py, because we can only use 2 places: eg: str_243 = bignum | 0x000000f3) and a min of _1 :D.

-----------------------------------------------------------------------
So what to do:
Just change this (in header_troop.py!):

(click to show/hide)

into this:
(click to show/hide)

-------------------------------------------
I posted this before in the "guide of usefull scripts".

Because tansvanio said
(...)u should post that on the thread of the script, this is a script list thread, not a script thread ;)
I do post it here too!