// The new weapon instance is passed to this function as the 'this' // Properties can be set like this.Property = x, or the this prefix can be left off. ////////////////////////////////////////////////////////////////////////// // Overall weapon properties. this.Name = "Shotgun"; this.WeaponId = WEAPON.SHOTGUN; // It is critical that these values correspond to the numeric id's that the game and bot use. // Usually this is part of the global WPN table. // Don't Defining AmmoType for modes that NeedsAmmo = false. this.PrimaryFire.AmmoType = AMMO.SHELLS; ////////////////////////////////////////////////////////////////////////// // Set some weapon properties that affect some internal logic. this.PrimaryFire.WeaponType = "instant"; // The type of weapon this is. Helps determine usage behavior. Valid values: "melee", "instant", "projectile" this.PrimaryFire.ProjectileSpeed = 1000; // If the WeaponType is "projectile", this projectile speed is used in the aim calculations this.PrimaryFire.NeedsAmmo = true; // weapon requires ammo to fire. if false ammo won't be checked, default is true this.PrimaryFire.WaterProof = true; // weapon can work underwater. if false desirability will default to 0 when underwater, default true this.PrimaryFire.NeedsCharged = false; // weapon needs to be charged up. if true bot internally checks if charged before considering for use, default false this.PrimaryFire.SplashDamage = false; // weapon does splash damage where it hits, defallt false this.PrimaryFire.InheritsVelocity = false; // weapon inherits velocity from shooter, rather than being shot with independent velocity. default is false this.PrimaryFire.ProjectileGravity = 0.0; // What ratio of the games gravity is applied to the projectile, default 0.0 this.PrimaryFire.NeedsInRange = false; // Only allow weapon to be used when the target is within MinRange-MaxRange, default false this.PrimaryFire.MinRange = 0.0; // MinRange used for NeedsInRange check this.PrimaryFire.MaxRange = 1000.0; // MaxRange used for NeedsInRange check this.PrimaryFire.MaxAimError = Vector2(0, 0); // Aim error to apply to aiming system. x = horizontal, y = vertical, default Vector2(0,0) this.PrimaryFire.AimOffset = Vector3(0, 0, 0); // 3d Offset the weapon should add to the targets position, default Vector3(0,0,0) // The default desirability when the bot a) Has no target, or b) No desirability window matches. default is 0.0 this.PrimaryFire.DefaultDesirability = 0.0; // Set some distance windows and the desirability they should use. // Undefined ranges default to 0. // Note: The order of these is important. The first matching range is used by the bot. this.PrimaryFire.SetDesirabilityWindow(0, 64, 0.8); // If this function is defined in the weapon, the bot will make script callbacks to support more complex calculations // to determine the desirability of the weapon. Frequent script callbacks can get expensive, so use the above methods // as much as possible to let the bot calculate the desirability internally based on parameters set by script. // Default behavior is 0 desirability. this.PrimaryFire.CalculateDefaultDesirability = function(bot) { return 0; }; this.PrimaryFire.CalculateDesirability = function(bot, targetInfo) { return 0; }; // If this function is defined, it will be called to allow the script to calculate the point on the enemy to aim at. // Frequent script callbacks can get expensive, so use the above methods as much as possible to let // the bot calculate the desirability internally based on parameters set by script. // Default behavior is to aim at the targets position, based on the WeaponType specified above. // Projectile weapons will automatically lead the target, instant & melee will aim at the targets position. this.PrimaryFire.CalculateAimPoint = function(bot, targetInfo) { return targetInfo.LastPosition; }; ////////////////////////////////////////////////////////////////////////// // Secondary Fire Properties