骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

搜索
购买CDKEY 小黑盒加速器
查看: 941|回复: 2

[求助] [osp代码] 怎么让写的ai对领主一直生效啊

[复制链接]

30

主题

200

回帖

169

积分

见习骑士

Rank: 3

UID
2462463
第纳尔
1472
精华
0
互助
20
荣誉
0
贡献
0
魅力
50
注册时间
2015-3-3
鲜花(43) 鸡蛋(0)
发表于 2023-2-16 16:34:34 | 显示全部楼层 |阅读模式
本帖最后由 战争傀儡阿格兰 于 2023-3-20 09:10 编辑

2023年3月20日
小地图简化
        (neg|is_presentation_active, "prsnt_battle"),
        (neg|is_presentation_active, "prsnt_tutorial_show_mouse_movement"),
        (start_presentation, "prsnt_tutorial_show_mouse_movement"),


2147484551 1 1513209474796486693 2147484551 1 1513209474796486682 900 1 1513209474796486682




2023年3月15日
汽车系统设想
1.魔球生成spawn_scene_prop:(问题,马上的东西刷新,自动跟踪)
2.车自己带行动逻辑
3.下马

魔球触发器成品。效果是召唤物品附身于马上,用于武器初始化
12 1 1224979098644774912
1704 1 1224979098644774912
1702 1 1224979098644774912
1714 2 1224979098644774913 1224979098644774912
32 2 1224979098644774913 0
1702 1 1224979098644774913
1719 2 1224979098644774914 1224979098644774913
32 2 1224979098644774914 288230376151711765
1720 3 1224979098644774915 1224979098644774913 0
31 2 1224979098644774915 100
1721 3 1224979098644774913 99 0
1974 1 1080863910568919089
1811 3 1224979098644774916 1080863910568919089 0
2096 2 1224979098644774913 0
2096 2 1224979098644774912 0
510 3 1224979098644774916 2 1224979098644774913
510 3 1224979098644774916 3 1224979098644774912
3 0  

#Agland
                (try_for_agents, ":cur_agent"),
                        (agent_is_human,":cur_agent"),
                        (agent_is_alive, ":cur_agent"),
                        (agent_get_horse,":horse_id",":cur_agent"),
                        (gt, ":horse_id", 0),
                        (agent_is_alive, ":horse_id"),
                        (agent_get_item_id,":horse_item_id", ":horse_id"), #(works only for horses, returns -1 otherwise)
                        #(this_or_next|eq,":horse_item_id","itm_horse_meat"),#Modify to the item id you want
                        (gt,":horse_item_id","itm_warhorse_sarranid"),
                        (store_agent_hit_points,":horse_hp",":horse_id",0),# set absolute to 1 to retrieve actual hps
                        (eq, ":horse_hp", 100),
                        (agent_set_hit_points,":horse_id",99,0),
                        (spawn_scene_prop, "spr_boat_destroy"),
                        (scene_prop_get_instance, ":instance_id", "spr_boat_destroy", 0),#Modify to the spr you want
                        #(agent_set_attached_scene_prop, ":horse_id", ":instance_id"),#Low-cost car building
                        (agent_set_visibility,":horse_id",0),#vanish
                        (agent_set_visibility,":cur_agent",0),
                        (scene_prop_set_slot,":instance_id",scene_prop_smoke_effect_done,":horse_id"),
                        (scene_prop_set_slot,":instance_id",scene_prop_number_of_agents_pushing,":cur_agent"),#Agland: match horse for scene_prop,used in scene_props.py
                (try_end),
#Agland



2023年2月17日第二版
    谢谢2楼指正错误,已修改。
    本来目的是,扫一遍大地图的特定阵营【领主party】,让他们变成为我的人,并改ai。现在前面几句已经成了,想请教,这个ai一会就被原版ai覆盖掉,怎么强制执行啊,谢谢
    另谢分享的代码:
