PYTHON SCRIPT/SCHEME EXCHANGE

Users who are viewing this thread

Mortar Scripts(You may use it for a catapult, cannon or something).

Get it from here;
http://oguzcan.diinoweb.com/files/mortar.py

Code:
      #things must be set before fight.
      (0, 0, ti_once, [], [
          (assign,"$action_in_mortar",0),
          (assign,"$mortar_ammo",4), #This is you ammo number, type it one less.
        ]),
        #Mortar.
              #entering and leaving mortar begin;
      (1, 0, 0, [(key_is_down, key_e),(eq,"$action_in_mortar",0)], [ #You can change this button to another. See header_triggers for referances.
          (scene_prop_get_instance,":m_instance", "spr_mortar", 0),
          (prop_instance_get_position,pos1,":m_instance"),
          (get_player_agent_no,":player_agent"),
          (agent_get_position,pos2,":player_agent"),
          (get_distance_between_positions,":m_p_distance",pos1,pos2),
          (try_begin),
              (lt,":m_p_distance",300),
              (assign,"$action_in_mortar",1),
          (try_end),
          ]),
      (0.1, 0, 0, [(eq,"$action_in_mortar",1)], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_set_z_to_ground_level, pos1),
          (prop_instance_set_position,":m_c_instance",pos1),

          (assign,"$action_in_mortar",2),
          (display_message,"str_mortar_is_ready"),

          (mission_cam_set_mode,1),
          (entry_point_get_position, pos2, 30), #You have to add an entry point from edit mode. You'll look from this entry points position when you entered mortar. And make its entry_num 30
          (mission_cam_set_position, pos2),
          ]),
      (1, 0, 0, [(key_is_down, key_e),], [
          (mission_cam_set_mode,0),
          (assign,"$action_in_mortar",0),
          
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_move_z,pos1,20000),
          (prop_instance_set_position,":m_c_instance",pos1),
          ]),
              #entering and leaving mortar end*******************
          
              #navigating mortar begin;
      (0.1, 0, 0, [(key_is_down, key_left),(eq,"$action_in_mortar",2),], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0), 
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_move_x,pos1,200), #After your try. If somethings wrong about coordinates. example: you pushing right and its going somewhere else than right. Just change this coordinates. And try again.
          (position_set_z_to_ground_level, pos1),
          (prop_instance_set_position,":m_c_instance",pos1),
        ]),
      (0.1, 0, 0, [(key_is_down, key_right),(eq,"$action_in_mortar",2),], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_move_x,pos1,-200),
          (position_set_z_to_ground_level, pos1),
          (prop_instance_set_position,":m_c_instance",pos1),
        ]),
      (0.1, 0, 0, [(key_is_down, key_down),(eq,"$action_in_mortar",2),], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_move_y,pos1,200),
          (position_set_z_to_ground_level, pos1),
          (prop_instance_set_position,":m_c_instance",pos1),
        ]),
      (0.1, 0, 0, [(key_is_down, key_up),(eq,"$action_in_mortar",2),], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_move_y,pos1,-200),
          (position_set_z_to_ground_level, pos1),
          (prop_instance_set_position,":m_c_instance",pos1),
        ]),
      #navigating mortar end*******************
              #*******!:D
      (0.1, 0.5, 0, [(key_is_down, key_numpad_0),], [
          (try_begin),
              (eq,"$action_in_mortar",2),
              (assign,"$action_in_mortar",3),
              (play_sound, "snd_mortar_missile"), #You have to assign this and other sounds from module_sounds.
          (else_try),
              (eq,"$action_in_mortar",3),
              (display_message,"str_mortar_isnt_ready"), #You need to assign this and other messages from module_strings.py
          (else_try),
              (eq,"$action_in_mortar",4),
              (display_message,"str_mortar_no_ammo"),
          (try_end),
        ]),
      (0.1, 0.9, 0, [(eq,"$action_in_mortar",3),], [  # you may change 0.9 for difference of the sound. boom noise starting in 0.9 s.I'm talking about this: snd_mortar_missile
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (particle_system_burst,"psys_village_fire_big",pos1,150),   #You may change this to smoke or someting better when using this code for catapult
          (particle_system_burst, "psys_village_fire_smoke_big",pos1,300),

          (assign, ":killed_bastards", 0),
          (get_player_agent_no,":player_agent"),
          (try_for_agents,":agents"),
          (agent_is_alive, ":agents"),
          (agent_get_position,pos2,":agents"),
          (get_distance_between_positions,":boom_distance",pos1,pos2),
              (try_begin),
                  (lt,":boom_distance",600),
                  (agent_set_hit_points,":agents",0,0),
                  (agent_deliver_damage_to_agent,":player_agent",":agents"),
                  (val_add, ":killed_bastards", 1),
              (try_end),
          (try_end),
          (assign, reg5, ":killed_bastards"),
          (display_message,"str_mortar_shot"),
          (position_move_z,pos1,10000),
          (prop_instance_set_position,":m_c_instance",pos1),
        ]),
      (0.1, 5, 0, [(eq,"$action_in_mortar",3),], [
          (try_begin),
              (eq,"$mortar_ammo",0),
              (assign,"$action_in_mortar",4),
          (else_try),
              (assign,"$action_in_mortar",2),
              (val_sub,"$mortar_ammo",1),
              (display_message,"str_mortar_is_ready"),
          (try_end),
        ]),
      (0.1, 2, 0, [(eq,"$action_in_mortar",3),], [
          (scene_prop_get_instance,":m_c_instance", "spr_mortar_crosshair", 0),
          (prop_instance_get_position,pos1,":m_c_instance"),
          (position_set_z_to_ground_level, pos1),
          (prop_instance_animate_to_position,":m_c_instance",pos1,300),
        ]),

