dot big bang

Developer API
Menu
All
  • Public
  • Public/Protected
  • All

This example comes with melee and ranged weapon types. These scripts can be placed on weapons that players and NPCs hold, or directly added to NPCs. They can also be stacked. For example, you could have a monster that melee attacks in a radius around it and also launches projectiles.

All of the weapons in the example can be found in the Work Room area. I recommend that you look through the properties on them to see what kind of configuration you can have. I'll also list out the properties below. Select the bat or the boss enemies to see weapon scripts added directly to enemies.

The melee weapon script is Combat - Melee Weapon. It can be set to use its own trigger volume, or a cone angle and distance around the weapon when an attack happens.

Here are the properties on that:

  • Attack Animation

    • Only used on players or NPC enemies. This animation will be played when an attack happens. If the weapon is using its own hitbox it will be activated during this animation.
  • Attack Animation Time Scale

    • The playback speed of the attack animation.
  • Attack Animation Start Time

    • This is the time in seconds that the attack animation will start at. Useful for shortening long animations.
  • Attack Animation End Time

    • This is the time in seconds that the attack animation will end at. Useful for shortening long animations.
  • Use Trigger For Attack Hitbox

    • If true, the "Attack Cone Angle" and "Attack Range" will be ignored and instead a collider on the weapon will be used while the attack is in progress.
  • Attack Range

    • If not using a trigger, the distance from the weapon that an attack can hit a target.
  • Attack Cone Angle

    • If not using a trigger, the angle of a cone, in degrees, in front of the weapon the attack can hit targets in.
  • Face Closest Target Within Distance

    • If true, will make the attacker face the nearest valid attack target within this distance. This works like an aim assist on mobile and can make attacking feel better.
  • Exit Attack Animation

    • Only used on players or NPC enemies. If set, this animation will play after an attack. Other animations like movement may override this animation.
  • Exit Attack Animation Time Scale

    • The playback speed of the exit attack animation.
  • Exit Attack Animation Start Time

    • This is the time in seconds that the exit attack animation will start at. Useful for shortening long animations.
  • Exit Attack Animation End Time

    • This is the time in seconds that the exit attack animation will end at. Useful for shortening long animations.
  • Exit Attack Animation Loop

    • If true, the exit attack animation will loop.
  • Attack Interval

    • The time in seconds between attacks. Trying to attack too early will fail.
  • Pause Movement While Attacking

    • If true, the player or enemy will stop moving during the attack. This is used to make animation look better as a moving and attacking player can have sliding feet.
  • Can Damage Players

    • If true, this weapon will damage players if they are within range of an attack. You need to ensure that attackable targets are on the same collision layer as the weapon.
  • Can Damage NPCs

    • If true, this weapon will damage enemies if they are in range of an attack. You need to ensure that attackable targets are on the same collision layer as the weapon.
  • Can Damage Multiple Targets

    • If true, the weapon will damage each target it hits during an attack. Otherwise only the first target hit will be damaged.
  • Min Attack Damage

    • The smallest amount of damage a hit can cause.
  • Max Attack Damage

    • The largest amount of damage a hit can cause.
  • Critical Chance

    • The chance (0 - 1) that a hit will be a critical hit and have its damage multiplied.
  • Critical Damage Multiplier

    • The multiplier to apply to critical hit damage.
  • Knockback Force

    • The amount of force to apply to a hit target in a direction away from the weapon.
  • Attack Fx

    • The template to spawn when an attack happens.
  • Parent Attack Fx

    • If true, the "Attack Fx" template will be parented to the weapon. This can be used to make swipe effects.
  • Damage Fx

    • The template to spawn when a target is hit.
  • Parent Damage Fx

    • If true, the "Damage Fx" template will be parented to the weapon.

The ranged weapon script is Combat - Ranged Weapon. These weapons fire projectiles and have a variety of ways to customize how the projectiles behave. This script shares many properties with the melee weapon script so I'll outline the differences below:

Note: Ranged weapons do not currently work on mobile. This will be patched when we get the ability to read more information about mobile touch positions.

  • Projectile Template

    • If set, this template will be spawned as the projectile. Otherwise the "Projectile Voxel Object" will be used. One of these must be set.
  • Projectile Voxel Object

    • If set, and a template is not set, this will be spawned as the projectile.
  • Aim Visual Voxel Object

    • This is spawned and used as the aim direction visual. This is only used by players.
  • Aim Visual Offset

    • This can be used to shift the spawn location of the aim visual object.
  • Aim Visual Color

    • The emissive color of the aim visual object is set to this color.
  • Aim Visual Opacity

    • Can be used to make the aim visual object transparent.
  • Projectile Count

    • How many projectiles should be fired per attack?
  • Projectile Speed

    • The speed of the projectiles when they are fired.
  • Projectile Gravity

    • The downward force applied to the projectile as it moves.
  • Projectile Length

    • Projectiles look for capsule overlaps to find targets as they travel. This is the length of that capsule.
  • Projectile Radius

    • The radius of the projectile capsule. Larger numbers result in wider projectiles.
  • Projectile Spread

    • The angle, in degrees, of the cone in front of the weapon that projectiles can fire in.
  • Projectile Random Spread

    • If true, projectiles will be randomly placed into the "Projectile Spread" cone. Otherwise they will be evenly spaced across it.
  • Projectile Spawn Offset

    • Can be used to adjust the spawn location of projectiles to make them appear to be coming out of the correct location.
  • Projectile Angle

    • An angle offset to apply to projectiles. This can be used to make them shoot up into the air or off to one side.
  • Projectile Scale

    • The scale applied to the projectile object.
  • Projectile Lifetime

    • The number of seconds a projectile exists in the game before being automatically removed.
  • Pierce Targets

    • The number of targets a projectile can hit and move through before being removed.