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

0 Members and 1 Guest are viewing this topic.

MaverickJones

  • Sergeant
  • *
  • It's better to reign in hell, than serve in heaven
    • View Profile
    • My Redbubble
  • Faction: Vaegir
  • MP nick: Maverick
  • WBNWWF&S
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #405 on: May 17, 2009, 04:55:28 PM »
I made this random script to make companions get you troops for a price a little higher than going round all the villages, and a cheat that makes them give you 20000 gold  8-)
I made it because i couldn't find anything about making a recruiter script when i was starting out, thought it might be useful for new modders.
Search for 'member_question_2 in module_dialogs.py
and insert this code underneath.

Code: [Select]
# Maverick Companion thing start
#Gain 20000 gold randomly if cheat mode is on
[anyone|plyr,"member_question_2", [(eq,"$cheat_mode",1)], "Cheat: Could you give me some cash from that large pot of gold?", "member_moneys",[]],
#recruit troops for a price
[anyone|plyr,"member_question_2", [], "Could you draft in some troops for me?", "member_draft_question",[]],


  [anyone, "member_moneys", [
    (call_script, "script_troop_add_gold", "trp_player", 20000),
], "Sure why not, there is plenty in here", "do_member_view_char",[]],

  [anyone, "member_draft_question", [], "So what kind of troops do you want me to get?", "member_draft_troop",[]],

  #Choose what troops you want
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Caravan guards.", "member_draft_troop_2",[ (assign, "$cost_draft", 400),(assign, "$draft_id", "trp_caravan_guard"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Watchmen.", "member_draft_troop_2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_watchman")]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Huntresses.", "member_draft_troop_2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_hunter_woman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Swadian recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_swadian_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Vaegir recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_vaegir_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Khergit tribesmen.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_khergit_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Nord recruits.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_nord_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Rhodok tribesmen.", "member_draft_troop_2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_rhodok_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like 10 Looters.", "member_draft_troop_2",[(assign, "$cost_draft", 50), (assign, "$draft_id", "trp_looter"),]],
  [anyone|plyr,"member_draft_troop", [], "Never mind.", "close_window",[]],
 
  [anyone,"member_draft_troop_2",[
  (party_add_members, "p_main_party", "$draft_id", 10),
(troop_remove_gold, "trp_player", "$cost_draft"),
], "It didn't take much to convince them to join you, Hope they serve you well.", "do_member_view_char",[]],
# Maverick Companion thing End

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: kt0's guide to overpowered items
« Reply #406 on: May 17, 2009, 06:15:15 PM »
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...
Actually, yes, this can be applied to horses (I'm adding one to Conquest).  Clever construction of item data can swap out items seamlessly from the player's point of view.  Skill bonuses are strictly optional.  The window dressing around the system can also be trivially changed to be less magicky.  The only possible caveats are if you're hiding data in item slots or keeping a hold of item IDs elsewhere at which point you'd need to do the crossref patchups when swapping the item.

Example horse item levels:
(click to show/hide)

My entries are a little more complicated than that because I've hacked the compilation process to write the code that sets up the slots for me (I'm lazy like that).  If you'd like to see that stuff, feel free to PM me. 

Amman de Stazia

  • Master Knight
  • *
  • schizophrenic? There's three of us now!
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #407 on: May 22, 2009, 09:18:36 AM »
Thanks kt0.

Mrs de Stazia cobbled together something, implementing a new skill to decide whether the horse gets 'upgraded' or not, rather than using XP.

Can't publish it just yet, it might become part of TPW and it'll be up to the team to decide if anything should be open sourced.
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

rubik

  • Squire
  • *
    • View Profile
  • Faction: Vaegir
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #408 on: May 25, 2009, 09:43:32 AM »
There is a big problem about upgrading the regulars all the time that you can only upgrade them one by one. If 100  regulars can upgrade, you need to click left mouse button 100 times.

I have write some code to solve the problem.

Source code:

At first, define slot_root_troop in module_constants.py, it is a troop slot. make sure it does not clash with your mod's other slot usage.

Paste the following into module_scripts.py
(click to show/hide)

