PYTHON SCRIPT/SCHEME EXCHANGE

Users who are viewing this thread

Yeah, I implemented debug code, I checked unit factions and I supposed it will distribute items like that, and no khergit lords and units have great helm or plate armor or coat of plates equiped and swadians banded armor, tribal outfit, no nords have mail over surcoat, surcoat over mail... and that was strange to me. So I asked is that should be like that and is there way to distribute items in shops manually.

EDIT: and I forgot, it shows first letters of factions names, and it shows some numbers also, something like 1552, 1225...
 
I have the same erratic shopping with this script. While all factions are defined correctly for items (I checked directly the resulting mask), some of the factions have their items appearing in all the shops, while other factions work just fine (and horses work just fine for their respective shops all the way).
Also items that belong to no faction (with 0 mask) appear in faction shops anyway, while I can't see how the distribution code can assign them nonzero probability...
I did not try to debug on the level of probabilities yet (low priority stuff)

EDIT: forgot to mention - this is the most excellent script anyway, Rongar :smile: and it looks totally correct to me
 
iggorbb said:
So I asked is that should be like that
No, It should not.

iggorbb said:
and is there way to distribute items in shops manually.
Base on my code? Yes of course and this way is insane. You will have to calculate and set into items slots binary masks.

iggorbb said:
EDIT: and I forgot, it shows first letters of factions names, and it shows some numbers also, something like 1552, 1225...
Numbers are faction masks.
Letters, are they correct or not? What letters does plate armor (or other wrong items) have?
I try to find out which step is broken for you ---  masks, shops or something else.

EDIT:
GetAssista said:
Also items that belong to no faction (with 0 mask) appear in faction shops anyway, while I can't see how the distribution code can assign them nonzero probability...
That means shops are broken. I'll try to  look into why it can be.
 
Something like mask=0, mask=some number, and i am sure that same item is used by someone.
There is for example some armor it says it is nord but it is in swadian shop or something like that, than for leather jerkin says its nobodies but I'm sure that at least 3 factions are using it, next, says great helmet in nord, vaeghir, khergit and so on, but only swadians wearing great helmets (lords and soldiers). I copy/pasted all from scripts you posted, respected lines, all compiles right, its working, but somethings wrong with it, at least in my mode.


EDIT: Numbers are:
saddle horse: 8388610 (used by all- game not sayin anything), mail with surcoat mask 10 (used- swadians, game-nobody uses), mail coif mask 10 (used by swads and vaeghirs- game- nobody uses), padded coif mask 67108874 used swads rhodocks- game - nobody uses, bardiche mask 1048586 helmet with cap mask 10 volgue mask 67108874 and so on. All this items are used by somebody but game says nobody uses them.
 
iggorbb said:
EDIT: Numbers are:
saddle horse: 8388610 (used by all- game not sayin anything), mail with surcoat mask 10 (used- swadians, game-nobody uses), mail coif mask 10 (used by swads and vaeghirs- game- nobody uses), padded coif mask 67108874 used swads rhodocks- game - nobody uses, bardiche mask 1048586 helmet with cap mask 10 volgue mask 67108874 and so on. All this items are used by somebody but game says nobody uses them.
This means you mask generation is broken. And script works correctly in this department, I tested it extensively.
Does you "game-nobody uses" means this item is absolutely positively not in module_troops.py?
Did you add factions/cultures? If you add enough you can have mask overflow with all the unintended consequences. 
 
GetAssista said:
Also items that belong to no faction (with 0 mask) appear in faction shops anyway, while I can't see how the distribution code can assign them nonzero probability...
What is about merchants factions? It is most likely reason. If a merchant is commoner he has zero probability for all items, and seems the engine considers such distribution as uniform.


Added:

iggorbb said:
saddle horse: 8388610 (used by all- game not sayin anything), mail with surcoat mask 10 (used- swadians, game-nobody uses), mail coif mask 10 (used by swads and vaeghirs- game- nobody uses), padded coif mask 67108874 used swads rhodocks- game - nobody uses, bardiche mask 1048586 helmet with cap mask 10 volgue mask 67108874 and so on. All this items are used by somebody but game says nobody uses them.
Just a possible place of error.
helmet with cap=norman_helmet in native is used by
mercenary_horseman - neutral (normal)
swadian_sharpshooter, swadian_man_at_arms - neutral (cause, faction is set not correct in native for some troops)
Thus script considers helmet with cap as used by nobody. Should fix faction for troops.
 
GetAssista said:
This means you mask generation is broken. And script works correctly in this department, I tested it extensively.
Does you "game-nobody uses" means this item is absolutely positively not in module_troops.py?
Did you add factions/cultures? If you add enough you can have mask overflow with all the unintended consequences.
by game-nobody uses I mean that some items are used by some soldiers and there is not no s(swads) or v(vaeghirs) things under it.
Yes I got kingdom managment implemented with my own troop tree, but they are using none native items, and those items are below rabati, or whatever is last thing in mod_items.

Rongar[quote author=Rongar said:
Just a possible place of error.
helmet with cap=norman_helmet in native is used by
mercenary_horseman - neutral (normal)
swadian_sharpshooter, swadian_man_at_arms - neutral (cause, faction is set not correct in native for some troops)
Thus script considers helmet with cap as used by nobody. Should fix faction for troops.

So is that means that I cant use it?
 
iggorbb said:
So is that means that I cant use it?
That means only that before use you should set correct factions for troops. I.e. make swadian kingdom_1, vaerigs kingdom_2 and so on.
 
I learned so much in this thread, so i think its finally time to contribute.
Here is my reworked version of the Weapon Proficiency Loss Script from Garnier.

It takes now the weapon master skill into account to determine the lower limit and the amount of loss.

(I hope i posted this now in the correct thread, was at first posting in the guide of useful scripts - but i guess it belongs to here)

## Abhuva Loose Weapon Proficiency every week Begin
## Original script by Garnier
  # Reduce proficiencies slightly every week
  ## script changed so it shows message on how many the prof decreases, weapon master skill affect lower limit and decrease
  # Formula: prof_lower_limit = 25 base, * (weapon_master_skill + 1) --> 25 - 275
  #
  (7 * 24 ,  ## 7 * 24 for real
  [
      (store_proficiency_level,":wp_prof_one_handed_weapon","trp_player",wpt_one_handed_weapon),
      (store_proficiency_level,":wp_prof_two_handed_weapon","trp_player",wpt_two_handed_weapon),
      (store_proficiency_level,":wp_prof_polearm","trp_player",wpt_polearm),
      (store_proficiency_level,":wp_prof_archery","trp_player",wpt_archery),
      (store_proficiency_level,":wp_prof_crossbow","trp_player",wpt_crossbow),
      (store_proficiency_level,":wp_prof_throwing","trp_player",wpt_throwing),
      (store_skill_level, ":weapon_master", skl_weapon_master, "trp_player"),     

      (val_add, ":weapon_master", 1),  ## to avoid dividing through zero / range from 1..11
  (assign, ":prof_lower_limit",25),  ## every point in weapon master adds 25 to lower-limit-weapon-prof
  (val_mul, ":prof_lower_limit", ":weapon_master"),
  (val_div, ":weapon_master", 2),  # halfed, for calculating decreases
      (val_add, ":weapon_master",1), # avoid dividing through zero, range from 1..6  

      (try_begin),
        (ge, ":wp_prof_one_handed_weapon", ":prof_lower_limit"),
        (val_sub, ":wp_prof_one_handed_weapon", ":prof_lower_limit"),
(val_add, ":wp_prof_one_handed_weapon", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_one_handed_weapon", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_one_handed_weapon", ":wp_prof_decrease"),
        (val_add, ":wp_prof_one_handed_weapon", ":prof_lower_limit"),
(val_sub, ":wp_prof_one_handed_weapon", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_one_handed_weapon, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_one_handed_weapon, ":wp_prof_one_handed_weapon"),
(assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in one handed weapons decreases by {reg3}.", 0xFF8000),
      (try_end),

      (try_begin),
        (ge, ":wp_prof_two_handed_weapon", ":prof_lower_limit"),
        (val_sub, ":wp_prof_two_handed_weapon", ":prof_lower_limit"),
(val_add, ":wp_prof_two_handed_weapon", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_two_handed_weapon", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_two_handed_weapon", ":wp_prof_decrease"),
        (val_add, ":wp_prof_two_handed_weapon", ":prof_lower_limit"),
(val_sub, ":wp_prof_two_handed_weapon", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_two_handed_weapon, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_two_handed_weapon, ":wp_prof_two_handed_weapon"),
    (assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in two handed weapons decreases by {reg3}.", 0xFF8000),
      (try_end),

      (try_begin),
        (ge, ":wp_prof_polearm", ":prof_lower_limit"),
        (val_sub, ":wp_prof_polearm", ":prof_lower_limit"),
(val_add, ":wp_prof_polearm", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_polearm", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_polearm", ":wp_prof_decrease"),
        (val_add, ":wp_prof_polearm", ":prof_lower_limit"),
(val_sub, ":wp_prof_polearm", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_polearm, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_polearm, ":wp_prof_polearm"),
(assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in polearms decreases by {reg3}.", 0xFF8000),
      (try_end),

      (try_begin),
        (ge, ":wp_prof_archery", ":prof_lower_limit"),
        (val_sub, ":wp_prof_archery", ":prof_lower_limit"),
(val_add, ":wp_prof_archery", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_archery", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_archery", ":wp_prof_decrease"),
        (val_add, ":wp_prof_archery", ":prof_lower_limit"),
(val_sub, ":wp_prof_archery", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_archery, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_archery, ":wp_prof_archery"),
(assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in archery decreases by {reg3}.", 0xFF8000),

      (try_end),

      (try_begin),
        (ge, ":wp_prof_crossbow", ":prof_lower_limit"),
        (val_sub, ":wp_prof_crossbow", ":prof_lower_limit"),
(val_add, ":wp_prof_crossbow", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_crossbow", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_crossbow", ":wp_prof_decrease"),
        (val_add, ":wp_prof_crossbow", ":prof_lower_limit"),
(val_sub, ":wp_prof_crossbow", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_crossbow, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_crossbow, ":wp_prof_crossbow"),
(assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in crossbows decreases by {reg3}.", 0xFF8000),

      (try_end),

      (try_begin),
        (ge, ":wp_prof_throwing", ":prof_lower_limit"),
        (val_sub, ":wp_prof_throwing", ":prof_lower_limit"),
(val_add, ":wp_prof_throwing", 25),
        (store_div, ":wp_prof_decrease", ":wp_prof_throwing", 25),  # for every 25 points over the limit decrease by 1
(store_div, ":wp_prof_decrease", ":wp_prof_decrease", ":weapon_master"),  ## apply weapon master skill
(val_add, ":wp_prof_decrease",1),  # make sure that in every case it lowers the prof by atleast 1 point when over the limit       
(val_sub, ":wp_prof_throwing", ":wp_prof_decrease"),
        (val_add, ":wp_prof_throwing", ":prof_lower_limit"),
(val_sub, ":wp_prof_throwing", 25),
        (troop_raise_proficiency_linear, "trp_player", wpt_throwing, -10000),
        (troop_raise_proficiency_linear, "trp_player", wpt_throwing, ":wp_prof_throwing"),
(assign,reg3,":wp_prof_decrease"),
(display_message, "@_Your proficiency in throwing weapons decreases by {reg3}.", 0xFF8000),

      (try_end),
    ]),

## Abhuva Loose Weapon Proficiency End
 
Doh, this is where this thread went...can't believe I didn't notice it for so long. Anyway, have fun with this.

MadocComadrin said:
So I was playing persistent world mod when I noticed that the chat is completely cluttered and you have no way to chat privately to your faction, so I decided to put this together as a favor and make it customizable.

add this to the end before the closing "]"
Code:
("send_faction_message",prsntf_manual_end_only, 0,[
    (ti_on_presentation_load,
       [(set_fixed_point_multiplier, 1000),
        (init_position, pos1),
        (str_store_string, s1, "str_say_color_faction"),
        (create_text_overlay, reg1, s1,),
        (overlay_set_color, reg1, 0xFFFFFFFF),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 530),
        (overlay_set_position, reg1, pos1),
        (overlay_set_text, reg1, s1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 800),
        (overlay_set_size, reg1, pos1),

        (create_simple_text_box_overlay, "$g_presentation_obj_fac_message", tf_center_justify),
        (position_set_x, pos1, 200),
        (position_set_y, pos1, 500),
        (overlay_set_position, "$g_presentation_obj_fac_message", pos1),
        (position_set_x, pos1, 500),
        (position_set_y, pos1, 800),
        (overlay_set_size, "$g_presentation_obj_fac_message", pos1),
		
        (assign, "$g_waiting_to_send_fac_chat", 1),
        (str_clear, s0),
        (overlay_set_text, "$g_presentation_obj_fac_message", s0),
        (assign,"$g_waiting_for_confirmation_to_terminate", 1),
        (presentation_set_duration, 999999),
      ]),

      (ti_on_presentation_event_state_change,
              [(store_trigger_param_1, ":object"),
              (try_begin),
                  (eq,":object", "$g_presentation_obj_fac_message"),
              (try_end),
              (try_begin),
                  (neq,"$g_waiting_to_send_fac_chat",1),
                  (multiplayer_send_string_to_server, multiplayer_event_new_fac_chat, s0),
                  (assign, "$g_waiting_for_confirmation_to_terminate", 0),
                  (presentation_set_duration, 0),
              (try_end),
        ]),

       (ti_on_presentation_run,
           [(store_trigger_param_1, ":cur_time"),
           (try_begin),
                 (key_clicked, key_escape),
                 (assign, "$g_waiting_for_confirmation_to_terminate", 0),
                 (presentation_set_duration, 0),
                 (assign, "$g_waiting_to_send_fac_chat", 0),
           (else_try),
                  (key_clicked, key_enter),
                  (assign, "$g_waiting_to_send_fac_chat", 0),
           (try_end),
        ]),
    ]),

Add these to your server events
Code:
multiplayer_event_return_max_num_bots                         = 106
multiplayer_event_return_server_mission_timer_while_player_joined = 107
[color=blue]###NEW###
multiplayer_event_new_fac_chat                                = 108
###NEXT FREE NUMBER FOR EVENTS ================================ 110[/color]

Add this to your client events
Code:
multiplayer_event_admin_set_anti_cheat                        = 44
multiplayer_event_open_game_rules                             = 45
[color=blue]###NEW###
multiplayer_event_display_fac_chat                            = 109[/color]

Add these anywhere
Code:
fac_red                                       = 0
fac_white                                     = 1
fac_blue                                      = 2
fac_green                                     = 3
fac_gold                                      = 4
fac_max_fac                                   = 5


Module_Scripts
Code:
(else_try),
        (eq, ":event_type", multiplayer_event_admin_set_force_default_armor),
        (try_begin),
          (store_script_param, ":value", 3),
          #validity check
          (player_is_admin, ":player_no"),
          (is_between, ":value", 0, 2),
          #condition checks are done
          (assign, "$g_multiplayer_force_default_armor", ":value"),
        (try_end),		
	 [color=blue] ###NEW###
      (else_try),
        (eq, ":event_type", multiplayer_event_new_fac_chat),
        (try_begin), ###Get sender players color
                (str_store_player_username, s1,":player_no"),
                (str_store_string, s4, "@[{s1}] {s0}"),
                (server_add_message_to_log, s4),
                (call_script, "script_get_player_color_faction", ":player_no"),
                (assign, ":player_fac", reg0),
		  
                (get_max_players, ":players"), #Get destination players' cokor based on color faction
                (try_for_range, ":dest_player_no", 1, ":players"),
                        (try_begin),
			    (player_is_active, ":dest_player_no"),
				(call_script, "script_get_player_color_faction", ":dest_player_no"),
				(eq, reg0, ":player_fac"),
				(multiplayer_send_string_to_player, ":dest_player_no", multiplayer_event_display_fac_chat, s4),
                        (try_end),
                (try_end), 
	  (try_end),
	 ###NEWEND###[/color]
(else_try),
        ###############
        #CLIENT EVENTS#
        ###############
        (neq, multiplayer_is_server),
        (try_begin),     

Code:
    (else_try),
          (eq, ":event_type", multiplayer_event_return_player_respawn_spent),
          (store_script_param, ":value", 3),
          (try_begin),
            (gt, "$g_my_spawn_count", 0),
            (store_add, "$g_my_spawn_count", "$g_my_spawn_count", ":value"),
          (else_try),
            (assign, "$g_my_spawn_count", ":value"),      
          (try_end),
           [color=blue]###NEW###
	(else_try),
		  (eq, ":event_type", multiplayer_event_display_fac_chat),
		  (multiplayer_get_my_player, ":player_no"),
		  (call_script, "script_get_player_color_faction", ":player_no"),
		  (assign, reg0, fac_gold),
		  
		  #Color factions are related to the hex code for color displayed
		  (try_begin),
		     (eq,reg0, fac_red),
		     (display_message, s0, 0xFF0000),
		  (else_try),
		     (eq,reg0, fac_white),
		     (display_message, s0, 0x000000),
		  (else_try),
		     (eq,reg0, fac_blue),
		      (display_message, s0, 0x0000FF),
		  (else_try),
		     (eq,reg0, fac_green),
		     (display_message, s0, 0x00FF00),
		  (else_try),
		     (eq,reg0, fac_gold),
		     (display_message, s0, 0xFFF500),
                 (try_end),[/color]
    (try_end),
     ]), 

	 
  # script_cf_multiplayer_evaluate_poll
  # Input: none
  # Output: none (can fail)
  ("cf_multiplayer_evaluate_poll",

Code:
#####################################
  #get_player_faction
  #input:  arg1=player id
  #output: reg0=player's color faction, returns -1 if no faction.
  #####################################
  ("get_player_color_faction",
    [
	  (store_script_param_1, ":player_no"),
	  (player_get_agent_id, ":agent_no", ":player_no"),
          (assign, reg0, -1)
      (try_begin), #RED TEAM
		(assign, reg0, fac_red),
	  (else_try), #WHITE TEAM
	    #INSERT CONDITIONS HERE
		(assign, reg0, fac_white),
	  (else_try), #BLUE TEAM
	    #INSERT CONDITIONS HERE
		(assign, reg0, fac_blue),
	  (else_try), #GREEN TEAM
	    #INSERT CONDITIONS HERE
		(assign, reg0, fac_green),
	  (else_try), #GOLD TEAM
	    #INSERT CONDITIONS HERE
	    (assign, reg0, fac_gold),
	  (try_end),
  ]),


Add this to the triggers for whatever mission template (game mode) you want to use faction chat in.
You can change "key_u" to whatever key you like.
Code:
(0, 0, 0, [],
       [ 
         (try_begin),
		   (eq, "$g_waiting_for_confirmation_to_terminate", 0),
		   (multiplayer_get_my_player, ":player_no"),
		   (player_is_active, ":player_no"),
           (key_clicked, key_u), 
           (start_presentation, "prsnt_send_faction_message"),
         (try_end),		   
       ]),

Well, that's about it. How does it look to you guys?
Also, how do you move the focus automatically to the chat box so you don't have to click on it?

Edit: made to look more like the other chats

 
Here is what I use for quick starting my mod for testing, it jumps right to the map with one click.

#QUICKSTART##########################
    ("start_mod",[],"Quick Character (for mod testing)",
      [
        (troop_set_type,"trp_player",0),
        (assign,"$character_gender",tf_male),
(set_show_messages, 0),
(troop_add_gold, "trp_player", 80000),
        (troop_add_item, "trp_player","itm_leather_jerkin",0),
        (troop_add_item, "trp_player","itm_leather_boots",0),
       
        (troop_add_item, "trp_player","itm_sword_medieval_a", 0),
        (troop_add_item, "trp_player","itm_saddle_horse",0),
        (troop_add_item, "trp_player","itm_smoked_fish",0),

        (troop_raise_attribute, "trp_player",ca_strength,100),
        (troop_raise_attribute, "trp_player",ca_agility,100),
        (troop_raise_skill, "trp_player","skl_power_strike",10),
        (troop_raise_skill, "trp_player","skl_riding",10),
        (troop_raise_skill, "trp_player","skl_pathfinding",10),
        (troop_raise_skill, "trp_player","skl_spotting",10),
        (troop_raise_skill, "trp_player","skl_athletics",10),
(troop_equip_items,"trp_player"),
(change_screen_map),
        ]
  ),
###################################

Add it directly after this:
  ("start_game_0",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "Welcome, adventurer, to Mount and Blade: Warband. Before beginning the game you must create your character. Remember that in the traditional medieval society depicted in the game, war and politics are usually dominated by male members of the nobility. That does not however mean that you should not choose to play a female character, or one who is not of noble birth. Male nobles may have a somewhat easier start, but women and commoners can attain all of the same goals -- and in fact may have a much more interesting if more challenging early game.",
    "none",
    [],
    [
 
Egbert said:
Here is what I use for quick starting my mod for testing, it jumps right to the map with one click...

I think I like this one better than the one I'm using...(from Armagan's old tutorial). 'Cept you forgot to assign to your party a few custom-made killers.

Thanks for the tip.
 
Egbert said:
Here is what I use for quick starting my mod for testing, it jumps right to the map with one click.

#QUICKSTART##########################
    ("start_mod",[],"Quick Character (for mod testing)",
      [
        (troop_set_type,"trp_player",0),
        (assign,"$character_gender",tf_male),
(set_show_messages, 0),
(troop_add_gold, "trp_player", 80000),
        (troop_add_item, "trp_player","itm_leather_jerkin",0),
        (troop_add_item, "trp_player","itm_leather_boots",0),
       
        (troop_add_item, "trp_player","itm_sword_medieval_a", 0),
        (troop_add_item, "trp_player","itm_saddle_horse",0),
        (troop_add_item, "trp_player","itm_smoked_fish",0),

        (troop_raise_attribute, "trp_player",ca_strength,100),
        (troop_raise_attribute, "trp_player",ca_agility,100),
        (troop_raise_skill, "trp_player","skl_power_strike",10),
        (troop_raise_skill, "trp_player","skl_riding",10),
        (troop_raise_skill, "trp_player","skl_pathfinding",10),
        (troop_raise_skill, "trp_player","skl_spotting",10),
        (troop_raise_skill, "trp_player","skl_athletics",10),
(troop_equip_items,"trp_player"),
(change_screen_map),
        ]
  ),
###################################

Add it directly after this:
  ("start_game_0",menu_text_color(0xFF000000)|mnf_disable_all_keys,
    "Welcome, adventurer, to Mount and Blade: Warband. Before beginning the game you must create your character. Remember that in the traditional medieval society depicted in the game, war and politics are usually dominated by male members of the nobility. That does not however mean that you should not choose to play a female character, or one who is not of noble birth. Male nobles may have a somewhat easier start, but women and commoners can attain all of the same goals -- and in fact may have a much more interesting if more challenging early game.",
    "none",
    [],
    [
i-love-you-dad.jpg
 
I am wondering if it is possible to make it so that you don`t lose money when you buy something in MP, but you still can`t buy stuff that you can`t afford. Here is an example: I start whit 1000 gold and buy equipment, I don`t lose any gold when I bought equipment. I kill a man and earn 200 gold, so now I have 1200. I die and buy equipment for my 1200 gold, but after I bought the new equipment I still have 1200  gold.

I am guessing that I only have to disable the script that makes me lose money, right? But I don`t know where that script is and what part of it I should disable :roll:
 
A bug I came across after adding more banners was that the bandit lair map icon got changed to a map flag icon. Apparently, static parties cannot have a map icon with an ID greater than 255. Since the bandit lair icon in Native is ID 188, it doesn't have this bug. But if you add icons before the bandit lair it can push it past 255, which makes the ID wrap around and reuse another icon (usually a map flag). There is a command that is commented out (not sure what it does) "#(party_set_flags, ":new_camp", pf_icon_mask, 1),". This can change which icon is used, but I couldn't make it use one higher than 255.

If you get this bug, just move the bandit_lair icon up in the file near the bridge icon.
 
A simple script to simulate exhaustion regarding map travel speed:

(1, [
(try_begin),
(eq, "$g_camp_mode",0),
                (val_add,"$fatique_stamina",1), 
(else_try),
(try_begin),
  (eq,"$g_camp_mode",2),  ## resting in town
  (val_sub,"$fatique_stamina",3),
(else_try),  
  (val_sub,"$fatique_stamina",2),
(try_end),
(try_begin),
    (lt,"$fatique_stamina",0), ## stamina cant be lower than 0
(assign,"$fatique_stamina",0),
(try_end),

(try_end),

]),

then search for script_game_get_party_speed_multiplier in module_scripts.py (its commented out) and replace it with:
  #script_game_get_party_speed_multiplier
  # This script is called from the game engine when a skill's modifiers are needed
  # INPUT: arg1 = party_no
  # OUTPUT: trigger_result = multiplier (scaled by 100, meaning that giving 100 as the trigger result does not change the party speed)
  ("game_get_party_speed_multiplier",
  [
    (store_script_param_1, ":party_no"),

    (assign,":speed_multiplier",100),
    (try_begin),
  (eq,":party_no","p_main_party"), 
  (val_sub,":speed_multiplier","$fatique_stamina"),  ## smooth scale of map speed
    (try_end),
    (val_max, ":speed_multiplier", 0),
    (set_trigger_result, ":speed_multiplier"),
  ]),

Maybe its a good idea to initialize the global variable $fatique_stamina at game_start, just to be on the safe side...
To enable towns/villages/castles to use this system too you need to search the respective menus in module_game_menu.py
(search for the term "wait here for some time") or directly search for ("castle_wait" and "village_wait") and put the following line at the right place:

(assign, "$g_camp_mode",2),  ## Abhuva fatique 2 = get stamina in town

This script lower your mapspeed every hour by 1% (it scales really smooth) and recover 3% / hour while resting in towns or 2% / hour while camping.
 
Hi, i hope that this fits in this thread.

I am trying to do teleporation script. I used some of Miratheis code and try to done it so that when you pres y you get teleported to the location that you are looking at. So maybe some of the code isn't recognized by Warband.

Script:
("cf_teleport",
  [
  (try_begin),
    (assign, "distance",5000),
    (multiplayer_get_my_player,":player_no"),
    (player_get_agent_id, ":my_agent", ":player_no"),
    (agent_is_alive,":my_agent"),
    (agent_get_look_position, pos2, ":my_agent"),
    (get_distance_between_positions,":dist",pos1,pos2),
    (le,"dist","distance"),
    (position_move_y,pos2,":dist")
    (position_set_z_to_ground_level, pos2),
    (agent_set_position,":my_agent",pos2),
    (try_end)
  ]),

Triger:
(0, 0, 5, [(key_clicked, key_y),],
        [(assign, "$teleport_move", 1),]),


        (0, 0, 3,
      [
    (key_clicked, key_y),(eq, "$teleport_move", 1),
  ],

        [
  (call_script, "script_cf_teleport"),
        ]),

 
Back
Top Bottom