Skip to content

Homing Projectile

Wilhelm edited this page Sep 6, 2022 · 3 revisions

CompProperties_HomingProjectile allows you to make projectiles for weapons that home in on their target, meaning they follow the target. As an example, think of how the Needler in Halo works. This code allows you to create something similar to that.

Example of usage:

		<comps>
			<li Class="VFECore.CompProperties_HomingProjectile">
				<homingDistanceFractionPassed>0.7</homingDistanceFractionPassed>
				<homingCorrectionTickRate>5</homingCorrectionTickRate>
				<initialDispersionFromTarget>2.5</initialDispersionFromTarget>
				<hitSound>RM_Hit_Needler</hitSound>
			</li>
		</comps>

This comp must be placed the ThingDef of the defaultProjectile your weapon uses.

<homingDistanceFractionPassed>0.7</homingDistanceFractionPassed> defines how far away the target can be for the projectile to home in on. The higher the number, the greater the distance.

<homingCorrectionTickRate>5</homingCorrectionTickRate> defines how often the projectile can change its angle. Here it can change its projectile every 5 ticks.

<initialDispersionFromTarget>2.5</initialDispersionFromTarget> defines at what angle to the target the bullets will be fired from. This allows the weapon to shoot the bullets in different angles at the target, allow them to feel like a swarm homing in. Min value is 0.

<hitSound>RM_Hit_Needler</hitSound> defines a custom sound that is played when the projectile hits its target or something else, like a wall.

VFE Core

General Comp classes

General DefModExtensions

Item Processor

PipeSystem

Custom Structure Generation

Multi Verb Combat Framework - MVCF

Animal Behaviours

Genes

Apparel

Cuisine

Furniture

Plants

Deprecated

Clone this wiki locally