- 好友
- 0
- 在线时间
- 1 小时
- 最后登录
- 2022-12-14
随仆
- UID
- 2604075
- 第纳尔
- 160
- 精华
- 0
- 互助
- 2
- 荣誉
- 1
- 贡献
- 0
- 魅力
- 10
- 注册时间
- 2015-9-20
鲜花( 7) 鸡蛋( 0)
|
本帖最后由 DSFSAEFE 于 2022-8-28 16:04 编辑
8/28更新音效的代码
参考 https://bbs.mountblade.com.cn/thread-2025358-1-3.html 写了一个简化的火箭弹系统,主要思想是用别的触发器代替场景触发器,为了简单起见(其实是因为我不会写)没有控制火箭弹的运动轨迹的代码
我是用战团原版改的,用了拿破仑的声音和粒子效果
加上几个slot
scene_prop_slot_y_speed
scene_prop_slot_x_speed
scene_prop_slot_attack_agent
|
加一个物品触发器(最好加到远程武器上),在攻击时刷一个火箭,让火箭动一下
(ti_on_weapon_attack,[
(play_sound, "snd_rocket_launch"),
(store_trigger_param_1, ":attacker_agent"),
(set_spawn_position,pos1),
(spawn_scene_prop, "spr_mm_rocket_code_only"),
(assign,":sprop_instance",reg0), (position_move_y, pos1, 500, 0),
(prop_instance_animate_to_position, ":sprop_instance", pos1, 50),
(scene_prop_set_slot,":sprop_instance", scene_prop_slot_attack_agent, ":attacker_agent"),
(scene_prop_set_slot,":sprop_instance", scene_prop_slot_y_speed, 500),
])
|
"rocket" 和 "bo_rocket" 改成火箭的模型和碰撞
第一个触发器里放火箭的粒子效果、音效,以及刷出火箭之后执行一次的代码
第二个触发器里放控制轨迹的代码和火箭落地后执行的代码
("mm_rocket_code_only" ,sokf_moveable,"rocket","bo_rocket" , [
(ti_on_scene_prop_init,
[
(store_trigger_param_1, ":sprop_instance"),
(prop_instance_add_particle_system, ":sprop_instance", "psys_rocket_smoke", 25), (prop_instance_play_sound, ":sprop_instance", "snd_rocket_fly", sf_looping),
]),
(ti_on_scene_prop_animation_finished,
[
(store_trigger_param_1, ":sprop_instance"),
(prop_instance_get_position,pos30,":sprop_instance"),
(try_begin),
(position_get_distance_to_terrain,":distance",pos30),
(this_or_next|lt,":distance",10),
(cast_ray,":obstacle",pos31,pos30,350),
(scene_prop_set_visibility,":sprop_instance", 0),
(scene_prop_get_slot,":attacker_agent",":sprop_instance", scene_prop_slot_attack_agent),
(copy_position,pos1,pos30),
(prop_instance_stop_sound, ":sprop_instance"),
(call_script,"script_explode", ":attacker_agent", 100, 500),
(else_try),
(scene_prop_get_slot,":y_speed",":sprop_instance", scene_prop_slot_y_speed),
(scene_prop_get_slot,":x_speed",":sprop_instance", scene_prop_slot_x_speed),
(position_move_y,pos30,":y_speed",0),
(position_move_x,pos30,":x_speed",0),
(val_add,":x_speed",10),
(scene_prop_set_slot,":sprop_instance", scene_prop_slot_y_speed,":y_speed"),
(scene_prop_set_slot,":sprop_instance", scene_prop_slot_x_speed,":x_speed"),
(prop_instance_animate_to_position,":sprop_instance",pos30,50),
(try_end),
]),
]),
刷出火箭之后要先让火箭动一下,这样才能触发第二个触发器,不知道有没有更简单的方法
|
爆炸的代码
#script_explode
# INPUT: explode_position(pos1), attacker_agent, damage, explode_radius
# OUTPUT: none
("explode",
[
(store_script_param, ":attacker_agent", 1),
(store_script_param, ":damage", 2),
(store_script_param, ":explode_radius", 3),
(store_div,":smokes",":explode_radius", 2),
(play_sound_at_position, "snd_explode", pos1),
(particle_system_burst, "psys_explode_smoke", pos1, ":smokes"),
(try_for_agents, ":attacked_agent"), (try_begin),
(agent_get_position, pos2, ":attacked_agent"),
(get_distance_between_positions, ":distance", pos1, pos2),
(lt, ":distance", ":explode_radius"),
(agent_deliver_damage_to_agent, ":attacker_agent", ":attacked_agent", ":damage"),
(particle_system_burst, "psys_game_blood_2", pos2, 50),
(try_end),
(try_end),
]),
|
这几个文件在拿破仑那里有
("rocket_launch", sf_priority_10 | sf_vol_10, ["rocket_launch.wav"]),
("rocket_fly", sf_priority_10 | sf_vol_10, ["rocket_launch1.wav","rocket_launch2.wav"]),
|
火箭飞行的粒子效果可以直接用 https://bbs.mountblade.com.cn/thread-2025358-1-3.html 这里的,爆炸的音效和粒子效果我没法提供,你们自己找吧
用加上了前面写的物品触发器的武器攻击就可以发射火箭了
大概就这些了,代码的不足之处欢迎各位大佬批评指出
|
评分
-
查看全部评分
鲜花鸡蛋幼稚园殺手 在2022-8-24 12:17 送朵鲜花 并说:我非常同意你的观点,送朵鲜花鼓励一下 幼稚园殺手 在2022-8-24 12:17 送朵鲜花 并说:我非常同意你的观点,送朵鲜花鼓励一下
|