https://bbs.mountblade.com.cn/thread-101540-1-1.html让跟随自己的领主完全专心地跟随
https://bbs.mountblade.com.cn/thread-209874-1-1.html 强盗以及乱军部队相互支援,这个简单AI的触发器
(try_for_parties,":party_no"),
    (party_is_active, ":party_no"),
    (party_get_slot,":party_type",":party_no",0)
    (eq,":party_type", 13),#原句如下,自己翻阅module_constants.py一个个拆的(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_hero_party),
    (store_faction_of_party, ":party_faction", ":party_no"),
    (this_or_next|eq, ":party_faction", "fac_kingdom_1"),
    (eq,":party_faction", "fac_kingdom_8"),
    (call_script,"script_436","trp_player",1000),
    (call_script,"script_259",":party_no",1,"p_town_19"),
    (party_set_faction,":party_no","fac_kingdom_10"),
    (party_set_ai_behavior,":party_no",ai_bhvr_patrol_party),
    (party_set_ai_object,":party_no","p_main_party"),
    (party_set_flags,":party_no",pf_default_behavior,1),
(try_end),

spr_boat_destroy 536969216 0 boat_destroy 0 6
-40.000000  4 2071 1 1224979098644774912 1850 2 31 1224979098644774912 700 2 33 31 1860 3 1224979098644774912 33 0
-46.000000  9 4 0 31 2 144115188075855886 0 2071 1 1224979098644774912 530 3 1224979098644774913 1224979098644774912 2 32 2 1224979098644774913 0 1850 2 31 1224979098644774913 700 2 33 31 1860 3 1224979098644774912 33 10000 3 0
-45.000000  126 4 0 2071 1 1224979098644774912 530 3 1224979098644774913 1224979098644774912 2 32 2 1224979098644774913 0 1740 3 1224979098644774913 1801439850948198961 0 2133 2 144115188075855886 2 525 3 1224979098644774914 1224979098644774913 6 4 0 1073741894 1 17 1073741894 1 30 70 1 32 2147483678 2 1224979098644774914 5 2612 4 1224979098644774912 30 120 500 505 3 1224979098644774913 6 7 5 0 70 1 31 31 2 1224979098644774914 7 2610 2 1224979098644774912 1 505 3 1224979098644774913 6 4 3 0 1710 2 1 1224979098644774913 700 2 5 1 2133 2 1224979098644774915 300 2133 2 1224979098644774916 200 2121 3 1224979098644774917 1 2 793 2 1224979098644774918 5 700 2 2 5 721 2 2 1224979098644774915 793 2 1224979098644774919 2 2106 2 1224979098644774919 1224979098644774918 700 2 8 5 2122 3 1224979098644774920 1224979098644774915 1224979098644774917 721 2 8 1224979098644774920 793 2 1224979098644774921 8 2106 2 1224979098644774921 1224979098644774918 700 2 4 5 2122 3 1224979098644774922 1224979098644774916 1224979098644774917 720 2 4 1224979098644774922 793 2 1224979098644774923 4 2106 2 1224979098644774923 1224979098644774918 700 2 6 5 720 2 6 1224979098644774916 793 2 1224979098644774924 6 2106 2 1224979098644774924 1224979098644774918 4 0 32 2 1224979098644774919 1224979098644774921 2133 2 1224979098644774925 1 5 0 2133 2 1224979098644774925 3 3 0 4 0 32 2 1224979098644774923 1224979098644774924 2133 2 1224979098644774926 1 5 0 2133 2 1224979098644774926 3 3 0 2123 3 1224979098644774927 3 2 2107 2 1224979098644774927 1224979098644774917 2113 1 1224979098644774919 2113 1 1224979098644774921 2105 2 1224979098644774919 1224979098644774921 2107 2 1224979098644774919 100 2107 2 1224979098644774915 2 2123 3 1224979098644774928 1224979098644774919 1224979098644774915 4 0 2147483678 2 1224979098644774928 30 2133 2 1224979098644774929 1 5 0 32 2 1224979098644774928 173 2133 2 1224979098644774929 0 2133 2 1224979098644774930 60000 5 0 2133 2 1224979098644774929 0 2122 3 1224979098644774931 1224979098644774928 607 2107 2 1224979098644774928 1224979098644774928 2107 2 1224979098644774928 1224979098644774927 2120 3 1224979098644774930 1224979098644774928 1224979098644774931 3 0 2113 1 1224979098644774923 2113 1 1224979098644774924 2105 2 1224979098644774923 1224979098644774924 2107 2 1224979098644774923 100 2107 2 1224979098644774916 2 2123 3 1224979098644774932 1224979098644774923 1224979098644774916 4 0 2147483678 2 1224979098644774932 30 2133 2 1224979098644774933 1 5 0 32 2 1224979098644774932 173 2133 2 1224979098644774933 0 2133 2 1224979098644774934 60000 5 0 2133 2 1224979098644774933 0 2122 3 1224979098644774935 1224979098644774932 607 2107 2 1224979098644774932 1224979098644774932 2107 2 1224979098644774932 1224979098644774927 2120 3 1224979098644774934 1224979098644774932 1224979098644774935 3 0 4 0 31 2 1224979098644774929 1 723 2 5 0 5 0 31 2 1224979098644774929 0 2108 2 1224979098644774930 1000 2106 2 1224979098644774925 2 2107 2 1224979098644774930 1224979098644774925 723 2 5 1224979098644774930 3 0 4 0 31 2 1224979098644774933 1 724 2 5 0 5 0 31 2 1224979098644774933 0 2108 2 1224979098644774934 1000 2106 2 1224979098644774926 2 2107 2 1224979098644774934 1224979098644774926 724 2 5 1224979098644774934 3 0 4 0 70 1 17 721 2 5 8 3 0 1860 3 1224979098644774912 5 10 5 0 2133 2 144115188075855886 0 3 0
-44.000000  16 2071 1 1224979098644774912 2072 1 1224979098644774913 4 0 1714 2 1224979098644774914 1224979098644774912 32 2 1224979098644774914 -1 1106 1 1585267068834414592 5 0 1850 2 30 1224979098644774913 4 0 545 3 1224979098644774912 2 0 505 3 1224979098644774912 2 1 2093 2 1224979098644774912 0 2001 1 1 2096 2 1224979098644774912 0 3 0 3 0
-42.000000  2 599 2 1152921504606847136 1 1969 3 1008806316530991141 1 3
-43.000000  10 2071 1 1224979098644774912 530 3 1224979098644774913 1224979098644774912 1 2147483678 2 1224979098644774913 0 1850 2 1 1224979098644774912 793 2 1224979098644774914 1 32 2 1224979098644774914 0 722 2 1 1224979098644774913 1860 3 1224979098644774912 1 11 2105 2 1224979098644774913 -2 510 3 1224979098644774912 1 1224979098644774913  