I've rewrited this codes from nothing and never tried. But it should work.

And don't forget to assign scene props. And you have to add them to scene. I could give you some example models. But I don't have them.
 
Anyway to make it as a throwable boulder? Like it hits certain targets and stops rolling afterwards. Not too many targets when it's rolling, but it stops doing any damage after the first hits.
 
It throws nothing. And its making very big damages on the ai. Killing them. My best score is 27 :razz:.
 
Blood and smoke:

Code:
    ("game_blood", psf_billboard_3d |psf_randomize_size|psf_randomize_rotation,  "prt_mesh_blood_1",
     800, 6.0, 3.5, 0.3, 0, 0,        #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
     (0.0, 0.7), (0.7, 0.7),          #alpha keys
     (0.1, 0.7), (3, 0.6),      #red keys
     (0.1, 0.7), (3, 0.6),       #green keys
     (0.1, 0.7), (3, 0.6),      #blue keys
     (0.0, 0.015),   (0.5, 0.3),  #scale keys
     (0, 0.05, 0),               #emit box size
     (0, 1.5, 0.7),                #emit velocity
     1.0,                       #emit dir randomness
     20,                         #rotation speed
     0,                         #rotation damping
    ),
    ("game_blood_2", psf_billboard_3d | psf_randomize_size|psf_randomize_rotation ,  "prt_mesh_blood_3",
     2000, 6.0, 3.5, 0.2, 0, 0,        #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
     (0.0, 0.25), (0.7, 0.1),        #alpha keys
     (0.1, 0.7), (3, 0.6),      #red keys
     (0.1, 0.7), (3, 0.6),       #green keys
     (0.1, 0.7), (3, 0.6),      #blue keys
     (0.0, 0.15),   (0.5, 0.45),    #scale keys
     (0.01, 0.2, 0.01),             #emit box size
     (1.4, 1.4, 0.5),                 #emit velocity
     1.0,                         #emit dir randomness
     150,                       #rotation speed
     0,                       #rotation damping
     ),


Code:
    ("pistol_smoke", psf_billboard_3d, "prtcl_dust_a",
     1200, 35, 0.3, 0, 60.0, 0.4,     #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
     (0.0, 0.75), (1, 0),       #alpha keys
     (0.0, 0.7), (1, 0.4),      #red keys
     (0.0, 0.7),(1, 0.4),       #green keys
     (0.0, 0.7), (1, 0.4),      #blue keys
     (0, 1.5),   (0.5, 11.0),   #scale keys
     (0.1, 0.1, 0.1),           #emit box size
     (0.5, 0.5, 0),                 #emit velocity
     0.5                        #emit dir randomness
    ),



