I can hear my gun shot, but i cannot hear other gun shot in MP

Users who are viewing this thread

book4444

Sergeant
Dear all experienced modder,

I have add firearms in the PW base mod, the players can hear their own gun shot, but cannot hear others.

here is my scripts

["arquebus", "Tanegashima Matchlock", [("japangun",0)], itp_type_musket |itp_merchandise|itp_primary|itp_next_item_as_melee|itp_two_handed|itp_cant_reload_while_moving|itp_cant_use_on_horseback ,itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket,15000 , weight(4)|difficulty(12)|spd_rtng(3:cool: | shoot_speed(250) | thrust_damage(90 ,pierce)|max_ammo(1)|accuracy(99),imodbits_crossbow,
[(ti_on_weapon_attack, [(play_sound,"snd_musket_shot"),(position_move_x, pos1,1),(position_move_y, pos1,149),(particle_system_burst, "psys_bomb_flare", pos1, 1),(position_move_x, pos1,1),(position_move_y, pos1,100),(particle_system_burst, "psys_musket_smoke", pos1, 5)])]],

In addition, firearms proficient now workin, higher firearms skill make gun more accurate but firearms skill doesn't show up in training scene prop windows (like crossbow 14 str, 14 agi, 90 one-handed weapon, 150 crossbow ** but firearm doesn't show up**)

I don't mind firearms skill doesn't show (just give the info-may be it's the cause), but i want others can hear others gunshot. how can i make it correctly, please advice
 
This question has been answered in the Persistent World sub forums.
https://forums.taleworlds.com/index.php/topic,273767.msg6541518.html#msg6541518
The search function would of saved you a lot of time. Always try searching for your answer before posting here. Modders will appreciate the effort more and be more inclined to help you.

you need to do something like this:
Create a python function so that you could reuse it more than once without typing all of that for each gun.
Code:
def itm_gun_effect(sound="snd_pistol_shot", offset_x=23, offset_z=35, particles="psys_pistol_smoke", burst_strength=10):
  return (ti_on_weapon_attack,
   [(multiplayer_is_server),
    (store_trigger_param_1, ":agent_id"),
    (agent_play_sound, ":agent_id", sound),
    (position_move_x, pos1, offset_x),
    (position_move_z, pos1, offset_z),
    (particle_system_burst, particles, pos1, burst_strength),
    ])

then just add it to ur item:
Code:
["flintlock_pistol", "Flintlock Pistol", [("flintlock_pistol",0)], itp_type_pistol|itp_primary, itcf_shoot_pistol|itcf_reload_pistol,
 230, weight(1.5)|difficulty(0)|spd_rtng(38)|shoot_speed(160)|thrust_damage(45, pierce)|max_ammo(1)|accuracy(65), imodbits_none, [itm_gun_effect()]],
 
Arthur_Pendragon said:
This question has been answered in the Persistent World sub forums.
https://forums.taleworlds.com/index.php/topic,273767.msg6541518.html#msg6541518
The search function would of saved you a lot of time. Always try searching for your answer before posting here. Modders will appreciate the effort more and be more inclined to help you.

you need to do something like this:
Create a python function so that you could reuse it more than once without typing all of that for each gun.
Code:
def itm_gun_effect(sound="snd_pistol_shot", offset_x=23, offset_z=35, particles="psys_pistol_smoke", burst_strength=10):
  return (ti_on_weapon_attack,
   [(multiplayer_is_server),
    (store_trigger_param_1, ":agent_id"),
    (agent_play_sound, ":agent_id", sound),
    (position_move_x, pos1, offset_x),
    (position_move_z, pos1, offset_z),
    (particle_system_burst, particles, pos1, burst_strength),
    ])

then just add it to ur item:
Code:
["flintlock_pistol", "Flintlock Pistol", [("flintlock_pistol",0)], itp_type_pistol|itp_primary, itcf_shoot_pistol|itcf_reload_pistol,
 230, weight(1.5)|difficulty(0)|spd_rtng(38)|shoot_speed(160)|thrust_damage(45, pierce)|max_ammo(1)|accuracy(65), imodbits_none, [itm_gun_effect()]],

Thank you very much sir
 
Just use the script game_missile_launch (you probably need to add it to your MS) to trigger the sound- and particle- effects.
Code:
  # script_game_missile_launch
  # Input: arg1 = shooter_agent_id, arg2 = weapon_item_id, pos1 = weapon_item_position
  # Output: none 
  ("game_missile_launch",
  [
    (store_script_param, ":shooter_agent", 1),
    (store_script_param, ":item_id", 2),

    (try_begin),
       (neg|multiplayer_is_dedicated_server),#only client side
       #Do your stuff here
    (try_end),
  ]),
This way you wont waste any additional network traffic, as this script is called server and client side.
 
Back
Top Bottom