The following into module_game_menus.py:
(click to show/hide)

The following into module_presentations.py:
(click to show/hide)

screenshots:
(click to show/hide)
« Last Edit: December 12, 2009, 10:29:19 AM by rubik »

MaverickJones

  • Sergeant
  • *
  • It's better to reign in hell, than serve in heaven
    • View Profile
    • My Redbubble
  • Faction: Vaegir
  • MP nick: Maverick
  • WBNWWF&S
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #409 on: May 25, 2009, 01:40:15 PM »
awesome code Rubik !!!

Amman de Stazia

  • Master Knight
  • *
  • schizophrenic? There's three of us now!
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #410 on: May 30, 2009, 02:52:27 PM »
indeed, well done.
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

bjorne.

  • Sergeant Knight
  • *
  • I'm a nerd... deal with it..
    • View Profile
    • Age of Blackpowder - Realm of Revolution
  • Faction: Swadian
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #411 on: June 15, 2009, 10:47:36 PM »
Code: [Select]
["grenade","Hand_Grenade", [("throwing_stone",0)], itp_type_thrown |itp_merchandise|itp_primary ,itcf_throw_stone, 1 , weight(4)|difficulty(0)|spd_rtng(97) | shoot_speed(30) | thrust_damage(10 ,  blunt)|max_ammo(18)|weapon_length(8),imodbit_large_bag ],
 [(ti_on_weapon_attack, [(assign,":distance",99999),(try_for_agents,":agent"),
                            (particle_system_burst, ""night_smoke_1"", pos1, 15),
                            (position_move_y,pos1,10),
                            (copy_position,pos2,pos1),
                            (position_set_z_to_ground_level, pos2),
                            (get_distance_between_positions,":dist",pos1,pos2),
                            (lt,":dist",10),
                            (particle_system_burst, "fireplace_fire_big", pos1, 15),
                            (particle_system_burst, "grenade_smoke", pos1, 15),
                            (play_sound,"snd_pistol_shot"),
                            (try_for_agents,":agent"),
                               (agent_get_position,pos2,":agent"),
                               (get_distance_between_positions,":dist",pos1,pos2),
                               (lt,":dist",300),
                               (agent_set_hit_points,":agent",0,0),
                               (agent_deliver_damage_to_agent,":agent",":agent"),
                            (end_try),
                            (scene_prop_get_instance,":instance", "spr_explosion", 0),
                            (position_copy_origin,pos2,pos1),
                            (prop_instance_set_position,":instance",pos2),
                            (position_move_z,pos2,1000),
                            (prop_instance_animate_to_position,":instance",pos2,175),
                            (assign,reg5,1000),
                          (end_try),],)]],

Well I got this code from the Curtain of Fire. To test with. So I get the hang of it when trying to make grenades for my mod. And I don't really know if this will work or not. And if it doesn't what's the problem..
If you wonder why I cannot check if it works or not. It's because currently I have some virus that makes my computer to crash when I run the .bat files.

you1

  • Knight at Arms
  • *
  • Twitter @b18rys
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #412 on: June 22, 2009, 06:20:02 PM »
First post here so I hope I've got the right place

has someone found a way to give horses the same Heraldry coat of arms as the lord,

I've made several new horse blankets and would like to have the troops under the lord have the same blanket, the same way the troop shields work.

I guess like the Heraldry surcoats you would need a horse one,
What code should I be looking for, is it possible, I prefer to fight battles by the coat of arms and not have loads of green test boxes everywhere.

Slawomir of Aaarrghh

  • Grandmaster Knight
  • *
    • YouTube - daedalus1pl
    • View Profile
    • The Deluge
  • Faction: Neutral
  • MP nick: Daedalus
  • WBM&BWF&SVCNW
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #413 on: June 23, 2009, 02:31:08 PM »
I played with heraldry system a bit and I found out that it doesn't work on horses and helmets (and gloves, as I remember correctly). For some reason they ignore tableau materials and use only default material, that is assigned to the mesh in .brf file, so heraldry won't work on them (at least not in the way that it works on armors and shields).

