[Ders] Deniz yolculuğu (otonmatik ikon değişimi)

Users who are viewing this thread

Oprion

Regular
Uzun süreli çalışmalarım sonucunda, rt_river dediğimiz yere gelen yani haraket eden partilerin (module_parties.py) gemiye dönüşmelerini sağlayan kodu buldum,
Birçok forum okudum birçok yazılan yabancı osp'leri inceledim bu yüzden şundan bundan yardım aldım diyemeyeceğim, ChatCPT gibi yapay zekalardan da yardım alarak
bu sonuca vardım, evet artık derse başlayalım,
2 aşamada bu işi bitireceğiz,
Aşama 1 -> (rt_bridge + rt_river)
> Haritanızda var olan bazı köprüler vardır, bunlar module_parties.py'de ;
Bridge_1
Bridge_2
Bridge_3
...
şeklinde gidiyor, oluşturduğunuz haritada
Basit örnek ; İtalya ile balkan yarımadasına bir deniz yolu çekeceksiniz (rt_river) ve karşıdan karşıya geçerken geçen partilerin gemiye dönüşmesini istiyorsunuz,
o halde o yolu (rt_river) yolu çekin ve YOLUN ORTASINA 1 adet Bridge_x ekleyin, duruma göre DİĞER YOLLAR İÇİN module_parties.py'den köprü ekleyebilirsiniz.
Aşama 2 -> Kodlaması
> Eğer harita işini tamamladıysanız, kod işine girişebilirsiniz, Herşeyden önce, module_parties'de var olan BÜTÜN Bridge_x 'lerin
örnek :
("Bridge_1","{!}1",icon_bridge_snow_a|pf_is_static|pf_disabled|pf_no_label, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(39.37,65.10),[],-45),
bu benim kendi geliştirdiğim moddaki 1.köprü, fark ederseniz pf_disabled yazıyor, bunu tüm köprülere uygularsanız, haritada görünmez yani kapalı olacaklar, fakat
birazdan ekleyeceğimiz kod için yararlı olacak.
eğer bunu da yaptıysanız, açın module_triggers.py'yi
bu ders için son yazım, çünkü koddan sonra bir yazıya gerek yok, alttaki kodun olayı şu (incelemek istemeyenler için) haraket eden partiler rt_bridge üzerine gelince gemiye dönüşüyorlar, diğer zeminlerde eski ikonlarına dönüşüyorlar
UYARI 1 -> YENI PARTI EKLERSENIZ BURAYA DA EKLEMEK ZORUNDASINIZ YOKSA GEMIYE DÖNÜŞMEZLER
UYARI 2 -> YENI IKON EKLIYORSANIZ KOD DIZILIMINI INCELEMENIZ GEREKIR
en alttaki ]'in bir üstüne çıkıp şu kodu yapıştırın ve module_bat'ı çalıştırın ;
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", "p_main_party"),
(eq, ":terrain", rt_bridge),
(party_get_template_id, ":cur_party", "p_main_party"),
(eq, ":cur_party", "p_main_party"),
(assign, "$g_player_icon_state", pis_ship),
(party_set_icon, ":cur_party", "icon_ship"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", "p_main_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_party", "p_main_party"),
(eq, ":cur_party", "p_main_party"),
(try_begin),
(troop_get_inventory_slot, ":cur_horse", "trp_player",
(try_begin),
(ge, ":cur_horse", 0),
(assign, "$g_player_icon_state", pis_normal),
(party_set_icon, ":cur_party", "icon_player_horseman"),
(else_try),
(assign, "$g_player_icon_state", pis_normal),
(party_set_icon, ":cur_party", "icon_player"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(eq, ":terrain", rt_bridge),
(party_get_template_id, ":cur_template", ":cur_party"),
(this_or_next|eq, ":cur_template", "pt_kingdom_hero_party"),
(this_or_next|eq, ":cur_template", "pt_kingdom_caravan_party"),
(this_or_next|eq, ":cur_template", "pt_manhunters"),
(this_or_next|eq, ":cur_template", "pt_village_farmers"),
(this_or_next|eq, ":cur_template", "pt_deserters"),
(this_or_next|eq, ":cur_template", "pt_looters"),
(this_or_next|eq, ":cur_template", "pt_forest_bandits"),
(this_or_next|eq, ":cur_template", "pt_steppe_bandits"),
(this_or_next|eq, ":cur_template", "pt_mountain_bandits"),
(eq, ":cur_template", "pt_sea_raiders"),
(party_set_icon, ":cur_party", "icon_ship"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_kingdom_hero_party"),
(party_set_icon, ":cur_party", "icon_flagbearer_a"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_kingdom_caravan_party"),
(party_set_icon, ":cur_party", "icon_mule"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_manhunters"),
(party_set_icon, ":cur_party", "icon_gray_knight"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_village_farmers"),
(party_set_icon, ":cur_party", "icon_peasant"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_deserters"),
(party_set_icon, ":cur_party", "icon_vaegir_knight"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_looters"),
(party_set_icon, ":cur_party", "icon_axeman"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_forest_bandits"),
(party_set_icon, ":cur_party", "icon_axeman"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_steppe_bandits"),
(party_set_icon, ":cur_party", "icon_khergit"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_mountain_bandits"),
(party_set_icon, ":cur_party", "icon_axeman"),
(try_end),
]),
(0.1, 0, 0.0, [],
[(try_for_parties, ":cur_party"),
(party_get_current_terrain, ":terrain", ":cur_party"),
(this_or_next|eq, ":terrain", rt_steppe),
(this_or_next|eq, ":terrain", rt_plain),
(this_or_next|eq, ":terrain", rt_snow),
(this_or_next|eq, ":terrain", rt_desert),
(this_or_next|eq, ":terrain", rt_steppe_forest),
(this_or_next|eq, ":terrain", rt_forest),
(this_or_next|eq, ":terrain", rt_snow_forest),
(eq, ":terrain", rt_desert_forest),
(party_get_template_id, ":cur_template", ":cur_party"),
(eq, ":cur_template", "pt_sea_raiders"),
(party_set_icon, ":cur_party", "icon_axeman"),
(try_end),
]),
 
Back
Top Bottom