Skip to content

Fragment System

BDCarrillo edited this page Jan 26, 2022 · 3 revisions

The Fragment System, is an Ammo CS line set, that allows you to spawn another "Projectile", on the death of your current Projectile.

The System does not care, what kind of projectile, you spawn, it can be Beams, Missiles, bullets, EWAR, whatever you please, as long as you properly, identify it.

            Fragment = new FragmentDef // Formerly known as Shrapnel. Spawns specified ammo fragments on projectile death (via hit or detonation).
            {
                AmmoRound = "MagicFragment", // AmmoRound field of the ammo to spawn.
                Fragments = 100, // Number of projectiles to spawn.
                Degrees = 15, // Cone in which to randomize direction of spawned projectiles.
                Reverse = false, // Spawn projectiles backward instead of forward.
                DropVelocity = false, // fragments will not inherit velocity from parent.
                Offset = 0f, // Offsets the fragment spawn by this amount, in meters (positive forward, negative for backwards).
                Radial = 0f, // Determines starting angle for Degrees of spread above.  IE, 0 degrees and 90 radial goes perpendicular to travel path
                MaxChildren = 0, // number of maximum steps/stages for recursive fragments that spawn themselves as children
                IgnoreArming = true, // If true, ignore ArmOnHit or MinArmingTime in EndOfLife definitions
                TimedSpawns = new TimedSpawnDef // disables FragOnEnd in favor of info specified below
                {
                    Enable = true, // Enables TimedSpawns mechanism
                    Interval = 90, // Time between spawning fragments, in ticks
                    StartTime = 0, // Time delay to start spawning fragments, in ticks, of total projectile life
                    MaxSpawns = 1000, // Max number of fragment children to spawn
                    Proximity = 0, // Starting distance from target bounding sphere to start spawning fragments, 0 disables this feature.  No spawning outside this distance
                    ParentDies = true, // Parent dies once after it spawns its last child.
                    PointAtTarget = true, // Start fragment direction pointing at Target
                    PointType = Predict, // Point accuracy, Direct (straight forward), Lead (always fire), Predict (only fire if it can hit)
                    DirectAimCone = 0f, //Aim cone used for Direct fire, in degrees
                    GroupSize = 0, // Number of spawns in each group
                    GroupDelay = 0, // Delay between each group.
                },
            },

AmmoRound, is found in your Ammo CS File', for the Ammo you want to spawn as Shrapnel.

private AmmoDef YourShrapnelAmmoClassID => new AmmoDef // From your Ammo CS File, 
        {
            AmmoMagazine = "Energy",
            AmmoRound = "MyShrapnelPattern",

This is your Shrapnel Ammo Definition; This is what you intend, to have spawn as shrapnel.

private AmmoDef YourAmmoClassID => new AmmoDef // From your Ammo CS File, 
        {
            AmmoMagazine = "Energy",
            AmmoRound = "MyAmmo",

This is your Normal Ammo Definition; This is what you fire.

The First YourShrapnelAmmoClassID , is your Ammo Class ID, this not what you use for Shrapnel, this is what you NEED to put in your Weapon's Ammo list however, for it to function in the Shrapnel system. HardPointUsable = false, // set to false if this is a shrapnel ammoType and you don't want the turret to be able to select it directly. Your shrapnel must also have this line, set to false.

In this case, "MyShrapnelPattern" is what you put down.

            Fragment = new FragmentDef
            {
                AmmoRound = "MyShrapnelPattern",
                Fragments = 100,
                Degrees = 15,
                Reverse = false,
                RandomizeDir = false,
                DropVelocity = false, 
                Offset = 0f,
                Radial = 0f,
            },

This will now spawn, your Shrapnel, 100 of them, at randomized between 0 & 15 degrees forward.

Reverse, fires this backwards, while Randomize randomizes all directions: Great for EWAR Deployment, while Randomize is great for explosives.

Notes about Shrapnel

  • Every Shrapnel, must be on your Weapon's Ammo List, in order to function, and must be "HardpointUsable" False, or it will not spawn properly.

  • Keep in mind your Ammo's Performance cost, when Spawned in Bulk; 100 10-meter bullets is a candle, to the Bonfire of 100 Homing 20km-ranged missiles.

  • Shrapnel, is a full ammo projectile, and can do anything, an normally spawned ammo can do, including Shrapnel; Shrapnel, for these, must still be on the Original Weapon's Ammo list -- Do not make an Infinity Loop, you will crash yourself.

  • Shrapnel, does not require the Energy Magazine type, it can do either, It is suggested to have your Shrapnel use Energy, regardless if your Main Ammo uses Physical Magazines, to ensure no odd behaviors.

Examples of Radial

This is Radial=90 and Degrees=0, which produces a flat outward pattern perpendicular to the projectile trajectory.

This is Radial=45 and Degrees=10, which produces a hollow cone (45 deg) and a fragment cone 10 deg thick.

Clone this wiki locally