So I guess to have different horses you'll have to clone horse mesh in BRFedit and assign them different materials.

you1

  • Knight at Arms
  • *
  • Twitter @b18rys
    • View Profile
  • Faction: Neutral
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #414 on: June 23, 2009, 11:12:32 PM »
I played with heraldry system a bit and I found out that it doesn't work on horses and helmets (and gloves, as I remember correctly). For some reason they ignore tableau materials and use only default material, that is assigned to the mesh in .brf file, so heraldry won't work on them (at least not in the way that it works on armors and shields).

So I guess to have different horses you'll have to clone horse mesh in BRFedit and assign them different materials.

Thks slawomir ,"For some reason they ignore tableau materials " this would mean somewhere an instruction is stopping or skiping, What part of the code was you working with "I played with heraldry system" my mods future depends on this working so I need to dig and find a way!

Slawomir of Aaarrghh

  • Grandmaster Knight
  • *
    • YouTube - daedalus1pl
    • View Profile
    • The Deluge
  • Faction: Neutral
  • MP nick: Daedalus
  • WBM&BWF&SVCNW
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #415 on: June 28, 2009, 05:55:31 PM »
Thks slawomir ,"For some reason they ignore tableau materials " this would mean somewhere an instruction is stopping or skiping, What part of the code was you working with "I played with heraldry system" my mods future depends on this working so I need to dig and find a way!

Well, I tried to set different materials and shaders in brf, tried to alter the scripts and tableau materials. I can make whatever I want with armors and shields, but I can do nothing with horses and helmets. Tableau materials just don't work on them for some reason. I have no idea why. I even used my own scripts that change textures on armors, but all I achieved was making horse non-transparent (shaders worked correctly, like on normal horse), but it was still using default texture form brf, not the one applied with a script.

I know SantasHelper is going to give a try to make heraldic horses work. He's a really smart fellow, so I wouldn't be suprised if he actually figured that out and made it working. Try asking him.

Gniewomir

  • Guest
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #416 on: July 16, 2009, 06:11:57 PM »
is there version of "prisoner talk" compatible with native ?

FrisianDude

  • Coitus non Awesome
  • Archduke
  • *
  • Zis is Tshörman tärritorie!
    • View Profile
  • Faction: Neutral
  • MP nick: Liudulf Ward/Léodwulf
  • M&BWB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #417 on: July 16, 2009, 07:18:13 PM »
There is a big problem about upgrading the regulars all the time that you can only upgrade them one by one. If 100  regulars can upgrade, you need to click left mouse button 100 times.

I have write some code to solve the problem.

Source code:

(click to show/hide)

screenshots:
(click to show/hide)
Sounds very nice, but what does "define slot_troop"  mean? :?

(click to show/hide)

Well I got this code from the Curtain of Fire. To test with. So I get the hang of it when trying to make grenades for my mod. And I don't really know if this will work or not. And if it doesn't what's the problem..
If you wonder why I cannot check if it works or not. It's because currently I have some virus that makes my computer to crash when I run the .bat files.
If you're thinking one should just put that in module_items, you'd get errors while building.
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. Play Vikingr!

Graylord

  • Count
  • *
  • Fiddlesticks, i say!
    • View Profile
    • Ultimate Gamer
  • Faction: Vaegir
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #418 on: July 18, 2009, 08:37:48 AM »
If you had opened module_constants.py, i am pretty sure you would realize it instantly.
Anyway, it means that you simply enter slot_root_troop in the same fashion the other slots are defined in the file:

slot_root_troop = whatever
I'm making a game!

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

FrisianDude

  • Coitus non Awesome
  • Archduke
  • *
  • Zis is Tshörman tärritorie!
    • View Profile
  • Faction: Neutral
  • MP nick: Liudulf Ward/Léodwulf
  • M&BWB
Re: PYTHON SCRIPT/SCHEME EXCHANGE
« Reply #419 on: July 18, 2009, 04:26:52 PM »
Ah, yes. Sorry, I hardly ever visited the module_constants, and it seems I wasn't reading all too well then either. :oops:
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. Play Vikingr!