caseofinsanity
Veteran
Hi all,
I'm working on my NW mod and I thought it would be nice to provide something for the community.
EXAMPLE VIDEO
Weapon Models Link
Animation Link
Credits:
I'm working on my NW mod and I thought it would be nice to provide something for the community.
EXAMPLE VIDEO
Code:
["fix_bayonet", acf_enforce_all, amf_priority_reload|amf_play, [5, "fix_bayonet", 0, 119, arf_blend_in_8]],
["fix_bayonet_end", 0, amf_priority_mount|amf_play, [0.1, "fix_bayonet", 50, 119, arf_blend_in_1]],
["unfix_bayonet", acf_enforce_all, amf_priority_reload|amf_play, [5, "unfix_bayonet", 0, 119, arf_blend_in_8]],
["unfix_bayonet_end", 0, amf_priority_mount|amf_play, [0.1, "unfix_bayonet", 50, 119, arf_blend_in_1]],
Code:
# British Musket without bayonet
["british_brown_bess_bare", "Infantry Musket", [("brown_bess_musket_bare",0)], itp_cant_use_on_horseback|itp_type_crossbow |itp_merchandise|itp_primary|itp_two_handed|itp_cant_reload_on_horseback|itp_cant_reload_while_moving|itp_next_item_as_melee ,itcf_shoot_musket|itcf_carry_crossbow_back,
683 , weight(3.0)|difficulty(0)|spd_rtng(26) | shoot_speed(250) | thrust_damage(100 ,pierce)|max_ammo(1)|accuracy(75),imodbits_none,[]],
["british_brown_bess_bare_melee", "Infantry Musket", [("brown_bess_musket_bare",0)], itp_has_upper_stab|itp_type_polearm |itp_primary|itp_no_blur|itp_offset_musket,itc_musket_melee|itcf_carry_crossbow_back,
180 , weight(3.0)|difficulty(0)|spd_rtng(86) | weapon_length(115)|swing_damage(22 , blunt) | thrust_damage(13, blunt),imodbits_none ],
# Copy and Repeat for other factions
# ...
Code:
# Starting trigger for fixing/unfixing bayonet
multiplayer_client_start_fixing_bayonet = (
0, 0.05, 0, [(neg|multiplayer_is_dedicated_server),
(neg|is_presentation_active, "prsnt_multiplayer_admin_chat"),
(key_clicked,key_b),
],
[
(multiplayer_get_my_player, ":cur_player"),
(player_is_active,":cur_player"),
# Fix/Unfix bayonet
(store_mission_timer_a_msec,":cur_time"),
(store_sub, ":elapsed_time", ":cur_time", "$g_last_time_bayonet_was_fixed"),
# Player has to wait 5 seconds between fixing/unfixing bayonet
(ge,":elapsed_time",5000),
(player_get_agent_id, ":cur_player_agent", ":cur_player"),
(agent_get_wielded_item,":cur_wielded_weapon",":cur_player_agent", 0),
(assign, ":continue", 1),
# INCOMPLETE SECTION
# Write your musket type detection code here
(assign, ":musket_type", 0),
(try_begin),
(eq,":musket_type",0),
#Bayonet will be unfixed after 1.5s
(assign,"$g_bayonet_equip_timer", 1500),
(else_try),
(eq,":musket_type",1),
#Bayonet will be unfixed after 2.6s
(assign,"$g_bayonet_equip_timer", 2600),
(else_try),
(assign, ":continue", 0),
(try_end),
(eq, ":continue", 1),
(assign,"$g_last_time_bayonet_was_fixed",":cur_time"),
(assign,"$g_bayonet_is_being_fixed", 1),
(assign,"$g_current_weapon", ":cur_wielded_weapon"),
(multiplayer_send_2_int_to_server, multiplayer_event_fix_bayonet, ":cur_player_agent",":cur_wielded_weapon"),
])
Code:
# This gets triggered after multiplayer_client_start_fixing_bayonet
# Equips the player with fixed/unfixed musket while the animation is playing
multiplayer_client_equip_item = (
0, 0, 0, [(neg|multiplayer_is_dedicated_server),
(eq,"$g_bayonet_is_being_fixed",1),
],
[
(multiplayer_get_my_player, ":cur_player"),
(player_is_active,":cur_player"),
(store_mission_timer_a_msec,":cur_time"),
(store_sub, ":elapsed_time", ":cur_time", "$g_last_time_bayonet_was_fixed"),
(ge,":elapsed_time","$g_bayonet_equip_timer"),
(player_get_agent_id, ":cur_player_agent", ":cur_player"),
(assign,":continue",1),
(try_begin),
# Stop fixing/unfixing if the player switched to a different weapon
(agent_get_wielded_item,":cur_player_item",":cur_player_agent",0),
(neq,":cur_player_item","$g_current_weapon"),
(multiplayer_send_int_to_server, multiplayer_event_stop_fixing_bayonet, ":cur_player_agent"),
(assign,"$g_bayonet_is_being_fixed",0),
(assign,":continue",0),
(try_end),
(eq,":continue",1),
(assign,":player_new_item", "$g_current_weapon"),
(try_begin),
(eq,"$g_current_weapon","itm_british_brown_bess"),
(assign,":player_new_item","itm_british_brown_bess_bare"),
(else_try),
(eq,"$g_current_weapon","itm_british_brown_bess_bare"),
(assign,":player_new_item","itm_british_brown_bess"),
(else_try),
# Repeat the same for other factions
# .......
(try_end),
(multiplayer_send_2_int_to_server, multiplayer_event_equip_bayonet, "$g_current_weapon",":player_new_item"),
(assign,"$g_bayonet_is_being_fixed",0),
])
Code:
(else_try),
(eq, ":event_type", multiplayer_event_fix_bayonet),
(store_script_param, ":player_agent", 3),
(store_script_param, ":player_item", 4),
(agent_is_active,":player_agent"),
(agent_is_alive,":player_agent"),
# INCOMPLETE SECTION
# Write your musket type detection code here
# Assign ":musket_type" to 0 or 1 depending whether the musket has bayonet or not
(assign, ":musket_type", 0),
(try_begin),
(eq,":musket_type",0),
(agent_set_animation,":player_agent","anim_unfix_bayonet",0),
(else_try),
(eq,":musket_type",1),
(agent_set_animation,":player_agent","anim_fix_bayonet",0),
(try_end),
(else_try),
......
Code:
...
(else_try),
(eq,":event_type",player_action_stop_fixing_bayonet),
(agent_is_alive,":player_agent"),
(agent_set_animation,":player_agent","anim_fix_bayonet_end"),
(else_try),
....
Code:
......
(else_try),
(eq,":event_type",multiplayer_event_equip_bayonet),
(store_script_param, ":player_item", 3),
(store_script_param, ":player_new_item", 4),
(player_get_agent_id, ":player_agent", ":player_no"),
(agent_is_active,":player_agent"),
(agent_is_alive,":player_agent"),
# Find if the current musket is loaded
(agent_get_item_cur_ammo, ":gun_is_loaded", ":player_agent", 0),
(agent_unequip_item,":player_agent",":player_item"),
(agent_equip_item,":player_agent",":player_new_item"),
(agent_set_wielded_item,":player_agent",":player_new_item"),
# Set the load status of the new musket to be same as the previous musket
(agent_set_ammo, ":player_agent", ":player_new_item", ":gun_is_loaded"),
(else_try),
......
Code:
multiplayer_event_fix_bayonet = ...
multiplayer_event_stop_fixing_bayonet = ...
multiplayer_event_equip_bayonet = ...
# 127 is max!, 0 left. (1 = unused)
Code:
g_last_time_bayonet_was_fixed
g_bayonet_is_being_fixed
g_current_weapon
g_bayonet_equip_timer
Weapon Models Link
Animation Link
Credits:
- The musket models without bayonet are modified versions of the original fixed muskets.
- The fixing&unfixing animations were made by me, CaseOfInsanity and it's free to use. If your mod ends up using the animations, it would be nice of you to mention my name