Files
sfall/artifacts/example_mods/BurstControl/gl_burstcontrol.ssl
T
NovaRain e92c994744 Added a new example mod gl_rest_encounter
Added a burst control example script.
2023-06-02 15:15:01 +08:00

31 lines
808 B
ObjectPascal

/*
A basic example of how to use set_spray_settings function for script-based burst control
*/
#include "..\headers\define.h"
#include "..\headers\sfall\define_extra.h"
#include "..\headers\sfall\sfall.h"
procedure start;
procedure ammocost_handler;
procedure start begin
if game_loaded then begin
register_hook_proc(HOOK_AMMOCOST, ammocost_handler);
end
end
procedure ammocost_handler begin
variable
weapon := get_sfall_arg,
bullets := get_sfall_arg,
cost := get_sfall_arg,
event := get_sfall_arg;
if (event == 2 and weapon > 0) then begin // when calculating number of burst rounds
if (obj_pid(weapon) == PID_ASSAULT_RIFLE) then begin
set_spray_settings(1, 1, 1, 1); // burst attack will not hit other targets
end
end
end