Such as <OnFireWeapon> and <OnSystemWeaponFire>. It doesn't seem like this would affect vanilla at all. It might require some mods to be updated. But it would allow mods to do things like replace the sound played by repeating weapons correctly (SNAPSS), choose targets for each shot according to some algorithm, or stop firing mid-burst if some condition is met.
See also: https://ministry.kronosaur.com/record.hexm?id=24830
I can see issues with this (because sometimes you'll only want an event to fire once per burst), but the option should be there.
I was strongly considering putting in a ticket to this effect, myself.
There could be a variable set to the number of the shot in the burst.
Also, if you really want to be sure it doesn't break older mods, it could trigger a separate event, like <OnSystemRepeatFire>. But I'm not sure there are any mods this would affect that are currently working but wouldn't be updated by their creators.
I've fixed it so <OnSystemWeaponFire>
get called for repeated shots. There is a new variable, aWeaponRepeat
, which is set to True
if it is a repeated (not the first) shot.
Groovy. Now I can get some more SNAPSS work done. ^.^
Great! Could these changes (and defining aShotObj) also apply to <OnFireWeapon>?
@nms: <OnFireWeapon>
is already called once per shot (including repeated). In fact, it has a aFireRepeat
variable which specifies the ordinal of the shot. [I've changed my fix to match this in <OnSystemWeaponFire>
.
But we can't define aShotObj
in <OnFireWeapon>
. The whole point of the event is to create shots, so it gets called before we create any shots (and <OnSystemWeaponFire>
get called afterwards).
We could add a new event (e.g., <OnWeaponFire>
or something), but I can't do that for this next release. Please add a new ticket for that.
Oh, right, it controls whether the normal shot(s) are created at all. So if we want the ID(s), we can create the shot(s) in the event and return 'shotFired. Then there's no need for another event.
Edit: For future reference, there's also <OnCreateShot>, where gSource is the shot.