#script_effects_shotgun
#called when blunderbusses are fired
#Inputs = none
#Outputs = none
("effects_shotgun",
[
(store_trigger_param, ":agent", 1), #Get the attacker Agent for add_missile
(store_trigger_param, ":num_shots", 2), #number of shots
(store_trigger_param, ":item", 3), #item name
(store_trigger_param, ":bullet_type", 4), #bullet type
(set_fixed_point_multiplier, 100),
(play_sound,"snd_arquebus"),
(try_begin),
(store_random_in_range, ":rand", 0,5),
(eq, ":rand", 0),
(play_sound,"snd_release_crossbow_far"),
(try_end),
(position_move_x,pos1,0),
(position_move_y,pos1,150),
(particle_system_burst,"psys_pistol_smoke",pos1,6),
(particle_system_burst,"psys_pistol_flare",pos1,5),
(particle_system_burst,"psys_pistol_smoke_large",pos1,5),
(try_for_range, ":unused", 0, ":num_shots"),
(copy_position, pos2, pos1),
#Shotgun script
#Rifle Version
#Kludge code to fix the final angles and arrive at a satisfactory result.
#The engine doesn't appear to use Euler angles to give perfect precision...
#Under all circumstances, so this will be off a bit if firing way up or down.
(assign, ":x_fix", -350),#-3.5 degrees
(assign, ":z_fix", 570),#5.7 degrees
#The following line is our "choke" adjustment on the Z axis.
#Unless you need a fan pattern, You'll want to keep the change...
#The same for X and Z, but Z needs to be applied through the special fix below.
(store_random_in_range, ":z_offset", -200, 201),#2 deg. of random rotation on the Z axis
(val_add, ":z_fix", ":z_offset"),#Add offset to the Z fix
#Fix for Z axis, using floating-point adjustment of the quaternian
#Don't mess with the next three lines...
#Unless you really know what's going on with the math :-)
(position_rotate_x_floating, pos2, 9000), # change axis by rotating 90 degrees
(position_rotate_y_floating, pos2, ":z_fix"), # rotate z floating
(position_rotate_x_floating, pos2, -9000), # change axis back
#Choke adjustment for the X axis.
#Should match the choke adjustment for the Z in most cases.
(store_random_in_range, ":x_offset", -200, 201),#2 deg. of random rotation on the X axis
(val_add, ":x_fix", ":x_offset"),#Add offset to the X fix
(position_rotate_x_floating, pos2, ":x_fix"), # Final adjustment of X
(store_random_in_range, ":ammo_speed", 7800,8200), #2 This is a random amount of speed per spawned missile, between 78 and 82 standard units
(add_missile, ":agent", pos2, ":ammo_speed", ":item", 0, ":bullet_type", 0),
(try_end),
# (play_sound,"snd_gunshot_heavy"),#Firing sound
# (position_move_y,pos1,95),#Move out along Y
# (particle_system_burst,"psys_pistol_smoke",pos1,15),#Smoke
# (particle_system_burst,"psys_gun_sparks",pos1,15),#Flare
]
),