Cokjan's Workshop
1. Movement Controls
1.1 Dodge Step Mechanic
Adds a grounded, not over the top 3 directional dodge step. The animation are not perfect, but perhaps still acceptable enough.
If the player has more than 6 athletics skill, the player can dodge step and perform actions like attack/block at the same time.
Not included in the stuff below is the triggers for forward step, although the animation exists in the file so you can try to add it.
1.2 Bannerlord-ish Horse Controls
Adds some new movement control for horse riding.
1. Boost: Accelerate faster, can only be used when the horse isn't moving too fast, but not too slow either. Requires 4 riding skill
2. Stop: Force the horse to stop at high speed, useful for horse archery when player doesn't have high horse archery skill. Requires 2 riding skill
3. Move sideways: Walk left/right when horse is not moving.
... some more stuff to come, perhaps.
Let me know if something is not working, I re-edited the codes here on the fly just to remove unnecessary lines.
Discussion, feedbacks, and inputs are very much welcome as I am not a coder.
1. Movement Controls
1.1 Dodge Step Mechanic
Adds a grounded, not over the top 3 directional dodge step. The animation are not perfect, but perhaps still acceptable enough.
If the player has more than 6 athletics skill, the player can dodge step and perform actions like attack/block at the same time.
Not included in the stuff below is the triggers for forward step, although the animation exists in the file so you can try to add it.
Code:
# COX PLAYER DODGE
(
0, 0, 3, [
(key_clicked, key_left_alt)], [
(get_player_agent_no, ":pla"),
(agent_is_active, ":pla"),
(agent_is_alive, ":pla"),
(agent_get_horse, ":horse", ":pla"),
(eq, ":horse", -1),
(agent_get_troop_id, ":pla_troop", ":pla"),
(store_skill_level, ":athletics", "skl_athletics", ":pla_troop"),
(agent_get_animation, ":pla_anim", ":pla", 1),
(agent_get_position, pos2, ":pla"),
(agent_get_speed, pos1, ":pla"),
(set_fixed_point_multiplier, 100),
(position_get_x, ":leftright", pos1),
(position_get_y, ":frontback", pos1),
(try_begin),
(le, ":athletics", 5),
(try_begin),
(gt, ":leftright", 10), #was 50 previously
(agent_set_animation, ":pla", "anim_cox_dodge_right"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(else_try),
(lt, ":leftright", -10),
(agent_set_animation, ":pla", "anim_cox_dodge_left"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(else_try),
(lt, ":frontback", -10),
(agent_set_animation, ":pla", "anim_cox_dodge_backward"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(try_end),
(else_try),
(gt, ":leftright", 10), #was 50 previously
(agent_set_animation, ":pla", "anim_cox_dodge_right_skill"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(else_try),
(lt, ":leftright", -10),
(agent_set_animation, ":pla", "anim_cox_dodge_left_skill"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(else_try),
(lt, ":frontback", -10),
(agent_set_animation, ":pla", "anim_cox_dodge_backward_skill"),
(agent_play_sound, ":pla", "snd_jump_begin"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(try_end),
]),
Code:
["cox_dodge_right", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 20, 39, arf_blend_in_4, 0, (1.7, 0, 0), 0], ],
["cox_dodge_left", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 55, 74, arf_blend_in_4, 0, (-1.7, 0, 0), 0], ],
["cox_dodge_backward", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 110, 129, arf_blend_in_4, 0, (0, -2, 0), 0], ],
["cox_dodge_right_skill", acf_enforce_lowerbody|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 20, 39, arf_blend_in_4, 0, (1.7, 0, 0), 0], ],
["cox_dodge_left_skill", acf_enforce_lowerbody|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 55, 74, arf_blend_in_4, 0, (-1.7, 0, 0), 0], ],
["cox_dodge_backward_skill", acf_enforce_lowerbody|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_accurate_body|amf_client_prediction,
[0.7, "cox_dodge", 110, 129, arf_blend_in_4, 0, (0, -2, 0), 0], ],
Code:
# COX i-FRAME
(
ti_on_agent_hit, 0, 0, [], [
(store_trigger_param_1, ":ags"), #victim
(store_trigger_param_2, ":possible"), #dealer
(store_trigger_param_3, ":damage"),
(agent_get_animation, ":ags_anim", ":ags"),
(agent_get_animation, ":pos_anim", ":possible"),
(try_begin),
(this_or_next|eq, ":ags_anim", "anim_cox_dodge_right"),
(this_or_next|eq, ":ags_anim", "anim_cox_dodge_backward"),
(this_or_next|eq, ":ags_anim", "anim_cox_dodge_left"),
(this_or_next|eq, ":ags_anim", "anim_cox_dodge_right_skill"),
(this_or_next|eq, ":ags_anim", "anim_cox_dodge_left_skill"),
(eq, ":ags_anim", "anim_cox_dodge_backward_skill"),
(set_trigger_result, 0),
(try_end),
]),
1.2 Bannerlord-ish Horse Controls
Adds some new movement control for horse riding.
1. Boost: Accelerate faster, can only be used when the horse isn't moving too fast, but not too slow either. Requires 4 riding skill
2. Stop: Force the horse to stop at high speed, useful for horse archery when player doesn't have high horse archery skill. Requires 2 riding skill
3. Move sideways: Walk left/right when horse is not moving.
Code:
#COX PLAYER HORSE CONTROLS
(
0, 0, 1.1, [
(key_clicked, key_left_alt)], [
(get_player_agent_no, ":pla"),
(agent_is_active, ":pla"),
(agent_is_alive, ":pla"),
(agent_get_horse, ":horse", ":pla"),
(neq, ":horse", -1),
(agent_get_animation, ":horse_anim", ":horse"),
(agent_get_troop_id, ":pla_troop", ":pla"),
(store_skill_level, ":riding", "skl_riding", ":pla_troop"),
(agent_get_speed, pos1, ":horse"),
(agent_get_position, pos2, ":horse"),
(set_fixed_point_multiplier, 100),
# (position_get_x, ":leftright", pos1),
(position_get_y, ":frontback", pos1),
(try_begin),
(game_key_is_down, gk_move_forward),
(ge, ":riding", 4),
(is_between, ":frontback", 150, 500),
(neq, ":horse_anim", "anim_cox_ride_boost"),
(agent_set_animation, ":pla", "anim_cox_ride_boost"),
(agent_set_animation, ":horse", "anim_cox_horse_boost"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(agent_play_sound, ":horse", "snd_cox_boost_horse"),
(else_try),
(game_key_is_down, gk_move_backward),
(ge, ":riding", 2),
(ge, ":frontback", 500),
(agent_set_animation, ":pla", "anim_cox_ride_stop"),
(agent_set_animation, ":horse", "anim_cox_horse_stop"),
(particle_system_burst, "psys_game_hoof_dust", pos2, 15),
(agent_play_sound, ":horse", "snd_horse_jump_end"),
(else_try),
(game_key_is_down, gk_move_right),
(le, ":frontback", 50),
(agent_set_animation, ":horse", "anim_cox_horse_right"),
(agent_play_sound, ":horse", "snd_horse_walk"),
(else_try),
(game_key_is_down, gk_move_left),
(le, ":frontback", 50),
(agent_set_animation, ":horse", "anim_cox_horse_left"),
(agent_play_sound, ":horse", "snd_horse_walk"),
(try_end),
]),
Code:
### PUT THIS IN UNUSED HUMAN ANIMS
["cox_ride_stop", acf_enforce_lowerbody, amf_priority_dodge|amf_play|amf_client_prediction,
[1.5, "cox_ride", 0, 5, arf_blend_in_4, 0, (0, 0, 0), 0], ],
["cox_ride_boost", acf_enforce_lowerbody, amf_priority_dodge|amf_play|amf_client_prediction|amf_continue_to_next,
[0.8, "anim_human_02", 205, 222, arf_blend_in_4], ],
["cox_ride_boost_cont", acf_enforce_lowerbody|acf_synch_with_horse, amf_priority_dodge|amf_play|amf_client_prediction, #too lazy to merge it
[1.5, "cox_ride_boost", 1, 65, arf_blend_in_32], ],
### PUT THIS IN UNUSED HORSE ANIMS
["cox_horse_left", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_client_prediction,
[1.0, "anim_horse", 496, 533, arf_blend_in_4, 0, (-2.5, 0, 0), 0], ],
["cox_horse_right", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_client_prediction,
[1.0, "anim_horse", 447, 484, arf_blend_in_4, 0, (2.5, 0, 0), 0], ],
["cox_horse_stop", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_dodge|amf_play|amf_client_prediction|amf_continue_to_next,
[0.8, "cox_horse", 34, 38, arf_blend_in_4, 0, (0, 4.8, 0), 0], ],
["cox_horse_stop_cont", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_continue|amf_play|amf_client_prediction,
[0.8, "cox_horse", 39, 40, arf_blend_in_4, 0, (0, 1.1, 0), 0], ],
["cox_horse_boost", acf_enforce_all|acf_displace_position|acf_align_with_ground, amf_priority_continue|amf_play|amf_client_prediction,
[2.3, "cox_horse", 49, 106, arf_blend_in_4, 0, (0, 6, 0), 0], ],
Code:
("cox_boost_horse",sf_vol_5, ["cox_boost_horse.ogg"]),
... some more stuff to come, perhaps.
Let me know if something is not working, I re-edited the codes here on the fly just to remove unnecessary lines.
Discussion, feedbacks, and inputs are very much welcome as I am not a coder.
Last edited: