Dota 2 Workshop Tools/Scripting/API/ProjectileManager.CreateLinearProjectile

From Valve Developer Community
Jump to: navigation, search
Dead End - Icon.png
This article has no links to other VDC articles. Please help improve this article by adding links that are relevant to the context within the existing text.
January 2024
Note.pngNote: This page is automatically generated. Any changes may be overwritten

Function Description

int CreateLinearProjectile(table infoTable)

Creates a linear projectile and returns the projectile ID

Table Inputs: Ability, Source, vSpawnOrigin, vVelocity, vAcceleration, fDistance, fStartRadius, fEndRadius, bHasFrontalCone, iUnitTargetTeam, iUnitTargetType, iUnitTargetFlags, bProvidesVision, iVisionTeamNumber, iVisionRadius, bDrawsOnMinimap, bVisibleToEnemies, bIgnoreSource,fExpireTime, fMaxSpeed

Example
--Creates a projectile that will travel 2000 units
function fire_arrow(args)
	local caster = args.caster
	--A Liner Projectile must have a table with projectile info
	local info = 
	{
		Ability = args.ability,
        	EffectName = args.EffectName,
        	vSpawnOrigin = caster:GetAbsOrigin(),
        	fDistance = 2000,
        	fStartRadius = 64,
        	fEndRadius = 64,
        	Source = caster,
        	bHasFrontalCone = false,
        	bReplaceExisting = false,
        	iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
        	iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
        	iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
        	fExpireTime = GameRules:GetGameTime() + 10.0,
		bDeleteOnHit = true,
		vVelocity = caster:GetForwardVector() * 1800,
		bProvidesVision = true,
		iVisionRadius = 1000,
		iVisionTeamNumber = caster:GetTeamNumber()
	}
	projectile = ProjectileManager:CreateLinearProjectile(info)
end

Parameters

Type Name Description
table infoTable No Description Set

Returns

int - projectile id