Modding Q&A [For Quick Questions and Answers]

正在查看此主题的用户

状态
不接受进一步回复。
So trying to add an invasion to my game.

This is what I got so far:

####################################################################################################################################
#SoD INVASION BEGIN
####################################################################################################################################
(24,
[
(store_current_day, ":cur_day"),
(store_random_in_range, ":village_no", "p_village_49", "P_village_50"),
(eq, ":cur_day", 2),
#CHEAT TEST REMOVE ME
## (call_script, "script_change_troop_renown", "trp_player", 20000),
## (try_for_range, ":troop_new", "trp_ief_velites", "trp_ief_deserter"),
## (party_add_members, "p_main_party", ":troop_new", 10),
## (try_end),
#CHEAT TEST REMOVE ME
(call_script, "script_create_kingdom_hero_party", "trp_kingdom_18_lord", ":village_no"),
(troop_set_slot, "trp_kingdom_6_lord", slot_troop_wealth, 100000),
(call_script, "script_diplomacy_start_war_between_kingdoms", "fac_kingdom_18", "fac_kingdom_2", 1),
(call_script, "script_diplomacy_start_war_between_kingdoms", "fac_kingdom_18", "fac_kingdom_5", 1),
(call_script, "script_diplomacy_start_war_between_kingdoms", "fac_kingdom_18", "fac_kingdom_9", 1),
(call_script, "script_diplomacy_start_war_between_kingdoms", "fac_kingdom_18", "fac_kingdom_10", 1),
(call_script, "script_diplomacy_start_war_between_kingdoms", "fac_kingdom_18", "fac_kingdom_11", 1),
(try_for_range, ":troop_no", "trp_knight_18_1", "trp_knight_18_7"),
(troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
#(troop_slot_eq, ":troop_no", slot_troop_is_prisoner, 0),
(neg|troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
(neg|troop_slot_ge, ":troop_no", slot_troop_leaded_party, 1),
(call_script, "script_create_kingdom_hero_party", ":troop_no", ":village_no"),
(troop_set_slot, ":troop_no", slot_troop_wealth, 40000),
(try_end),
]),
####################################################################################################################################
#SoD INVASION END
####################################################################################################################################
  # Check if a faction is defeated every day
####################################################################################################################################
# Check if a faction is defeated every day
  (24,
  [
    (assign, ":num_active_factions", 0),
    (try_for_range, ":cur_kingdom", kingdoms_begin, "fac_kingdom_18"),
      (faction_set_slot, ":cur_kingdom", slot_faction_number_of_parties, 0),
    (try_end),
    (try_for_parties, ":cur_party"),
      (store_faction_of_party, ":party_faction", ":cur_party"),
      (is_between, ":party_faction", kingdoms_begin, "fac_kingdom_18"),
      (this_or_next|is_between, ":cur_party", centers_begin, centers_end),
      (party_slot_eq, ":cur_party", slot_party_type, spt_kingdom_hero_party),
      (faction_get_slot, ":kingdom_num_parties", ":party_faction", slot_faction_number_of_parties),
      (val_add, ":kingdom_num_parties", 1),
      (faction_set_slot, ":party_faction", slot_faction_number_of_parties, ":kingdom_num_parties"),
    (try_end),
    (try_for_range, ":cur_kingdom", kingdoms_begin, "fac_kingdom_18"),
##      (try_begin),
##        (eq, "$cheat_mode", 1),
##        (str_store_faction_name, s1, ":cur_kingdom"),
##        (faction_get_slot, reg1, ":cur_kingdom", slot_faction_number_of_parties),
##        (display_message, "@Number of parties belonging to {s1}: {reg1}"),
##      (try_end),
      (faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
      (val_add, ":num_active_factions", 1),
      (faction_slot_eq, ":cur_kingdom", slot_faction_number_of_parties, 0),
      (assign, ":faction_removed", 0),
      (try_begin),
        (eq, ":cur_kingdom", "fac_player_supporters_faction"),
        (try_begin),
          (le, "$supported_pretender", 0),
          (faction_set_slot, ":cur_kingdom", slot_faction_state, sfs_inactive),
          (assign, ":faction_removed", 1),
        (try_end),
      (else_try),
        (neq, "$players_kingdom", ":cur_kingdom"),
        (faction_set_slot, ":cur_kingdom", slot_faction_state, sfs_defeated),
        (try_for_parties, ":cur_party"),
          (store_faction_of_party, ":party_faction", ":cur_party"),
          (eq, ":party_faction", ":cur_kingdom"),
          (party_get_slot, ":home_center", ":cur_party", slot_party_home_center),
          (store_faction_of_party, ":home_center_faction", ":home_center"),
          (party_set_faction, ":cur_party", ":home_center_faction"),
        (try_end),
        (assign, ":kingdom_pretender", -1),
        (try_for_range, ":cur_pretender", pretenders_begin, pretenders_end),
          (troop_slot_eq, ":cur_pretender", slot_troop_original_faction, ":cur_kingdom"),
          (assign, ":kingdom_pretender", ":cur_pretender"),
        (try_end),
        (try_begin),
          (is_between, ":kingdom_pretender", pretenders_begin, pretenders_end),
          (neq, ":kingdom_pretender", "$supported_pretender"),
          (troop_set_slot, ":kingdom_pretender", slot_troop_cur_center, 0), #remove pretender from the world
        (try_end),
        (assign, ":faction_removed", 1),
        (try_begin),
          (eq, "$players_oath_renounced_against_kingdom", ":cur_kingdom"),
          (assign, "$players_oath_renounced_against_kingdom", 0),
          (assign, "$players_oath_renounced_given_center", 0),
          (assign, "$players_oath_renounced_begin_time", 0),
          (call_script, "script_add_notification_menu", "mnu_notification_oath_renounced_faction_defeated", ":cur_kingdom", 0),
        (try_end),
        #This menu must be at the end because faction banner will change after this menu if the player's supported pretender's original faction is cur_kingdom
        (call_script, "script_add_notification_menu", "mnu_notification_faction_defeated", ":cur_kingdom", 0),
      (try_end),
      (try_begin),
        (eq, ":faction_removed", 1),
        (val_sub, ":num_active_factions", 1),
        (call_script, "script_store_average_center_value_per_faction"),
      (try_end),
      (try_for_range, ":cur_kingdom_2", kingdoms_begin, "fac_kingdom_18"),
        (call_script, "script_update_faction_notes", ":cur_kingdom_2"),
      (try_end),
    (try_end),
    (try_begin),
      (eq, ":num_active_factions", 1),
      (try_for_range, ":cur_kingdom", kingdoms_begin, "fac_kingdom_18"),
        (faction_slot_eq, ":cur_kingdom", slot_faction_state, sfs_active),
        (call_script, "script_add_notification_menu", "mnu_notification_one_faction_left", ":cur_kingdom", 0),
      (try_end),
    (try_end),
    ]),
####################################################################################################################################

It actually does work, faction 18 spawns at the assigned village, but there is a few things that still need fixing.

1) Lords defect from the faction before they spawn, need something to make the faction inactive.
2) The faction is also defeated after about 8 hours, and then becomes active again on day 2 when it spawns. Which causes the faction leader to become a vassal of the "Commoners" faction.

So basically, need something to make the faction inactive until the moment it spawns. If I can make this work, and with Computicas permission, this would be a great OSP code for people, it seems fairly simple?
 
does anyone know how to solve runtime problem? i edited menus.txt and now getting it :S
 
You should not edit menus.txt. ^^ If you want to edit the menus, edit module_game_menus.py .I got this ERROR too, as I tried(before 6 months) to edit menus.txt.
I hope this is helpful for you. ^^

@Cuzor
If you make this as an OSP, I would be the first guy which download it.  :mrgreen:
 
I have a damn problem. I added a new waepon(a new axe) and wanted to make a melee for it.
It has to be a onehandedaxe as first and after change a throwing axe.
So I did all needed things and ingame I get the message:

You have no more crossbow bolts.

I tried it again with more ammo, but nothing happend.....

The itemcodes:
插入代码块:
["fightingaxe", "Fightingaxe", [("french_m1833_hache_abordage_boarding_axe",0)], itp_type_one_handed_wpn|itp_merchandise|itp_wooden_parry|itp_primary|itp_bonus_against_shield|itp_penalty_with_shield|itp_next_item_as_melee|itp_unbalanced, itc_parry_onehanded|itc_scimitar|itcf_overswing_onehanded|itcf_slashright_onehanded|itcf_slashleft_onehanded|itcf_carry_quiver_back|itcf_parry_forward_onehanded|itcf_parry_up_onehanded|itcf_parry_right_onehanded|itcf_parry_left_onehanded, 4980, weight(1.8)|difficulty(7)|spd_rtng(94)|weapon_length(55)|swing_damage(27,cut)|thrust_damage(0,blunt), imodbits_axe|imodbit_cracked|imodbit_rusty|imodbit_bent|imodbit_chipped|imodbit_battered|imodbit_old|imodbit_balanced ],
 ["fightingaxe_melee", "Fightingaxe", [("french_m1833_hache_abordage_boarding_axe",0)], itp_type_thrown|itp_merchandise|itp_primary, itcf_throw_axe, 4980, weight(1.8)|difficulty(0)|spd_rtng(85)|shoot_speed(14)|thrust_damage(22,cut)|max_ammo(2)|weapon_length(55), imodbits_thrown_minus_heavy ],
Is there a mistake?

wishes
Roemerboy
 
Thanks, I fixed it, but the bug is still there....

EDIT: I found the problem. It's not the code, it's MountBlade. It looks that throwing waepons must be the first waepon(not melee). I changed the order of the codes and now all work fine.
 
thanks for the help :razz: i also got another question, how do i change the starting date for the game (using text not python plz ?  :smile: )
 
What you need is to replace the number 1257 inside game_get_date_text by anything you want.
It should look like this:
game_get_date_text -1
86 22 1 1224979098644774912 2123 3 1224979098644774913 1224979098644774912 24 2120 3 1224979098644774914 1224979098644774913 23 2133 2 1224979098644774915 3 2133 2 1224979098644774916 1257 2133 2 1224979098644774917 99999 6 3 1224979098644774918 0 1224979098644774917 4 0 1073741855 2 1224979098644774915 1 1073741855 2 1224979098644774915 3 1073741855 2 1224979098644774915 5 1073741855 2 1224979098644774915 7 1073741855 2 1224979098644774915 8 1073741855 2 1224979098644774915 10 31 2 1224979098644774915 12 2133 2 1224979098644774919 31 5 0 1073741855 2 1224979098644774915 4 1073741855 2 1224979098644774915 6 1073741855 2 1224979098644774915 9 31 2 1224979098644774915 11 2133 2 1224979098644774919 30 5 0 4 0 2123 3 1224979098644774920 1224979098644774916 4 2107 2 1224979098644774920 4 31 2 1224979098644774920 1224979098644774916 2133 2 1224979098644774919 29 5 0 2133 2 1224979098644774919 28 3 0 3 0 4 0 32 2 1224979098644774914 1224979098644774919 2106 2 1224979098644774914 1224979098644774919 2105 2 1224979098644774915 1 4 0 32 2 1224979098644774915 12 2106 2 1224979098644774915 12 2105 2 1224979098644774916 1 3 0 5 0 2133 2 1224979098644774917 0 3 0 3 0 2133 2 72057594037927937 1224979098644774914 2133 2 72057594037927938 1224979098644774916 2271 1 72057594037927939 4 0 31 2 1224979098644774915 1 2320 2 1 216172782113783925 5 0 31 2 1224979098644774915 2 2320 2 1 216172782113783926 5 0 31 2 1224979098644774915 3 2320 2 1 216172782113783927 5 0 31 2 1224979098644774915 4 2320 2 1 216172782113783928 5 0 31 2 1224979098644774915 5 2320 2 1 216172782113783929 5 0 31 2 1224979098644774915 6 2320 2 1 216172782113783930 5 0 31 2 1224979098644774915 7 2320 2 1 216172782113783931 5 0 31 2 1224979098644774915 8 2320 2 1 216172782113783932 5 0 31 2 1224979098644774915 9 2320 2 1 216172782113783933 5 0 31 2 1224979098644774915 10 2320 2 1 216172782113783934 5 0 31 2 1224979098644774915 11 2320 2 1 216172782113783935 5 0 31 2 1224979098644774915 12 2320 2 1 216172782113783936 3 0 60 1 1
Date is in red, change this by whatever and try to paste over your own script_game_get_date_text. I'm using this myself, and i'm pretty sure, although i haven't try it lately, that it updates correctly to the next year after the 31dec and so on.

Make sure the text is not creating useless spaces between scripts to prevent errors when copy/pasting. Best way to do this is to simply locate the script, then do a quick search for 1257 on the code and you will eventually find the one to replace, i think there's no other 1257 number inside anyways.


 
Gambino 说:
hmm. were can i find game_get_date_text ?
Keryyn 说:
Date is in red, change this by whatever and try to paste over your own script_game_get_date_text. I'm using this myself, and i'm pretty sure, although i haven't try it lately, that it updates correctly to the next year after the 31dec and so on.
 
When I double-click on 'build_module" there's a lot of errors about that 'python' is not "recognized" or something... Can anyone help me?  ;/ (I unziped some python compressed files:
scaled.php
)
 
Could you post or send me your ERROR-Message?Perhaps I can help.  :mrgreen:
My own python made problems like this too. But I was able to fix it.
 
There are some errors consist of the following text: "Python is not recognized, blah blah blah". In the end of that window is information about some missing file in my module folder. It ends with .pyc or sth like this.
 
状态
不接受进一步回复。
后退
顶部 底部