#Agland:horse mode
  ("boat_destroy",sokf_moveable|sokf_destructible|spr_use_time(2),"boat_destroy","0",
    [
    (ti_on_init_scene_prop,
        [
        (store_trigger_param_1, ":car_id"),
        
        #(scene_prop_get_slot, ":horse_id", ":car_id", scene_prop_smoke_effect_done),#get from mission_templates
        #(scene_prop_set_hit_points, ":instance_id", 200),
        #(prop_instance_play_sound, ":instance_id", "snd_heli_loop", sf_looping),
        
        (prop_instance_get_position, pos31, ":car_id"),
        (copy_position, pos33, pos31),
        (prop_instance_animate_to_position,":car_id",pos33,0),
        ]),

    (ti_on_scene_prop_animation_finished,#Agland:  related to ti_on_scene_prop_is_animating,
        [
        (try_begin),
            (eq,"$reserved_15",0),
            (store_trigger_param_1, ":car_id"),
            (scene_prop_get_slot, ":horse_id", ":car_id", scene_prop_smoke_effect_done),#get from mission_templates
            (gt,":horse_id",0),               
            (prop_instance_get_position, pos31, ":horse_id"),
            (copy_position, pos33, pos31),
            (prop_instance_animate_to_position,":car_id",pos33,10000),
        (try_end),
        ]),
  
    (ti_on_scene_prop_is_animating,#Agland:  related to ti_on_scene_prop_animation_finished
        [
                (store_trigger_param_1, ":car_id"),
        (scene_prop_get_slot, ":horse_id", ":car_id", scene_prop_smoke_effect_done),#get from mission_templates
        (scene_prop_get_slot, ":cur_agent", ":car_id", scene_prop_number_of_agents_pushing),
        (agent_get_rider,":rider_id",":horse_id"),
                (agent_get_slot,":rider_state",":horse_id",slot_agent_in_duel_with),
        #changes in rider
        (try_begin),
                        #(agent_get_horse,":cur_horse",":cur_agent"),
                        (neq, ":rider_state", 7),
                        (eq, ":rider_id", -1),
                        (agent_set_visibility,":cur_agent",1),
                        #(agent_set_animation, ":cur_agent","anim_jump", 0),
                        (scene_prop_set_slot,":car_id",scene_prop_number_of_agents_pushing,-1),
                        (agent_set_slot,":horse_id",slot_agent_in_duel_with,7),
                        #(display_message,"str_change_charge_1",0xFFFF00),
                (else_try),
                        (eq, ":rider_state", 7),
                        (neq, ":rider_id", ":cur_agent"),
                        (scene_prop_set_slot,":car_id",scene_prop_number_of_agents_pushing,":rider_id"),
                        (agent_set_visibility,":rider_id",0),
                        (agent_set_slot,":horse_id",slot_agent_in_duel_with,4),
                        #(display_message,"str_tutorial_failed",0xFFFF00),
                (try_end),
               
    #wheel rotation status               
        (try_begin),
                        (agent_is_alive, ":horse_id"),
            (agent_set_animation, ":horse_id","anim_horse_jump_end", 0),
            (assign,"$reserved_15",2),
            (agent_get_slot,":wheel_state",":horse_id",slot_agent_tournament_point),#Agland:7 forward state;  4 stop status;  
            (try_begin),
                (this_or_next|key_is_down, key_w),
                (this_or_next|key_is_down, key_a),
                (key_is_down, key_d),
                (lt, ":wheel_state", 5),
                (prop_instance_deform_in_cycle_loop, ":car_id",30,120,100),#(prop_instance_deform_in_cycle_loop, <prop_instance_no>, <start_frame>, <end_frame>, <duration-in-1/1000-seconds>),
                #(display_message,"str_change_charge_1",0xFFFF00),
                (agent_set_slot,":horse_id",slot_agent_tournament_point,7),
            (else_try),
                (key_is_down, key_s),
                (eq, ":wheel_state", 7),
                (prop_instance_deform_to_time, ":car_id", 1),#(prop_instance_deform_to_time, <prop_instance_no>, <value>),
                #(display_message,"str_tutorial_failed",0xFFFF00),
                (agent_set_slot,":horse_id",slot_agent_tournament_point,4),
            (try_end),
        
    #bodywork incline
            (agent_get_position,pos1,":horse_id"),        
            (copy_position, pos5, pos1),
        #keypad layout on mobile phone
        #alignment distance:300x200,double in #rotation direction
            (assign, ":ali_x", 300),
            (assign, ":ali_y", 200),
            (store_sub,":minus",1,2),
            (position_get_distance_to_ground_level, ":height_5", pos5),
        #front
            (copy_position, pos2, pos5),
            (position_move_y, pos2, ":ali_x"),
            (position_get_distance_to_ground_level, ":height_2", pos2),
            (val_sub,":height_2",":height_5"),

        #back
            (copy_position, pos8, pos5),
            (store_mul, ":ali_x_m",":ali_x", ":minus"),
            (position_move_y, pos8, ":ali_x_m"),
            (position_get_distance_to_ground_level, ":height_8", pos8),
            (val_sub,":height_8",":height_5"),

        #left
            (copy_position, pos4, pos5),
            (store_mul, ":ali_y_m",":ali_y", ":minus"),
            (position_move_x, pos4, ":ali_y_m"),
            (position_get_distance_to_ground_level, ":height_4", pos4),
            (val_sub,":height_4",":height_5"),

        #right
            (copy_position, pos6, pos5),
            (position_move_x, pos6, ":ali_y"),
            (position_get_distance_to_ground_level, ":height_6", pos6),
            (val_sub,":height_6",":height_5"),

        
        
        #rotation direction
            (try_begin),
            #front positive number
                (gt,":height_2", ":height_8"),
                (assign, ":direction_x", 1),
            (else_try),        
            #back
                (assign, ":direction_x", 3),
            (try_end),
            
            (try_begin),            
            #left Positive number
                (gt,":height_4", ":height_6"),
                (assign, ":direction_y", 1),
            (else_try),            
            #right
                (assign, ":direction_y", 3),
            (try_end),   
              

        #Approximate formula of tan_x;   
        #angle = -1.5x^2+607x
            (store_div,":3div2",3,2),
            (val_mul, ":3div2", ":minus"),
            (val_abs,":height_2"),
            (val_abs,":height_8"),
            (val_add, ":height_2", ":height_8"),
            (val_mul,":height_2", 100),
            (val_mul,":ali_x", 2),
            (store_div,":tan_x",":height_2",":ali_x"),
            (try_begin),
                (lt, ":tan_x", 30),#17 degrees
                (assign, ":flat_x", 1),
            (else_try),
                (gt, ":tan_x", 173),#61 degrees
                (assign, ":flat_x", 0),
                (assign, ":angle_x", 60000),
            (else_try),
                (assign, ":flat_x", 0),
                (store_mul,":linear_x",":tan_x",607),
                (val_mul, ":tan_x", ":tan_x"),
                (val_mul, ":tan_x", ":3div2"),
                (store_add,":angle_x",":tan_x",":linear_x"),
            (try_end),

            (val_abs,":height_4"),
            (val_abs,":height_6"),
            (val_add, ":height_4", ":height_6"),
            (val_mul,":height_4", 100),
            (val_mul,":ali_y", 2),
            (store_div,":tan_y",":height_4",":ali_y"),
            (try_begin),
                (lt, ":tan_y", 30),#17 degrees
                (assign, ":flat_y", 1),
            (else_try),
                (gt, ":tan_y", 173),#61 degrees
                (assign, ":flat_y", 0),
                (assign, ":angle_y", 60000),
            (else_try),
                (assign, ":flat_y", 0),
                (store_mul,":linear_y",":tan_y",607),
                (val_mul, ":tan_y", ":tan_y"),
                (val_mul, ":tan_y", ":3div2"),
                (store_add,":angle_y",":tan_y",":linear_y"),
            (try_end),

        #rotate position
            (try_begin),
                (eq, ":flat_x", 1),
                (position_rotate_x,pos5,0),
            (else_try),
                (eq, ":flat_x", 0),
                (val_div,":angle_x",1000),
                (val_sub, ":direction_x", 2),
                (val_mul, ":angle_x", ":direction_x"),               
                (position_rotate_x,pos5,":angle_x"),
            (try_end),   


            (try_begin),
                (eq, ":flat_y", 1),
                (position_rotate_y,pos5,0),
            (else_try),
                (eq, ":flat_y", 0),
                (val_div,":angle_y",1000),
                (val_sub, ":direction_y", 2),
                (val_mul, ":angle_y", ":direction_y"),
                (position_rotate_y,pos5,":angle_y"),
            (try_end),   
            #(assign, reg1, ":angle_y"),
            #(assign, reg2, ":tan_y"),
            #(display_message, "str_january_reg1_reg2"),
        
        #accelerate
            (try_begin),
                (key_is_down, key_w),
                (position_move_y,pos5,9),
            (try_end),         
            
        #animate instance
            (prop_instance_animate_to_position,":car_id",pos5,10),#100=2second
    #horse dead
                (else_try),
                        (prop_instance_stop_animating, ":car_id"),
                        #(neg|agent_is_alive, ":horse_id"),
                        (try_begin),
                (gt,":cur_agent",0),
                (agent_set_visibility,":cur_agent",1),
            (try_end),
                        
                        (scene_prop_fade_out, ":car_id", 50),
            (assign,"$reserved_15",0),        
        (try_end),   
        ]),
  
  
    (ti_on_scene_prop_use,
        [
        (store_trigger_param_1, ":user_agent_id"),
        (store_trigger_param_2, ":car_id"),
        (try_begin),
          (agent_get_horse, ":horse", ":user_agent_id"),
          (gt,":horse",-1),
          (display_message,"@Please dismount horse first!"),
        (else_try),
          (prop_instance_get_position, pos30, ":car_id"),  
          (try_begin),
            (agent_slot_eq,":user_agent_id",2,0),
            (agent_set_slot,":user_agent_id",2,1),
            (agent_set_speed_modifier,":user_agent_id",0),
            (mission_cam_set_mode,1),
            (agent_set_visibility,":user_agent_id",0),
          (try_end),
        (try_end),
        ]),

    (ti_on_scene_prop_hit,
        [
        (play_sound_at_position,"snd_dummy_hit", pos1),
        (particle_system_burst, "psys_dummy_smoke", pos1, 3),
        ]),

  
    (ti_on_scene_prop_destroy,#ti_on_scene_prop_animation_finished,
        [
        (store_trigger_param_1, ":instance_no"),
        (scene_prop_get_slot, ":speed", ":instance_no", 1),
        (lt,":speed",0),
        (prop_instance_get_position,pos1, ":instance_no"),
        (position_get_distance_to_ground_level,":distance",pos1),
        (gt,":distance",0),
        (position_move_z,pos1,":speed"),
        (prop_instance_animate_to_position,":instance_no",pos1,11),
        (val_add,":speed",-2),
        (scene_prop_set_slot, ":instance_no", 1, ":speed"),
        ]),
                ]
                ),


