Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

[Source 2 Beta Bug] ApplyDataDrivenModifier() parameter type error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Source 2 Beta Bug] ApplyDataDrivenModifier() parameter type error

    Starting with the Reborn update, ability:ApplyDataDrivenModifier has started generating the following error: "Unsupported KeyValue type for key duration (type float64)". This causes modifiers to be applied with an infinite duration, leading to infinite stuns and whatnot.


    Here is my datadriven ability code:
    Code:
    "invoker_retro_levitation"
    {
    	// General
    	//-------------------------------------------------------------------------------------------------------------
    	"BaseClass"						"ability_datadriven"
    	"AbilityBehavior"				"DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE"
    	"AbilityTextureName" 			"invoker_retro_levitation"
    	"AbilityCastAnimation" 			"ACT_DOTA_CAST_GHOST_WALK"
    	"FightRecapLevel"				"1"
    	"MaxLevel"						"1"
    	"AbilityProcsMagicStick" 		"1"
    	
    	// Stats
    	//-------------------------------------------------------------------------------------------------------------
    	"AbilityCooldown"				"15"
    	"AbilityManaCost"				"100"
    	
    	"precache"
    	{
    		"particle"		"particles/units/heroes/hero_brewmaster/brewmaster_cyclone.vpcf"
    		"soundfile"		"soundevents/game_sounds_heroes/game_sounds_brewmaster.vsndevts"
    	}
    	
    	// Special
    	//-------------------------------------------------------------------------------------------------------------
    	"AbilitySpecial"
    	{
    		"01"
    		{
    			"var_type"					"FIELD_FLOAT"
    			"duration"					".9 1.8 2.7 3.6 4.5 5.4 6.3 7.2"  //Increases with Quas, Wex, and Exort.
    		}
    		"02"
    		{
    			"var_type"					"FIELD_INTEGER"
    			"cyclone_initial_height"	"175 200 225 250 275 300 325 350"
    		}
    		"03"
    		{
    			"var_type"					"FIELD_INTEGER"
    			"cyclone_min_height"		"125 150 175 200 225 250 275 300"
    		}
    		"04"
    		{
    			"var_type"					"FIELD_INTEGER"
    			"cyclone_max_height"		"225 250 275 300 325 350 375 400"
    		}
    		"05"
    		{
    			"var_type"					"FIELD_FLOAT"
    			"pip_current"				"1"
    		}
    	}
    	
    	"OnSpellStart"
    	{
    		"RunScript"
    		{
    			"ScriptFile"			"heroes/hero_invoker/invoker_retro_levitation.lua"
    			"Function"				"invoker_retro_levitation_on_spell_start"
    		}
    	}
    
    	"Modifiers"
    	{
    		"modifier_invoker_retro_levitation"
    		{
    			"States"
    	        {
    				"MODIFIER_STATE_FLYING"				"MODIFIER_STATE_VALUE_ENABLED"
    	        	"MODIFIER_STATE_NO_UNIT_COLLISION"	"MODIFIER_STATE_VALUE_ENABLED"
    				"MODIFIER_STATE_STUNNED"			"MODIFIER_STATE_VALUE_ENABLED"
    				"MODIFIER_STATE_ROOTED"				"MODIFIER_STATE_VALUE_ENABLED"
    				"MODIFIER_STATE_DISARMED"			"MODIFIER_STATE_VALUE_ENABLED"
    				"MODIFIER_STATE_INVULNERABLE"		"MODIFIER_STATE_VALUE_ENABLED"
    				"MODIFIER_STATE_NO_HEALTH_BAR"		"MODIFIER_STATE_VALUE_ENABLED"
    	        }
    	
    			"OnCreated"
    			{
    				"AttachEffect"
    				{
    					"EffectName"		"particles/units/heroes/hero_brewmaster/brewmaster_cyclone.vpcf"
    					"EffectAttachType"	"world_origin"
    					"Target"            "CASTER"
    				}
    
    				"RunScript"
    	        	{
    	        		"ScriptFile"	"heroes/hero_invoker/invoker_retro_levitation.lua"
    	        		"Function"		"TornadoHeight"
    	        	}
    			}
    
    			"OverrideAnimation"     "ACT_DOTA_DISABLED"
    		}
    	}
    }

    And here is the relevant Lua code:
    Code:
    function invoker_retro_levitation_on_spell_start(keys)	
    	--Levitate's duration is dependent on the levels of Quas, Wex, and Exort.
    	local quas_ability = keys.caster:FindAbilityByName("invoker_retro_quas")
    	local wex_ability = keys.caster:FindAbilityByName("invoker_retro_wex")
    	local exort_ability = keys.caster:FindAbilityByName("invoker_retro_exort")
    	
    	if quas_ability ~= nil and wex_ability ~= nil and exort_ability ~= nil then
    		keys.caster:EmitSound("Brewmaster_Storm.Cyclone")
    		
    		local average_level = (quas_ability:GetLevel() + wex_ability:GetLevel() + exort_ability:GetLevel()) / 3
    		average_level = math.floor(average_level + .5)  --Round to the nearest integer.
    		
    		--Ensure that the average level is in-bounds, just in case.
    		if average_level < 1 then
    			average_level = 1
    		end
    		if average_level > 8 then
    			average_level = 8
    		end
    		
    		local levitation_duration = keys.ability:GetLevelSpecialValueFor("duration", average_level - 1)
    		
    		keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_invoker_retro_levitation", {duration = levitation_duration})
    		
    		--Stop the sound when the levitation ends.
    		Timers:CreateTimer({
    			endTime = levitation_duration,
    			callback = function()
    				keys.caster:StopSound("Brewmaster_Storm.Cyclone")
    				--keys.caster:RemoveModifierByName("modifier_invoker_retro_levitation")
    			end
    		})
    	end
    end


    In short, keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_invoker_retro_levitation", {duration = levitation_duration}) causes the following error:

    [ W General ]: Unsupported KeyValue type for key duration (type float64)
Working...
X