#using scripts\shared\ai_shared; #using scripts\shared\array_shared; #using scripts\shared\clientfield_shared; #using scripts\shared\flag_shared; #using scripts\shared\flagsys_shared; #using scripts\shared\system_shared; #using scripts\shared\util_shared; #using scripts\shared\vehicleriders_shared; #namespace turret; function autoexec __init__sytem__() { system::register("turret",&__init__,undefined,undefined); } /*----------------------------------------------------------------------------------------------------- ****************************************************************** Turret Overview ****************************************************************** This script handles all turret functionality. Below are a list of script command available. See the module:- t6\game\share\devraw\scripts\module_turret.gsc for a group simple examples that shows the scripter in-game MG Turrent and Helicopter Turret examples. Note: An MG Turret typicaly only has 1 turret. Helicopter can have upto 5 turrets, the main turret and 4 gunner turrets. Setting up an MG Turret in Radient:- - See the file module_turret.gsc for a description of how to setup a manned MG Turret in Radiant. ****************************************************************** Using, Activating and Pausing a Turret ****************************************************************** is_turret_enabled( n_index ) - Checks to see if the turret is enabled. enable( n_index ) - Enables the given turret. disable( [n_index] ) - Disables the given turret, but it keeps its targetted information. pause( [n_index], ) - Pause turret for X time. unpause( [n_index] ) - remove the pause restriction from the turret. stop( ) - Stops the turrets current action and puts it back in search for enemy mode. ****************************************************************** Turret "User" Functios - Turrets that need Users to Operate ****************************************************************** does_need_user( ) - Does the turret need a used (node) to oprerate. does_have_user( ) - Does the turret currently have a user? get_user( ) - Gets the user of this turret. is_current_user( , [n_index] ) - Checks to see if an AI is the current user. SetOnTargetAngle( ) - The turret has to be aiming within this number of degrees at the target to get the "turret_on_target" notify. ****************************************************************** Turret Targetting Functions ****************************************************************** set_target( , [v_offset], [n_index] ) - Sets the target of this turret. get_target( [n_index] ) - Returns turret target data for this turret. clear_target( [n_index] ) - Clears turret target data for this turret. set_target_flags( , [n_index] ) - Sets a sub-set of targets for the turret. set_target_ent_array( [a_ents] ) - Passes an array of targets to the turret to kill. clear_target_ent_array() - Scripters ability to clear the turrets ent target array. set_ignore_ent_array( [a_ents] ) - Passes an array of ents to the turret to ignore. clear_ignore_ent_array() - Scripters ability to clear the turrets ent ignore array. set_best_target_func( <::function>, [n_index] ) - Custom override function, scripter can use to custermise their choice from potential targets; is_target_in_view( e_target, n_index ) - Lets script know if the turret can aim for a target within its GDT movement constraints. can_turret_shoot_target( e_target, n_index ) - Basically is there anythinhg blocking the turrets shot (geo etc..) can_hit_target( e_target, turret_index ) - Basically combines the two functions above ( is_target_in_view() and can_turret_shoot_target() ) set_max_target_distance( n_dist ) - Can be used to limit the maximum distance of a turret's target set_min_target_distance( n_dist ) - Can be used to limit the minimum distance of a turret's target (from pivot point) set_min_target_distance_squared( n_dist_squared ) - Can be used to limit the minimum distance of a turret's target (from pivot point); squared distance version of above ****************************************************************** Turret Firing Functions ****************************************************************** fire( [n_index] ) - Fires a turret. fire_for_time( , [n_index] ) - Fires a turret for a time, blocks for n_time. shoot_at_target( ,