SpawnProjectile
Revision as of 17:20, 1 April 2026 by Krimpebble (talk | contribs) (Created page with "thumb|The SpawnProjectile as seen in the HeliGun example proxy A Spawn Projectile is an Intruder MM sc...")
A Spawn Projectile is an Intruder MM script that as expected, fires projectiles.
This script handles the actual spawning, movement, ammo, and firing cooldown of the projectile. Other scripts (like Heli Gun) can call it to fire automatically, but Spawn Projectile itself is the part that creates the projectile.
Properties
| Property | Description |
|---|---|
| Projectile Name | Name/ID of the projectile to load |
| Speed | How fast the projectile is pushed forward |
| Fire Rate | Time between shots (in seconds) |
| Can Fire | Whether the spawner is currently allowed to shoot |
| Spread | Random angle variation applied to shots |
| Property | Description |
|---|---|
| Current Ammo | How much ammo is currently available |
| Default Ammo | Ammo amount reset to each round (-1 means infinite) |
| Property | Description |
|---|---|
| Forward Offset | Distance in front of the object where the projectile spawns |
| Use Local Pos | Uses local position instead of world position |
| Property | Description |
|---|---|
| Play Sound | Plays a sound when firing |
| Spawn Sound | Sound object to spawn when firing |
| Animation | Animation played when firing |
How firing works
The projectile can be fired via Activator by calling:
NetSpawn()
This function:
- Checks if the spawner can fire
- Spawns the projectile slightly in front of the object
- Applies forward force based on Speed
- Applies spread (if set)
- Reduces ammo (if limited)
- Waits for Fire Rate before allowing the next shot