[OSP][Kod] Kervanlarla ticaret yapmak

Users who are viewing this thread

Tam bir kod sayılmaz ama güzel bir özellik, brytenvalde modundan esinlendim.

Kervanlarla ticaret yapmak
Öncelikle module_troopstan kervan başını buluyoruz ve kırmızı yerleri ekliyoruz.
["caravan_master","Caravan Master","Caravan Masters",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_horse|tf_is_merchant|tf_guarantee_all|tf_hero|tf_randomize_face,0,0,fac_commoners,

Sonra module_dialogu açıyorz ve kırmızı yeri ekliyoruz.
##  [anyone|plyr,"merchant_talk_offer_2", [(troop_slot_eq, "$g_talk_troop", slot_troop_is_prisoner, 0),
##                                (neg|faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"), #he is not a faction leader!
##                                (call_script, "script_get_number_of_hero_centers", "$g_talk_troop"),
##                                (eq, reg0, 0), #he has no castles or towns
##                                (hero_can_join),
##                            ],
##  "I need capable men like you. Will you join me?", "knight_offer_join",[
##      ]],
 
  [anyone|plyr,"merchant_talk_offer_2", [], "Nothing. Forget it", "merchant_pretalk",[]],
 
 
  [anyone|plyr,"merchant_talk", [
], "I'd like to trade goods with you.", "merchant_talk_offer_goods",[]],
[anyone,"merchant_talk_offer_goods", [], "Hmm.  We don't normally pick up goods on the road, but...^I see that you have some goods worth buying.^Let us make an offer.", "merchant_pretalk",[(change_screen_trade,"trp_caravan_master")]],


Sonra modulele_scripse en alta bunu ekliyoruz.
("cf_kervan_ticaret", [
      (try_for_range, ":kervan_tuccar", "trp_caravan_master", "trp_kidnapped_girl"),
          (troop_clear_inventory, ":kervan_tuccar"),

          (store_random_in_range, ":max_item", 20, 41), #burdaki sayi kervanda olacak item sayisi 20 ile 41 arasinda item oalcak, burayi arttirirsaniz kervandaki itemler artar.
          (try_for_range, ":esyalar", 1, ":max_item"),
              (store_random_in_range, ":esya_tur1", "itm_spice", "itm_siege_supply"),
#(store_random_in_range, ":esya_tur2", "itm_legs_with_shoes", "itm_arab_nobleman_c"),
#(store_random_in_range, ":esya_tur3", "itm_spear_baner_hospillers_a", "itm_byzantine_mace"),
(store_random_in_range, ":sans", 1, 2),
(try_begin),(eq,":sans",1),(troop_add_item, ":kervan_tuccar", ":esya_tur1", 0),(try_end),
#(try_begin),(eq,":sans",2),(troop_add_item, ":kervan_tuccar", ":esya_tur2", 0),(try_end),
#(try_begin),(eq,":sans",3),(troop_add_item, ":kervan_tuccar", ":esya_tur3", 0),(try_end),
             
              (assign, ":new_gold", ":esyalar"),
          (try_end),

          (val_mul, ":new_gold", 2500),  #Burdaki sayiyi arttirirsaniz kervandaki para artar.
          (store_random_in_range, ":add_gold", 1000, 3500),#Burdaki sayiyi arttirirsaniz kervandaki para artar.
          (val_add, ":new_gold", ":add_gold"),
          (call_script, "script_troop_add_gold", ":kervan_tuccar", ":new_gold"),
      (try_end),
    ]),
Üstteki kodda önünde # işareti olanları kendinize göre düzenleyin.Bu şekilde kervan başı sadece erzak satar.
Yeni bir aralık eklediğinizde :sans", 1, 2), burdaki 2 sayısını 1 arttırın.

Sonra module_triggersede şunu ekleyin.
refresh armor seller in altına ekleyebilirsiniz.
(0.0, 0, 168.0, [],
  [   
   
(call_script, "script_cf_kervan_ticaret"),
  ]),
Bu şekilde kervanlardaki itemler 1 haftada bir değişir, 168=1hafta sayıyı azaltırsanız daha erken eşyalar değişir.

Teşekürler
-frozenpainter
-buz
-brytenwalda modu
 
Arkadaşlar module_scripts.py kısmını şu şekilde değiştirin:
Code:
("cf_kervan_ticaret", [
      (try_for_range, ":kervan_tuccar", "trp_caravan_master", "trp_kidnapped_girl"),
          (troop_clear_inventory, ":kervan_tuccar"),

          (store_random_in_range, ":max_item", 200, 400), #burdaki sayi kervanda olacak item sayisi 200 ile 410 arasinda arttirabilirsiniz
          (try_for_range, ":esyalar", 1, ":max_item"),
              (store_random_in_range, ":esya_tur1", "itm_tutorial_spear", "itm_warhorse_steppe"),
#(store_random_in_range, ":esya_tur2", "itm_legs_with_shoes", "itm_arab_nobleman_c"),
#(store_random_in_range, ":esya_tur3", "itm_spear_baner_hospillers_a", "itm_byzantine_mace"),
(store_random_in_range, ":sans", 1, 3),
(try_begin),(eq,":sans",1),(troop_add_item, ":kervan_tuccar", ":esya_tur1", 0),(try_end),
#(try_begin),(eq,":sans",2),(troop_add_item, ":kervan_tuccar", ":esya_tur2", 0),(try_end),
#(try_begin),(eq,":sans",3),(troop_add_item, ":kervan_tuccar", ":esya_tur3", 0),(try_end),
         
              (assign, ":new_gold", ":esyalar"),
          (try_end),

          (val_mul, ":new_gold", 2500),  #Burdaki sayiyi arttirirsaniz kervandaki para artar.
          (store_random_in_range, ":add_gold", 1000, 3500),#Burdaki sayiyi arttirirsaniz kervandaki para artar.
          (val_add, ":new_gold", ":add_gold"),
          (call_script, "script_troop_add_gold", ":kervan_tuccar", ":new_gold"),
      (try_end),
    ]),
Bunu yapınca tüm itemlerin tüccarın envanterine gelme şansı oluyor
Ben şöyle bir hata ile karşılaştım tüm tüvvarlar aynı envanteri kullanıyor sebebine çözüm olarak triggersı şu şekilde değiştirin;
Code:
(0.0, 0, 1.0, [],
  [

(call_script, "script_cf_kervan_ticaret"),
  ]),
Böylece hemen yenilenecek envanter
 
Last edited:
Back
Top Bottom