Applying Data Driven Modifiers from script

From Valve Developer Community
Jump to: navigation, search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Underlinked - Logo.png
This article needs more links to other articles to help integrate it into the encyclopedia. Please help improve this article by adding links that are relevant to the context within the existing text.
January 2024

It's possible to freely apply custom data-driven modifiers from VScript using the following function.

CDOTA_Item_DataDriven

Function Signature Description
ApplyDataDrivenModifier void ApplyDataDrivenModifier(handle source, handle target, string modifier_name, handle modifierArgs)

Hopefully you've noticed this function belongs to objects of the Item type. It's used along with a data-driven item definition containing your data-driven modifiers.

	"item_modifier_master"
	{
		"ID"							"1010"

		// General
		//-------------------------------------------------------------------------------------------------------------
		"AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE"
		"BaseClass"						"item_datadriven"

		// Stats
		//-------------------------------------------------------------------------------------------------------------
		"AbilityCastRange"				"100"
		"AbilityCastPoint"				"0.0"
		
		// Item Info
		//-------------------------------------------------------------------------------------------------------------

		"Modifiers"
		{
			"modifier_custom"
			{
				"TextureName" "item_greater_salve"
				"EffectName" "particles/items_fx/healing_flask.vpcf"
				"EffectAttachType" "follow_origin"

				"Properties"
				{
					"MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "100"
			
		
				}
			}
		}
}

And the script:

local ModMaster = CreateItem("item_modifier_master", nil, nil) 
ModMaster:ApplyDataDrivenModifier(unit, unit, "modifier_custom", {duration = 3})
Wikipedia - Letter.png
This article has not been added to any content categories. Please help out by adding categories.
January 2024