#Agland



2023年2月16日第一版错误已修正
(try_for_parties,":var_30"),
    (store_troop_faction,":var_33",":var_30"),
    (eq,":var_33","fac_kingdom_3"),
    (call_script,"script_436","trp_player",1000),
    (party_set_faction,":var_30","fac_kingdom_2"),
    (party_set_ai_behavior,":var_30",ai_bhvr_patrol_party),
    (party_set_ai_object,":var_30","p_main_party"),
    (party_set_flags,":var_30",pf_default_behavior,0),
(try_end),


本来目的是,扫一遍大地图的特定阵营party,让他们变成为我的人,并改ai。拿个加钱的脚本测试生效不生效。

结果,那个加钱的脚本循环次数是对的,能判别party的阵营。但是剩下几句话为啥没用啊?求大神解惑,谢谢!




搜狗截图23年02月16日1633_1.png

29

主题

691

回帖

551

积分

骑士

Rank: 4Rank: 4

UID
3322408
第纳尔
1738
精华
0
互助
67
荣誉
0
贡献
0
魅力
4
注册时间
2022-2-3
鲜花(55) 鸡蛋(0)
发表于 2023-2-17 08:43:46 来自手机 | 显示全部楼层
你这是循环的party,第二句话为什么是store troop的faction呢?来自: Android客户端

评分

参与人数 1第纳尔 +5 互助 +1 收起 理由
Aomine Daiki + 5 + 1 乐于助人!

查看全部评分

30

主题

200

回帖

169

积分

见习骑士

Rank: 3

UID
2462463
第纳尔
1472
精华
0
互助
20
荣誉
0
贡献
0
魅力
50
注册时间
2015-3-3
鲜花(43) 鸡蛋(0)
 楼主| 发表于 2023-2-17 09:38:54 | 显示全部楼层
本帖最后由 战争傀儡阿格兰 于 2023-2-17 10:23 编辑
112233lyh 发表于 2023-2-17 08:43
你这是循环的party,第二句话为什么是store troop的faction呢?


感谢指正,新手不熟练。。已成功识别为party的阵营
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

Archiver|手机版|小黑屋|骑马与砍杀中文站

GMT+8, 2024-5-4 08:46 , Processed in 0.124459 second(s), 28 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表