Recent content by agaboy

  1. agaboy

    OSP Code QoL Simple crafting

    I have been using this craft since you launched it, congratulations for the work. It serves me very well.
    I copied a code from diplomacy "module_game_menus.py" (cheat_find_item_choose_this), and was able to put inside your code and now the engineer level affects the crafted item modifier.
    The modification was:

    Code:
                (
                    "crafting_proceed",
                    [],
                    "Proceed",
                    [
                        #just operations cause condidtion checked earlier
                        (store_mul, ":recipe_position", "$g_choosen_crafting_id", 10),
                        (troop_get_slot, ":num_of_ingredients", "trp_crafting_recipes", ":recipe_position"),
                        (store_add, ":loop_end", ":num_of_ingredients", 1),
                        (try_for_range, ":ingredient_pos_in_recipe", 1, ":loop_end"),
                            (store_add, ":ingredient_pos", ":ingredient_pos_in_recipe", ":recipe_position"),
                            (troop_get_slot, ":ingredient_id", "trp_crafting_recipes", ":ingredient_pos"),
                            (troop_remove_items, "trp_player", ":ingredient_id", 1),
                        (try_end),
                   
                        (troop_get_slot, ":crafted_item", "trp_crafting_array", "$g_choosen_crafting_id"),
                   
                       #test imod no item
                            (store_skill_level, ":eng_lvl", "skl_engineer", "trp_player"),
                            (try_begin),
                            (ge, ":eng_lvl", 10),
                                (item_get_type, ":i_type", ":crafted_item"),
                              (try_begin),
                                (eq, ":i_type", itp_type_horse),
                                (troop_add_item, "trp_player", ":crafted_item", imod_champion),
                              (else_try),
                                (is_between, ":i_type", itp_type_head_armor, itp_type_pistol),
                                (troop_add_item, "trp_player", ":crafted_item", imod_lordly),
                              (else_try),
                                (eq, ":i_type", itp_type_shield),
                                (troop_add_item, "trp_player", ":crafted_item", imod_reinforced),
                              (else_try),
                                (this_or_next|is_between, ":i_type", itp_type_one_handed_wpn, itp_type_goods),
                                (is_between, ":i_type", itp_type_pistol, itp_type_animal),
                                (troop_add_item, "trp_player", ":crafted_item", imod_masterwork),
                              (else_try),
                                (troop_add_item, "trp_player", ":crafted_item", imod_plain),
                              (try_end),
                            (else_try),
                            (ge, ":eng_lvl", 7),
                            (lt, ":eng_lvl", 10),
                              (item_get_type, ":i_type", ":crafted_item"),
                              (try_begin),
                                (eq, ":i_type", itp_type_horse),
                                (troop_add_item, "trp_player", ":crafted_item", imod_heavy),
                              (else_try),
                                (is_between, ":i_type", itp_type_head_armor, itp_type_pistol),
                                (troop_add_item, "trp_player", ":crafted_item", imod_reinforced),
                              (else_try),
                                (eq, ":i_type", itp_type_shield),
                                (troop_add_item, "trp_player", ":crafted_item", imod_thick),
                              (else_try),
                                (this_or_next|is_between, ":i_type", itp_type_one_handed_wpn, itp_type_goods),
                                (is_between, ":i_type", itp_type_pistol, itp_type_animal),
                                (troop_add_item, "trp_player", ":crafted_item", imod_balanced),
                              (else_try),
                                (troop_add_item, "trp_player", ":crafted_item", imod_thick),
                              (try_end),
                            (else_try),
                            (ge, ":eng_lvl", 4),
                            (lt, ":eng_lvl", 7),
                                (troop_add_item, "trp_player", ":crafted_item", imod_plain),
                            (else_try),
                            (lt, ":eng_lvl", 4),
                                (troop_add_item, "trp_player", ":crafted_item", 1),
                            (try_end),
                        (play_sound,"snd_hammer"),### BONUS, not required
                        # end test
                        #(troop_add_items, "trp_player", ":crafted_item", 1),
                        (change_screen_map),
                        (rest_for_hours, "$g_crafting_time", 5, 0),
                    ],
                ),
    My logic was the follow up:
    skl_engineer < 4 = cracked items
    7 < skl_engineer > 3 = no modifier
    10 < skl_egineer > 7 = thick, balanced, reinforced, heavy
    skl_egineer > 9 = masterwork, reinforced (shields), lordly, champion
    I know they are redundances and this code can be improved for this situation, but, i'm not good with codes, however, its a beginning.

    Sugestion:
    Would be interesting to modify the item "tools" to "max_ammo(500)" and spend "x" of "max_ammo" according the chosen recipe. Of course, i have no idea how to do this.
  2. agaboy

    SP Tutorial Module System Complete Guide to Adding Factions

    Anyone can help me, please?

    include your new faction on module_factions.py
    run build_module.bat
    use the faction on other files. Do not use it until you have compiled the code
    --> if you forgot to do it... open file ID_factions.py and include it there manually (this once). Increase the number (ID), it must be a increment of 1 in each line
    Code:
    fac_player_supporters_faction = 14
    fac_kingdom_1 = 15
    fac_kingdom_2 = 16
    fac_kingdom_3 = 17
    fac_kingdom_4 = 18
    fac_kingdom_5 = 19
    fac_kingdom_6 = 20
    
    # your new factions should be here!!!!!!!!
    
    fac_kingdoms_end = 21

    After this, i get a Error:

    Loading module... FAILED.
    MODULE `presentations` ERROR:
    Traceback (most recent call last):
    File "compile.py", line 127, in <module>
    from module_presentations import *
    File "D:\Desktop\M&B Dev\Diplomacy for 1.174\module_presentations.py", line 8783, in <module>
    (troop_set_slot, "trp_temp_array_b", 9, factions[fac_player_supporters_faction][6]),
    IndexError: tuple index out of range


    COMPILATION FAILED.
    -----------
    Edit

    I followed these steps:

    I corrected the error. if you received the same error do the following

    module_presentations

    Call it

    (troop_set_slot, "trp_temp_array_b", 3, factions[fac_kingdom_6][6]),

    change that text like that

    (troop_set_slot, "trp_temp_array_b", 3, factions[fac_kingdom_6][6]),
    (troop_set_slot, "trp_temp_array_b", 4, factions[fac_kingdom_5][6]),
    (troop_set_slot, "trp_temp_array_b", 5, factions[fac_kingdom_4][6]),
    (troop_set_slot, "trp_temp_array_b", 6, factions[fac_kingdom_3][6]),
    (troop_set_slot, "trp_temp_array_b", 7, factions[fac_kingdom_2][6]),
    (troop_set_slot, "trp_temp_array_b", 8, factions[fac_kingdom_1][6]),
    (troop_set_slot, "trp_temp_array_b", 9, factions[fac_kingdom_7][6]),

    And now i get a new error:

    Loading module... DONE.
    Loading plugins... DONE.
    Checking module syntax... DONE.
    Allocating identifiers... DONE.
    Compiling module... FAILED.
    MODULE scripts AGGREGATOR ERROR:
    failed to compile script game_start (#0)
    command [502, 3, <fac.kingdom_7[#432345564227567638]>, 11, 'trp_kingdom_7_1'] compilation fails in script.game_start on line 166
    failed to parse operand 'trp_kingdom_7_1' for operation faction_set_slot in script.game_start on line 166
    illegal reference `trp.kingdom_7_1`


    COMPILATION FAILED.

    -----------
    Edit

    I solved this, i dont know how.
  3. agaboy

    Event log and battle log disappeared.

    Version 0.7:

    2nsxift.jpg


    nqnvdg.jpg
Back
Top Bottom