Effect can be seen here:

Gameplay video:
High resolution download, 38MB
http://rapidshare.com/files/90523323/movie41.wmv.html
Youtube:
http://www.youtube.com/watch?v=9h5n2SpxfEA

Teaser video:
High resolution download, 40MB
http://rapidshare.com/files/90307976/Copy_of_movie4.wmv.html
Youtube:
http://www.youtube.com/watch?v=U-KsNj7mVtQ


 
Does anyone have a "formation" script that I could use? Also if someone does were would I put it?

Oh and Chel I like the blood and smoke
 
My first real script of any sort, a pub brawl script, just for the lulz.

dialogs;

    [anyone,"start", [(is_between, "$g_talk_troop", drun_begin, drun_end)], "Yes, what do you want?", "dr_1",[]],
  [anyone|plyr,"dr_1", [], "A fight!", "dr_2",[]],
  [anyone|plyr,"dr_1", [], "Nothing. Sorry to trouble you.", "close_window",[]],
  [anyone,"dr_2", [], "Oh yeah? You wanna piece of me?", "dr_3",[]],
  [anyone|plyr,"dr_3", [], "Shut up and go back home, you drunk.", "dr_4",[]],
  [anyone,"dr_4", [], "Damn you! I'll kill you!", "close_window",
  [(set_party_battle_mode),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_drunk"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_drunkard"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_drunken"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_runk"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_pifflered"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_pished"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    (try_for_agents, ":cur_agent"),
      (agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
      (eq, ":cur_agent_troop", "trp_beer"),
      (agent_set_team, ":cur_agent", 1),
    (try_end),
    ]],

consatants;

drun_begin          = "trp_drunk"
drun_end            = "trp_beer"

troops;

["drunk","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(6),reserved, fac_commoners,[itm_hide_boots],def_attrib|level(5),wp(20),knows_common,0x000000000004718201c073191a9bb10c],
  ["drunkard","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(7),reserved, fac_commoners,[itm_hide_boots, itm_staff],def_attrib|level(5),wp(20),knows_common,0x00000000001092cc01f48a3f4eaae3ac],
  ["drunken","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(:cool:,reserved, fac_commoners,[itm_hide_boots, itm_coarse_tunic],def_attrib|level(5),wp(20),knows_common,0x00000000000433c101f415ac72449f1a],
  ["pished","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(9),reserved, fac_commoners,[itm_hide_boots, itm_knife],def_attrib|level(5),wp(20),knows_common,0x000000000004201401e945cd618d5e82],
  ["pifflered","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(10),reserved, fac_commoners,[itm_hide_boots, itm_knife],def_attrib|level(5),wp(20),knows_common,0x000000000008734a01ec6a66a275d533],
  ["runk","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(11),reserved, fac_commoners,[itm_hide_boots, itm_club],def_attrib|level(5),wp(20),knows_common,0x000000000010360e01fa88137a940c94],
  ["beer","Drunk","Drunk",tf_hero, scn_town_15_tavern|entry(12),reserved, fac_commoners,[itm_hide_boots, itm_sword],def_attrib|level(5),wp(20),knows_common,0x000000000008010b01f041a9249f65fd],


You need to add quite a few more entries to the happy boar (zendar pub) in edit mode, then paste these in. You (should) get a ton of drunks, who fight you when you talk to them! They're all crap, but there are plenty of them.

Please note, this is my first script and may be buggy.  :neutral:
 
Very nice work for first time. But you don't need that much try_for_agents. :smile: Keed it up! :grin:
 
Zaitenko's Reinforcement Script

Allright I've made a modification to M&B that makes the castles/towns get reinforcements from their respective villages when they go below a number of troops in their garrisons.
I did it because I got tired of being able to tear down town defenses with alot less men than the castle/town by just attacking it repeatedly.

And when you had taken a castle/town I've never seen an npc lord that got command of it reinforce the garrison himself.

The modification makes Reinforcement parties spawn from the villages and travel to the castles/towns and then join them upon arrival.
It's set not to reinforce player owned towns/castles, but that is a personal preferance and easy to change.

To the code!!

In module_triggers we add this code. Basicly it's the main code that determins if a party should spawn, where it should go and what template it should use.

I do believe you can add the code anywhere you like in module_triggers. Afaik there are no hardwired triggers.

Code:
(36, 0, 0.0, [], [  ## Set the reinforcements interval to 36 Game hours. Change as you feel like.
                     (try_for_range, ":center", walled_centers_begin, walled_centers_end),
                         (store_faction_of_party, ":faction", ":center"),
                         (party_get_num_companions, ":garrison", ":center"),
                         (faction_get_slot, ":party_template_a", ":faction", slot_faction_reinforcements_a),
                         (faction_get_slot, ":party_template_b", ":faction", slot_faction_reinforcements_b),
                         (faction_get_slot, ":party_template_c", ":faction", slot_faction_reinforcements_c),
                         (assign, ":party_template", 0),
                         (try_begin),
                             (party_slot_eq, ":center", slot_party_type, spt_town),
                             (lt, ":garrison", 200),            ## Under this number of troops will towns get reinforcements
                             (assign, ":party_template", "pt_reinforcements"),
                         (else_try),
                             (party_slot_eq, ":center", slot_party_type, spt_castle),
                             (lt, ":garrison", 70),            ## Under this number of troops will castles get reinforcements
                             (assign, ":party_template", "pt_reinforcements"),
                         (try_end),
                         (try_begin),
                             (gt, ":party_template", 0),
                             (try_for_range, ":village_reinforcements", villages_begin, villages_end),
                                 (try_begin),
                                     (party_slot_eq, ":center", slot_party_type, spt_castle),  ## For Castles
                                     (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"),
                                     (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted
                                     (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"),  ## Not a player owned center
                                     (spawn_around_party, ":village_reinforcements", ":party_template"),
                                     (assign, ":result", reg0),
                                     (store_random_in_range, ":rand", 0, 100),
                                     (try_begin),
                                         (is_between, ":rand", 0, 45),  ## Get weakest template
                                         (party_add_template, ":result", ":party_template_a"),
                                     (else_try),
                                         (is_between, ":rand", 45, 85), ## Get stronger template
                                         (party_add_template, ":result", ":party_template_b"),
                                     (else_try),
                                         (ge, ":rand", 85), ## Get strongest template
                                         (party_add_template, ":result", ":party_template_c"),
                                     (try_end),
                                     (party_set_faction, ":result", ":faction"),
                                     (party_set_slot, ":result", slot_party_type, spt_reinforcement_party),
                                     (party_set_slot, ":result", slot_party_ai_object, ":center"),
                                     (str_store_party_name, s14, ":village_reinforcements"),
                                     (party_set_name, ":result", "@Reinforcements from {s14}"),
                                     (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
                                     (party_set_ai_object,":result", ":center"),
                                     (party_set_flags, ":result", pf_default_behavior, 1),
                                 (else_try),        
                                     (party_slot_eq, ":center", slot_party_type, spt_town), ## For Towns
                                     (party_slot_eq, ":village_reinforcements", slot_village_bound_center, ":center"),
                                     (party_slot_eq, ":village_reinforcements", slot_village_state, svs_normal), ## Not if the village is being raided or is looted
                                     (neg|party_slot_eq, ":center", slot_town_lord, "trp_player"), ## Not a player owned center
                                     (spawn_around_party, ":village_reinforcements", ":party_template"),
                                     (assign, ":result", reg0),
                                     (store_random_in_range, ":rand", 0, 100),
                                     (try_begin),
                                         (is_between, ":rand", 0, 45),  ## Get weakest template
                                         (party_add_template, ":result", ":party_template_a"),
                                     (else_try),
                                         (is_between, ":rand", 40, 85), ## Get stronger template
                                         (party_add_template, ":result", ":party_template_b"),
                                     (else_try),
                                         (ge, ":rand", 85), ## Get strongest template
                                         (party_add_template, ":result", ":party_template_c"),
                                     (try_end),
                                     (party_set_faction, ":result", ":faction"),
                                     (party_set_slot, ":result", slot_party_type, spt_reinforcement_party),
                                     (party_set_slot, ":result", slot_party_ai_object, ":center"),
                                     (str_store_party_name, s14, ":village_reinforcements"),
                                     (party_set_name, ":result", "@Reinforcements from {s14}"),
                                     (party_set_ai_behavior,":result",ai_bhvr_travel_to_party),
                                     (party_set_ai_object,":result", ":center"),
                                     (party_set_flags, ":result", pf_default_behavior, 1),
                                 (try_end),
                             (try_end),
                         (try_end),
                     (try_end)])

Okay, that's a chunk of code that I've tried to comment for clarity on some parts of it.
The reinforcements will come even if the center is being besieged, but they will come as a small party(or well, as you have defined the reinforcements in you module_party_templates) so keep an eye open while resting at a castle/town and you can intercept them before they sneak in. This makes the most sense to me, but if you don't want them to come if the castle is being besieged, simply add this code

Code:
(party_get_slot, ":besieged", ":center", slot_center_is_besieged_by),
                         (neg|ge, ":besieged", 0), #Town/castle is under siege jump out

after the begining

Code:
(try_for_range, ":center", walled_centers_begin, walled_centers_end),

I have not given that thorough testing, but I'm pretty sure that will work.

Two rather critical but very small steps will follow. First add this anywhere after the hardwired code in module_party_templates:

Code:
("reinforcements","Reinforcements",icon_axeman|pf_show_faction,0,fac_commoners,soldier_personality,[]),

Now to the next step. You may or may not have noticed that I gave the reinforcement party a party type slot called: spt_reinforcement_party
Well there is no such thing if you don't create it. So open up module_constants which is where(afaik) all the diffrent slot types are stored.
Add this line of code where the rest of the slot_party_type value's are.

Code:
spt_reinforcement_party = 14

Take notice, if you have modded in other party types your 14 slot may be taken and you may have to give it another slot value.

Easily done. Are we done? No.

At the moment we got reinforcement parties travelling allright, but they are not joining the town/castle. For this to work, we need module_simple_triggers.

I put this code close to the #Troop AI: Merchants thinking line.

Code:
(0.2,  #Every 0.2 game hours will the game check if there are any reinforcements in the centers.
   [
       (try_for_parties, ":party_no"), 
         (party_slot_eq, ":party_no", slot_party_type, spt_reinforcement_party),  #Find parties of the type spt_reinforcement_party
         (party_is_in_any_town, ":party_no"),  # Is the party in any town?
         (party_get_cur_town, ":cur_center", ":party_no"), #What town are they in?
         (call_script, "script_party_add_party_companions", ":cur_center", ":party_no"), #Add the party to the center, which is infact a party ;)
         (party_clear, ":party_no"), #Not sure if this cleaning up is necessary, but it's a precaution so we don't have a bundle of templates lying around.
       (try_end), 
    ]),

Then ofcourse you can add some hip dialoge to them if you please. I did this quickly:

Code:
# Reinforcements
  [party_tpl|pt_reinforcements,"start", [(eq,"$talk_context",tc_party_encounter),
                                         (party_get_slot, ":ai_object", "$g_encountered_party", slot_party_ai_object),
                                         (str_store_party_name,s21,":ai_object"),
                                         (str_store_party_name, s20, "$g_encountered_party")],
   "Who goes there? We are {s20}.\ We're on our way to {s21}.", "reinforcements_intro",[]],
  [anyone|plyr, "reinforcements_intro", [], "I am {playername}. I'm just passing by.", "close_window",[]],
  [anyone|plyr, "reinforcements_intro", [], "I am {playername}. And I'm here to stop you from reaching your destination!.", "reinforcement_hostile",[]],
  [party_tpl|pt_reinforcements,"reinforcement_hostile", [(faction_get_slot, ":faction_leader", "$g_encountered_party_faction",slot_faction_leader),
                                                         (str_store_troop_name, s9, ":faction_leader"),],
                                                         "What!? We are under the protection of {s9}!\ Be certain he will take vengance!", "reinforcements_attack",[]],
  [anyone|plyr, "reinforcements_attack", [], "Fine let him! I will kill him after I've dealt with you!", "close_window",[(call_script, "script_make_kingdom_hostile_to_player", "$g_encountered_party_faction", -1),
                                                                                                                          (encounter_attack,0)]],
  [anyone|plyr, "reinforcements_attack", [], "Allright, go! But you have not seen the last of me!", "close_window",[]],

Haven't really had chance to test it yet but I think it'll work.

And there you have it. Hope you like it!

Zait

Edit - Working On:
Anyway, I've updated  the script due to a simple copy/paste err of mine. The script still worked fine but it took the garrison size from the garrison AND the potential parties resting at the castle/town. This was not intended and it's been fixed. If you run the script in your mod, re-copy paste the part that goes into module_triggers.py.

Thanks NCrawler for dialogue correction.
 
That's excellent Zaitenko. One caveat I'd add is in the dialogue, if you have a high enough leadership or charisma you might be able to persuade them to join you.
 
Chel's Wound/Recovery Scheme (Optimized)

After looking over Chel's excellent script for death/wound/recovery, I've taken the liberty of streamlining and optimizing it.  I removed the player death and charms from the code, so this scheme is only for character wounding.

First, open header_mission_templates.py and add the following to the top:
Code:
from header_skills import *

Next, open module_mission_templates.py and add the following code to all of the combat related missions and change "(1, 12, ti_once, [(main_hero_fallen)]," to at least 10-12 seconds for those missions.
Code:
       (0,
		2,
		ti_once,
		[
			(main_hero_fallen)
		],
		[
			(display_message,"@You have received a serious blow. The pain is unbearable.")
		]
	),
	
	(0,
		4,
		ti_once,
		[
			(main_hero_fallen)
		],
		[
			(display_message,"@Breathe in...")
		]
	),
	
	(0,
		6,
		ti_once,
		[
			(main_hero_fallen)
		],
		[
			(display_message,"@Breathe out...")
		]
	),
	
	(0,
		8,
		ti_once,
		[
			(main_hero_fallen)
		],
		[
			(display_message,"@You make an effort to take another breath... "),
			(store_random_in_range,":wound_chance_roll",1,101),  ## chance
			(store_random_in_range,":wound_type_roll",1,101),  ## wound type
			(store_skill_level,":skill_ironflesh",skl_ironflesh,"trp_player"),
			(store_skill_level,":skill_first_aid",skl_first_aid,"trp_player"),
			(store_skill_level,":skill_wound_treatment",skl_wound_treatment,"trp_player"),
			(store_skill_level,":skill_surgery",skl_surgery,"trp_player"),
			(store_attribute_level,":attrib_charisma","trp_player",ca_charisma),
			## bonuses to outcome of knockout
			(val_sub,":attrib_charisma",10),
			(store_add,":modifier",":attrib_charisma",":skill_ironflesh"),
			(val_add,":wound_chance_roll",":modifier"),
			## decide outcome
				(try_begin),
					(is_between,":wound_chance_roll",51,100), # complete recovery, scratches bruises, no wounds
					(display_message,"@You will recover from this blow completely."),
				(else_try),
					(is_between,":wound_chance_roll",26,50), # 26-50 light wound
					(store_current_day,":currentday"),
					(assign,":healtime",31),
					(val_sub,":healtime",":skill_first_aid"),
					(val_sub,":healtime",":skill_wound_treatment"),
					(val_sub,":healtime",":skill_surgery"),
					(store_add,"$heal_day",":currentday",":healtime"),
						# wound type
						(try_begin),
							(is_between,":wound_type_roll",76,100),
							(display_message,"@You suffer a deep cut on your arm. (-1 strength)"),
							(assign,"$wound_type",1),
							(troop_raise_attribute,"trp_player",ca_strength,-1),
						(else_try),
							(is_between,":wound_type_roll",51,75),
							(display_message,"@You suffer a nasty cut on your torso. (-1 strength, -1 agility)"),
							(assign,"$wound_type",2),
							(troop_raise_attribute,"trp_player",ca_strength,-1),
							(troop_raise_attribute,"trp_player",ca_agility,-1),
						(else_try),
							(is_between,":wound_type_roll",26,50),
							(display_message,"@You suffer a blow to the head. (-1 intelligence)"),
							(assign,"$wound_type",3),
							(troop_raise_attribute,"trp_player",ca_intelligence,-1),
						(else_try),
							(display_message,"@You suffer a severe blow to your leg. (-1 agility)"),
							(assign,"$wound_type",4),
							(troop_raise_attribute,"trp_player",ca_agility,-1),
						(try_end),
				(else_try),
					(is_between,":wound_chance_roll",0,25), ## 0-25 serious wound
					(store_current_day,":currentday"),
					(assign,":healtime",31),
					(val_sub,":healtime",":skill_first_aid"),
					(val_sub,":healtime",":skill_wound_treatment"),
					(val_sub,":healtime",":skill_surgery"),
					(store_add,"$heal_day",":currentday",":healtime"),
						(try_begin),
							(is_between,":wound_type_roll",76,100),
							(display_message,"@You suffer a broken arm. (-3 strength, -1 power strike, -1 power draw)"),
							(assign,"$wound_type",5),
							(troop_raise_attribute,"trp_player",ca_strength,-3),
							(troop_raise_skill, "trp_player",skl_power_strike,-1),
							(troop_raise_skill, "trp_player",skl_power_draw,-1),
						(else_try),
							(is_between,":wound_type_roll",51,75),
							(display_message,"@You suffer a broken rib. (-2 strength, -2 agility, -1 ironflesh)"),
							(assign,"$wound_type",6),
							(troop_raise_attribute,"trp_player",ca_strength,-2),
							(troop_raise_attribute,"trp_player",ca_agility,-2),
							(troop_raise_skill, "trp_player",skl_ironflesh,-1),
						(else_try),
							(is_between,":wound_type_roll",26,50),
							(display_message,"@You suffer a heavy blow to the head. (-2 intelligence, -1 leadership, -1 tactics)"),
							(assign,"$wound_type",7),
							(troop_raise_attribute,"trp_player",ca_intelligence,-2),
							(troop_raise_skill, "trp_player",skl_leadership,-1),
							(troop_raise_skill, "trp_player",skl_tactics,-1),
						(else_try),
							(display_message,"@You suffer a broken leg. (-3 agility, -1 athletics, -1 riding)"),
							(assign,"$wound_type",8),
							(troop_raise_attribute,"trp_player",ca_agility,-3),
							(troop_raise_skill, "trp_player",skl_riding,-1),
							(troop_raise_skill, "trp_player",skl_athletics,-1),
						(try_end),
				(try_end),
		]
	),

Next, open module_game_menus.py and add the listed variables to the character gender selection sections:
Code:
       ("start_game_1",
		0,
		"Welcome, adventurer, to Mount&Blade. Before you start the game, you must create a character. To begin, select your character's gender.",
		"none",
		[],
		[
			("start_male",
				[],
				"Male",
				[
					(troop_set_type,"trp_player",0),
					(assign,"$character_gender",0),
					(assign,"$wound_type",0), # 0-8 (0=not wounded, 1-8=type of wound)
					(assign,"$heal_day",0),   # day that wound heals
					(jump_to_menu,"mnu_start_game_2")
				]
			),
			("start_female",
				[],
				"Female",
				[
					(troop_set_type,"trp_player",1),
					(assign,"$character_gender",1),
					(assign,"$wound_type",0), # 0-8 (0=not wounded, 1-8=type of wound)
					(assign,"$heal_day",0),   # day that wound heals
					(jump_to_menu,"mnu_start_game_2")
				]
			),

Lastly, open module_triggers.py and add the following trigger:
Code:
       (0.0,
		0,
		24.0,
		[
			(store_current_day,":currentday"),
			(eq,":currentday","$heal_day")
		],
		[
				(try_begin),
					(eq,"$wound_type",1), #Slight - Cut Arm
					(display_message,"@Your cut arm finally heals."),
					(troop_raise_attribute,"trp_player",ca_strength,1),
				(else_try),
					(eq,"$wound_type",2), #Slight - Cut Torso
					(display_message,"@The cut on your torso finally heals."),
					(troop_raise_attribute,"trp_player",ca_strength,1),
					(troop_raise_attribute,"trp_player",ca_agility,1),
				(else_try),
					(eq,"$wound_type",3), #Slight - Blow to Head
					(display_message,"@Your thoughts clear."),
					(troop_raise_attribute,"trp_player",ca_intelligence,1),
				(else_try),
					(eq,"$wound_type",4), #Slight - Blow to Leg
					(display_message,"@Your leg finally heals."),
					(troop_raise_attribute,"trp_player",ca_agility,1),
				(else_try),
					(eq,"$wound_type",5), #Severe - Broken Arm
					(display_message,"@Your broken arm finally heals."),
					(troop_raise_attribute,"trp_player",ca_strength,3),
					(troop_raise_skill, "trp_player",skl_power_strike,1),
					(troop_raise_skill, "trp_player",skl_power_draw,1),
				(else_try),
					(eq,"$wound_type",6), #Severe - Broken Rib
					(display_message,"@Your broken rib finally heals."),
					(troop_raise_attribute,"trp_player",ca_strength,2),
					(troop_raise_attribute,"trp_player",ca_agility,2),
					(troop_raise_skill, "trp_player",skl_ironflesh,1),
				(else_try),
					(eq,"$wound_type",7), #Severe - Heavy Blow to Head
					(display_message,"@Your headache is finally gone."),
					(troop_raise_attribute,"trp_player",ca_intelligence,2),
					(troop_raise_skill, "trp_player",skl_leadership,1),
					(troop_raise_skill, "trp_player",skl_tactics,1),
				(else_try),
					(eq,"$wound_type",8), #Severe - Broken Leg
					(display_message,"@Your broken leg finally heals."),
					(troop_raise_attribute,"trp_player",ca_agility,3),
					(troop_raise_skill, "trp_player",skl_riding,1),
					(troop_raise_skill, "trp_player",skl_athletics,1),
				(try_end),
			(assign,"$wound_type",0),
			(assign,"$heal_day",0)
		]
	),

These changes should help a bit with memory consumption and should make the scheme a bit more human-readable...


NC
 
Zaitenko's Reinforcement Script

Ok, in module_dialogs.py change this:

Code:
# Reinforcements
  [party_tpl|pt_reinforcements,"start", [(eq,"$talk_context",tc_party_encounter),
                                         (party_get_slot, s21, "$g_encountered_party", slot_party_ai_object),
                                         (str_store_party_name, s20, "$g_encountered_party")],

to this:

Code:
# Reinforcements
  [party_tpl|pt_reinforcements,"start", [(eq,"$talk_context",tc_party_encounter),
                                         (party_get_slot, ":ai_object", "$g_encountered_party", slot_party_ai_object),
                                         (str_store_party_name,s21,":ai_object"),
                                         (str_store_party_name, s20, "$g_encountered_party")],

to get it to work correctly...


NC
 
my brain's not working, and i need some volunteerism. someones already figured this out:

i need a short script/trigger with an assigned time check (6 hours, 12 hours, whatever) that will cause a bandit or searaider party to randomly decide to raid the closest village, then return to an assigned destination ie a spawned camp, boat, hold, whatever i set into the destination slot.

the assignment needs to be open like a regular lord village raid in that if a stronger enemy approaches, the outlaw/searaiders can still break off attack and run.

i want to exempt towns and castles as a raid targt, for now.

and i can't seem ta wrap my lil' brain around this. any gracious help would be appreciated. maw
 
Mirathei said:
(0, 0, 0, [(key_pressed,whatever_key),],[(call_script,"script_whichever_formation_script"),]),

Does that make any sense?

The formation scripts are awesome but I have a quick ask...

Is it possible to make these only effect agents currently selected by the order hotkeys? (eg foot, missile or horse?)
 
Python modding questions split off, since this thread isn't really the place for them:
http://forums.taleworlds.com/index.php/topic,34538.0.html
 
how to delay shots? I have made bolt action rifle, 5rounds in and i want to add 5s long pause between each shot. possible?
 
Back
Top Bottom