骑砍战团MOD开发(13)-module_scripts常用函数

一.NPC在酒馆的出现

调用刷新脚本:
   (call_script, "script_update_companion_candidates_in_taverns"),
重写刷新脚本:
  #script_update_companion_candidates_in_taverns
  # INPUT: none
  # OUTPUT: none
  ("update_companion_candidates_in_taverns",
    [
      (try_begin),
        (eq, "$cheat_mode", 1),
        (display_message, "str_shuffling_companion_locations"),
      (try_end),
      
      (try_for_range, ":troop_no", companions_begin, companions_end),
        (troop_set_slot, ":troop_no", slot_troop_cur_center, -1),
        (troop_slot_eq, ":troop_no", slot_troop_days_on_mission, 0),
        (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_inactive),
        
        (neg|troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
        
        (store_random_in_range, ":town_no", towns_begin, towns_end),
        (try_begin),
          (neg|troop_slot_eq, ":troop_no", slot_troop_home, ":town_no"),
          (neg|troop_slot_eq, ":troop_no", slot_troop_first_encountered, ":town_no"),
          (troop_set_slot, ":troop_no", slot_troop_cur_center, ":town_no"),
          (try_begin),
            (eq, "$cheat_mode", 1),
            (str_store_troop_name, 4, ":troop_no"),
            (str_store_party_name, 5, ":town_no"),
            (display_message, "@{!}{s4} is in {s5}"),
          (try_end),
        (try_end),
      (try_end),
      ## add fix npc appear at fix tavern
      (troop_set_slot, "trp_npc1", slot_troop_cur_center, "p_castle_12"), #ma bing at fengyuelou
      (troop_set_slot, "trp_npc2", slot_troop_cur_center, "p_castle_12"), #ma hui feng at fengyuelou
      (troop_set_slot, "trp_npc3", slot_troop_cur_center, "p_castle_12"), #xiaoman at fengyuelou
	  (troop_set_slot, "trp_npc4", slot_troop_cur_center, "p_castle_20"), #xiaofengzheng at tianyilou    
	  (troop_set_slot, "trp_npc5", slot_troop_cur_center, "p_town_5"), #gty at shuai
	  (troop_set_slot, "trp_npc6", slot_troop_cur_center, "p_town_14"), #yyz at bing 
  ]),

二.把某座城分封给某个领主

调用脚本:
    (call_script, "script_give_center_to_lord", "p_town_1",  "trp_kingdom_2_lord", 0),
重写脚本:
  # script_give_center_to_lord
  # Input: arg1 = center_no, arg2 = lord_troop, arg3 = add_garrison_to_center
  ("give_center_to_lord",
    [
      (store_script_param, ":center_no", 1),
      (store_script_param, ":lord_troop_id", 2), #-1 only in the case of a player deferring ownership of a center
      (store_script_param, ":add_garrison", 3),

	  (try_begin),
	    (eq, "$cheat_mode", 1),
		(ge, ":lord_troop_id", 0),
		(str_store_party_name, s4, ":center_no"),
		(str_store_troop_name, s5, ":lord_troop_id"),
		(display_message, "@{!}DEBUG -- {s4} awarded to {s5}"),
	  (try_end),
	  
	  (try_begin),
	    (eq, ":lord_troop_id", "trp_player"),
	    (unlock_achievement, ACHIEVEMENT_ROYALITY_PAYMENT),
	    
	    (assign, ":number_of_fiefs_player_have", 1),
	    (try_for_range, ":cur_center", centers_begin, centers_end),
	      (neq, ":cur_center", ":center_no"),
	      (party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
	      (val_add, ":number_of_fiefs_player_have", 1),
	    (try_end),
	    
	    (ge, ":number_of_fiefs_player_have", 5),
	    (unlock_achievement, ACHIEVEMENT_MEDIEVAL_EMLAK),	    
	  (try_end),

三.任务系统

发起任务:
     (str_store_string, s2, "@{s9} wants you to resume following his army until further notice."),
     (call_script, "script_start_quest", "qst_follow_army", ":faction_marshall"),
获取任务:
     (call_script, "script_get_quest", ":quest_giver"),
获取动态任务:
     (call_script, "script_get_dynamic_quest", ":quest_giver"),
获取政治任务:
     (call_script, "script_get_political_quest", ":quest_giver"),
完成任务:
     (call_script, "script_finish_quest", "qst_save_relative_of_merchant", 100),
终止任务:
     (call_script, "script_abort_quest", "qst_lend_surgeon", 0),
完结任务:
     (conclude_quest, ":quest_no"),
成功完成任务:
     (call_script, "script_succeed_quest", "qst_cause_provocation"),
失败完成任务:
     (fail_quest, ":quest_no")
结束任务:
     (call_script, "script_end_quest", "qst_follow_army"),
取消任务:
     (call_script, "script_cancel_quest", "qst_report_to_army"),

四.游戏说明

人物角色详情页:
  #script_game_get_troop_note
  # This script is called from the game engine when the notes of a troop is needed.
  # INPUT: arg1 = troop_no, arg2 = note_index
  # OUTPUT: s0 = note
城镇详情页:
  #script_game_get_center_note
  # This script is called from the game engine when the notes of a center is needed.
  # INPUT: arg1 = center_no, arg2 = note_index
  # OUTPUT: s0 = note
势力详情页:
  #script_game_get_faction_note
  # This script is called from the game engine when the notes of a faction is needed.
  # INPUT: arg1 = faction_no, arg2 = note_index
  # OUTPUT: s0 = note
任务详情页:
  #script_game_get_quest_note
  # This script is called from the game engine when the notes of a quest is needed.
  # INPUT: arg1 = quest_no, arg2 = note_index
  # OUTPUT: s0 = note
游戏概念详情页:
  #script_game_get_info_page_note
  # This script is called from the game engine when the notes of a info_page is needed.
  # INPUT: arg1 = info_page_no, arg2 = note_index
  # OUTPUT: s0 = note

五.地图坐标3D/2D换算

大地图获取随机附近位置,俘虏后逃跑
  # script_map_get_random_position_around_position_within_range
  # arg1 = minimum_distance in km, arg2 = maximum_distance in km, pos1 = origin position
  # Output: pos2 = result position

场景backspace战斗地图更新敌军位置
  # script_update_agent_position_on_map
  # Input: arg1 = agent_no, pos2 = map_size_pos
  # Output: none

 
场景中人物3D坐标position转化为scene平面2D坐标,更新战斗地图
  # script_convert_3d_pos_to_map_pos
  # Input: pos1 = 3d_pos, pos2 = map_size_pos
  # Output: pos0 = map_pos

你可能感兴趣的:(骑砍1战团mod开发,游戏程序)