[Ders] Şehirlerden ve Kalelerden gönüllü toplama

Users who are viewing this thread

Merhaba arkadaşlar şehirlerden ve kalelerden asker toplama kodlarının çevirisini ve kendime göre biraz düzenlemeler yaptım.

Kodun sahibi : laszers

Asıl konunun linki :
https://forums.taleworlds.com/index.php/topic,202029.0.html

Başlayalım ilk olarak module_scripts açın ve altaki kod kümesini bulun.

Code:
  #script_village_recruit_volunteers_recruit
  # INPUT: none
  # OUTPUT: none
  ("village_recruit_volunteers_recruit",
    [(party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

Bu kod kümesinin üstüne alttaki kodları yapıştırın.

Code:
  #script_cf_town_castle_recruit_volunteers_cond
  # INPUT: none
  # OUTPUT: none
  ("cf_town_castle_recruit_volunteers_cond",
    [(store_faction_of_party, ":town_faction", "$current_town"),
     (party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
     (store_relation, ":town_faction_relation", ":town_faction", "fac_player_faction"),
     (ge, ":center_relation", 0),
     (this_or_next|ge, ":center_relation", 5),
     (this_or_next|eq, ":town_faction", "$players_kingdom"),
     (this_or_next|ge, ":town_faction_relation", 0),
     (this_or_next|eq, ":town_faction", "$supported_pretender_old_faction"),
     (             eq, "$players_kingdom", 0),
     (party_slot_ge, "$current_town", slot_center_volunteer_troop_amount, 0),
     (party_slot_ge, "$current_town", slot_center_volunteer_troop_type, 1),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (ge, ":free_capacity", 1),
     ]),

  #script_cf_town_recruit_volunteers_cond
  # INPUT: none
  # OUTPUT: none
  ("cf_town_recruit_volunteers_cond",  #renamed
    [(store_faction_of_party, ":town_faction", "$current_town"),
     (party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
     (store_relation, ":town_faction_relation", ":town_faction", "fac_player_faction"),
     (ge, ":center_relation", 0),
     (this_or_next|ge, ":center_relation", 5),
     (this_or_next|eq, ":town_faction", "$players_kingdom"),
     (this_or_next|ge, ":town_faction_relation", 0),
     (this_or_next|eq, ":town_faction", "$supported_pretender_old_faction"),
     (             eq, "$players_kingdom", 0),
     (party_slot_ge, "$current_town", slot_center_volunteer_troop_amount, 0),
     (party_slot_ge, "$current_town", slot_center_volunteer_troop_type, 1),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (ge, ":free_capacity", 1),
     ]),

Daha sonra alttaki kod kümesini bulun.

Code:
  #script_get_troop_item_amount
  # INPUT: arg1 = troop_no, arg2 = item_no
  # OUTPUT: reg0 = item_amount
  ("get_troop_item_amount",
    [(store_script_param, ":troop_no", 1),
     (store_script_param, ":item_no", 2),
     (troop_get_inventory_capacity, ":inv_cap", ":troop_no"),
     (assign, ":count", 0),
     (try_for_range, ":i_slot", 0, ":inv_cap"),
       (troop_get_inventory_slot, ":cur_item", ":troop_no", ":i_slot"),
       (eq, ":cur_item", ":item_no"),
       (val_add, ":count", 1),
     (try_end),
     (assign, reg0, ":count"),
     ]),

Bu kod kümesinin üstüne attaki kodları yapıştırın.
Code:
  #script_town_castle_recruit_nobles_recruit
  # INPUT: none
  # OUTPUT: none
  ("town_castle_recruit_nobles_recruit",
    [(store_faction_of_party, ":cur_faction", "$current_town"),
     (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_5_troop),
    (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 20),#20 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 20),#20 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),
	 
  #script_town_recruit_nobles_recruit
  # INPUT: none
  # OUTPUT: none
  ("town_recruit_nobles_recruit", #renamed
    [(store_faction_of_party, ":cur_faction", "$current_town"),
     (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_1_troop),  #changed tier so it wouldnt recruit nobles.
    (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 20),#20 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 20),#20 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

İlk başta bulduğumuz kod kümesinin altında ikinci bulduğumuz kod kümesinin üstünde olacak yani ikisinin arasında.

Başlayalım ilk olarak module_scripts açın ve altaki kod kümesini bulun.

Code:
  #script_village_recruit_volunteers_recruit
  # INPUT: none
  # OUTPUT: none
  ("village_recruit_volunteers_recruit",
    [(party_get_slot, ":volunteer_troop", "$current_town", slot_center_volunteer_troop_type),
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, ":volunteer_amount", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 10),#10 denars per man
     (val_min, ":volunteer_amount", ":gold_capacity"),
     (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
     (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
     (store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
     (troop_remove_gold, "trp_player", ":cost"),
     ]),

Şimdi ise module_simple_triggers geçelim. Alttaki kod kümesini bulun.

Code:
# Adding mercenary troops to the towns
  (72,
   [
     (call_script, "script_update_mercenary_units_of_towns"),
     #NPC changes begin
     # removes   (call_script, "script_update_companion_candidates_in_taverns"),
     #NPC changes end
     (call_script, "script_update_ransom_brokers"),
     (call_script, "script_update_tavern_travellers"),
     (call_script, "script_update_tavern_minstrels"),
     (call_script, "script_update_booksellers"),
     (call_script, "script_update_villages_infested_by_bandits"),
     (try_for_range, ":village_no", villages_begin, villages_end),
       (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
       (call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
     (try_end),
    ]),

Alttaki kod kümesi ile değiştirin.

Code:
# Adding mercenary troops to the towns
  (72,
   [
     (call_script, "script_update_mercenary_units_of_towns"),
    #(call_script, "script_start_update_mercenary_units_of_towns"),
     #NPC changes begin
     # removes   (call_script, "script_update_companion_candidates_in_taverns"),
     #NPC changes end
     (call_script, "script_update_ransom_brokers"),
     (call_script, "script_update_tavern_travellers"),
     (call_script, "script_update_tavern_minstrels"),
     (call_script, "script_update_booksellers"),
     (call_script, "script_update_villages_infested_by_bandits"),
     (try_for_range, ":village_no", villages_begin, villages_end),
       (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
       (call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
     (try_end),
    ]),
   (72,
   [
     (call_script, "script_update_mercenary_units_of_towns"),
   # (call_script, "script_start_update_mercenary_units_of_towns"),
     #NPC changes begin
     # removes   (call_script, "script_update_companion_candidates_in_taverns"),
     #NPC changes end
     (call_script, "script_update_ransom_brokers"),
     (call_script, "script_update_tavern_travellers"),
     (call_script, "script_update_tavern_minstrels"),
     (call_script, "script_update_booksellers"),
     (call_script, "script_update_villages_infested_by_bandits"),
     (try_for_range, ":village_no", centers_begin, centers_end),
       (call_script, "script_update_volunteer_troops_in_village", ":village_no"),
       #(call_script, "script_update_npc_volunteer_troops_in_village", ":village_no"),
     (try_end),
    ]),

Şimdi module_game_menus kısmına gelelim. Alttakini aratın

Code:
         "Go to the marketplace.",
         [
           (try_begin),
             (call_script, "script_cf_enter_center_location_bandit_check"),
           (else_try),
             (jump_to_menu,"mnu_town_trade"),
           (try_end),
          ]),

Bunun altına alttaki kodları ekleyin.

Code:
	   ("recruit_normals",[(is_between, "$current_town",
        castles_begin, castles_end),      (call_script,                                           
       "script_cf_town_castle_recruit_volunteers_cond"),] #notice that this part calls on the id given in the first part of the split troop trees tutorial
       ,"Recruit Volunteers.",
       [
         (try_begin),
           (call_script, "script_cf_enter_center_location_bandit_check"),
         (else_try),
           (jump_to_menu, "mnu_recruit_normales"),
         (try_end),
        ]),
		
	  ("recruit_normals",[(is_between, "$current_town",
        towns_begin, towns_end),      (call_script,
       "script_cf_town_recruit_volunteers_cond"),] #notice that this part calls on the id given in the first part of the split troop trees tutorial
       ,"Recruit Volunteers.",
       [
         (try_begin),
           (call_script, "script_cf_enter_center_location_bandit_check"),
         (else_try),
           (jump_to_menu, "mnu_recruit_normales"),
         (try_end),
        ]),

Son olarak alttaki kodu yine module_game_menus'te en alta ekleyin.

Code:
   (
     "recruit_normales",0,
    "{s18}",
    "none",
    [(store_faction_of_party, ":cur_faction", "$current_town"),
     (faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_1_troop),  #Notice the changed tier
     (party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", 40),#40 denars per man
     (assign, ":party_capacity", ":free_capacity"),
     (val_min, ":party_capacity", ":gold_capacity"),
     (try_begin),
       (gt, ":party_capacity", 0),
       (val_min, ":volunteer_amount", ":party_capacity"),
     (try_end),
     (assign, reg5, ":volunteer_amount"),
     (assign, reg7, 0),
     (try_begin),
       (gt, ":volunteer_amount", ":gold_capacity"),
       (assign, reg7, 1), #not enough money
     (try_end),
     (try_begin),
       (eq, ":volunteer_amount", 0),
       (str_store_string, s18, "@No one here seems to be willing to join your party."),
     (else_try),
       (store_mul, reg6, ":volunteer_amount", 40),#40 denars per man
       (str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
       (try_begin),
         (eq, reg5, 1),
         (str_store_string, s18, "@One {s3} volunteers to follow you."),
       (else_try),
         (str_store_string, s18, "@{reg5} {s3} volunteer to follow you."),
       (try_end),
       (set_background_mesh, "mesh_pic_recruits"),
     (try_end),
    ],
    [
      ("continue_not_enough_gold",
      [
        (eq, reg7, 1),
      ],
      "I don't have enough money...",
      [
  (jump_to_menu, "mnu_town"),
      ]),
       
      ("continue",
      [
        (eq, reg7, 0),
        (eq, reg5, 0),
      ], #noone willing to join                   
      "Continue...",
      [
        (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
  (jump_to_menu, "mnu_town"),
      ]),
       
      ("recruit_them",
      [
        (eq, reg7, 0),
        (gt, reg5, 0),
      ],
      "Recruit them ({reg6} denars).",
      [
        (call_script, "script_town_recruit_nobles_recruit"),
                        
  (jump_to_menu, "mnu_town"),
      ]),
      
      ("forget_it",
      [
        (eq, reg7, 0),
        (gt, reg5, 0),
      ],
      "Forget it.",
      [
  (jump_to_menu, "mnu_town"),
      ]),
    ],
  ),

Oyunda 3 gün beklerseniz şehir ve kale menülerinde kodun çalıştığını bulabilirsiniz.3 gün bekleme olmasın istiyorsanız asıl konuya bakabilirsiniz. Eğer kod çalışmazsa bana bildirin. Denemek bedava :smile:

Teşekkürler kısmına kodun asıl sahibi laszers eklemeyi unutmayın. :smile: :smile:
 
Bunu [Ders] olarak eklemen gerekiyordu ve kendine teşekkür etmemen gerekiyordu.
Bence biraz kodların ne işe yaradığınıda anlatırsan daha güzel olur.
 
Dracheon said:
Bunu [Ders] olarak eklemen gerekiyordu ve kendine teşekkür etmemen gerekiyordu.
Bence biraz kodların ne işe yaradığınıda anlatırsan daha güzel olur.

Kendime teşekkür etmemin sebebi asıl konudaki kodları yazınca oyunda kalelerden alınan askerler soylu olarak geliyordu ve bug ile karşılaşıyordum ben onları düzelttim. Düzenlemiş olduğum kodları bu konuda paylaştım. Ve konunun ders olduğunu fark etmemişim osp sanıyordum. Onun için, teşekkür etmek isteyen yazar istemeyen yazmaz. Ama sıkıntı ve yasaksa kaldırırım. Kodların ne işe yaracağını anlatacak vaktim yoktu ve anlatamayabilirim o konuda kendime güvenmiyorum."Bunu [Ders] olarak eklemen gerekiyordu" kısmını düzeltelim hemen :smile:
 
Back
Top Bottom